[ 
https://issues.apache.org/jira/browse/THRIFT-4402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16276062#comment-16276062
 ] 

Henrique Andrade commented on THRIFT-4402:
------------------------------------------

BTW, along the same lines, there are similarly declared global symbols in 
TSSLSocket.cpp/h as well:

0000000000000000 B 
apache::thrift::transport::TSSLSocketFactory::manualOpenSSLInitialization_
0000000000000028 B apache::thrift::transport::TSSLSocketFactory::count_
0000000000000010 B apache::thrift::transport::TSSLSocketFactory::mutex_


> Minimize global uninitialized symbol leakage (TSocket::useLowMinRto_)
> ---------------------------------------------------------------------
>
>                 Key: THRIFT-4402
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4402
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.10.0
>            Reporter: Henrique Andrade
>            Priority: Trivial
>
> Since the symbol TSocket::useLowMinRto_ is only used in TSocket.cpp, it can 
> be declared and made static in TSocket.cpp itself (no need for it to be 
> declared in the header file).
> This way it will not be a global symbol in the corresponding shared file.
> ```
> > nm -C ./lib/cpp/src/thrift/transport/TSocket.o | grep " B "
> 0000000000000000 B apache::thrift::transport::TSocket::useLowMinRto_
> ```
> Unnecessary exposed global symbols like this can cause subtle dynamic linking 
> errors:
> https://stackoverflow.com/questions/6714046/c-linux-double-destruction-of-static-variable-linking-symbols-overlap



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to