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

Mario Emmenlauer commented on THRIFT-4411:
------------------------------------------

I was avoiding this discussion for a long time in the hope I would get more 
enlighted, but thruth be told, I'm not knowledgable enough about openssl 
initialization and cleanup to understand what you pointed out. How can I 
discriminate the lifetime of TSSLSocket vs the lifetime of the 
TSSLSocketFactory, and why would the one be different from the other? Is it not 
passed down, do I need to perform this manually? Or am I now on the wrong track?

Thanks a lot for your help!

> SIGABRT in thrift client during program end, C++, using openssl
> ---------------------------------------------------------------
>
>                 Key: THRIFT-4411
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4411
>             Project: Thrift
>          Issue Type: Question
>          Components: C++ - Library
>    Affects Versions: 0.11.0
>         Environment: Ubuntu Linux x86_64
>            Reporter: Mario Emmenlauer
>            Assignee: James E. King, III
>            Priority: Major
>
> After upgrading to thrift 1.0.0 rev 20e16bc I get a SIGABRT during exit of my 
> thrift RPC client. This did not happen with 0.10.0. Here is a stack trace. Do 
> you need to see the source code?
> {noformat}
> LightBISClientCMDLine: 
> /data/thirdparty/include/boost/smart_ptr/shared_array.hpp:199: T& 
> boost::shared_array<T>::operator[](std::ptrdiff_t) const [with T = 
> apache::thrift::concurrency::Mutex; std::ptrdiff_t = long int]: Assertion `px 
> != 0' failed.
> Program received signal SIGABRT, Aborted.
> 0x00007ffff6c29428 in __GI_raise (sig=sig@entry=6) at 
> ../sysdeps/unix/sysv/linux/raise.c:54
> 54    ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
> (gdb) bt
> #0  0x00007ffff6c29428 in __GI_raise (sig=sig@entry=6) at 
> ../sysdeps/unix/sysv/linux/raise.c:54
> #1  0x00007ffff6c2b02a in __GI_abort () at abort.c:89
> #2  0x00007ffff6c21bd7 in __assert_fail_base (fmt=<optimized out>, 
> assertion=assertion@entry=0x7ffff69bc190 "px != 0", 
>     file=file@entry=0x7ffff69bc108 
> "/data/thirdparty/include/boost/smart_ptr/shared_array.hpp", 
> line=line@entry=199, 
>     function=function@entry=0x7ffff69bc1c0 
> <boost::shared_array<apache::thrift::concurrency::Mutex>::operator[](long) 
> const::__PRETTY_FUNCTION__> "T& 
> boost::shared_array<T>::operator[](std::ptrdiff_t) const [with T = 
> apache::thrift::concurrency::Mutex; std::ptrdiff_t = long int]") at 
> assert.c:92
> #3  0x00007ffff6c21c82 in __GI___assert_fail (assertion=0x7ffff69bc190 "px != 
> 0", 
>     file=0x7ffff69bc108 
> "/data/thirdparty/include/boost/smart_ptr/shared_array.hpp", line=199, 
>     function=0x7ffff69bc1c0 
> <boost::shared_array<apache::thrift::concurrency::Mutex>::operator[](long) 
> const::__PRETTY_FUNCTION__> "T& 
> boost::shared_array<T>::operator[](std::ptrdiff_t) const [with T = 
> apache::thrift::concurrency::Mutex; std::ptrdiff_t = long int]") at 
> assert.c:101
> #4  0x00007ffff69acee9 in 
> boost::shared_array<apache::thrift::concurrency::Mutex>::operator[] 
> (this=0x7ffff6bf3c00 <apache::thrift::transport::mutexes>, i=12)
>     at /data/thirdparty/include/boost/smart_ptr/shared_array.hpp:199
> #5  0x00007ffff69a717f in apache::thrift::transport::callbackLocking (mode=9, 
> n=12)
>     at 
> /data/thirdparty/thrift-1.0.0.20e16bc/lib/cpp/src/thrift/transport/TSSLSocket.cpp:77
> #6  0x00007ffff57ab8e7 in CRYPTO_add_lock () from 
> /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
> #7  0x00007ffff5bcacec in SSL_CTX_free () from 
> /lib/x86_64-linux-gnu/libssl.so.1.0.0
> #8  0x00007ffff69a775d in apache::thrift::transport::SSLContext::~SSLContext 
> (this=0x6725b0, __in_chrg=<optimized out>)
>     at 
> /data/thirdparty/thrift-1.0.0.20e16bc/lib/cpp/src/thrift/transport/TSSLSocket.cpp:200
> #9  0x00007ffff69a7798 in apache::thrift::transport::SSLContext::~SSLContext 
> (this=0x6725b0, __in_chrg=<optimized out>)
>     at 
> /data/thirdparty/thrift-1.0.0.20e16bc/lib/cpp/src/thrift/transport/TSSLSocket.cpp:203
> #10 0x00007ffff69adebe in 
> std::_Sp_counted_ptr<apache::thrift::transport::SSLContext*, 
> (__gnu_cxx::_Lock_policy)2>::_M_dispose (this=0x6737e0) at 
> /usr/include/c++/5/bits/shared_ptr_base.h:374
> #11 0x0000000000425744 in 
> std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x6737e0) 
> at /usr/include/c++/5/bits/shared_ptr_base.h:150
> #12 0x0000000000424439 in 
> std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count 
> (this=0x674150, __in_chrg=<optimized out>) at 
> /usr/include/c++/5/bits/shared_ptr_base.h:659
> #13 0x00007ffff69acb96 in 
> std::__shared_ptr<apache::thrift::transport::SSLContext, 
> (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x674148, 
> __in_chrg=<optimized out>)
> ---Type <return> to continue, or q <return> to quit---
>     at /usr/include/c++/5/bits/shared_ptr_base.h:925
> #14 0x00007ffff69acbd8 in 
> std::shared_ptr<apache::thrift::transport::SSLContext>::~shared_ptr 
> (this=0x674148, __in_chrg=<optimized out>) at 
> /usr/include/c++/5/bits/shared_ptr.h:93
> #15 0x00007ffff69a7e8c in apache::thrift::transport::TSSLSocket::~TSSLSocket 
> (this=0x674050, __in_chrg=<optimized out>)
>     at 
> /data/thirdparty/thrift-1.0.0.20e16bc/lib/cpp/src/thrift/transport/TSSLSocket.cpp:248
> #16 0x00007ffff69a7ec8 in apache::thrift::transport::TSSLSocket::~TSSLSocket 
> (this=0x674050, __in_chrg=<optimized out>)
>     at 
> /data/thirdparty/thrift-1.0.0.20e16bc/lib/cpp/src/thrift/transport/TSSLSocket.cpp:250
> #17 0x00007ffff69ade4c in 
> std::_Sp_counted_ptr<apache::thrift::transport::TSSLSocket*, 
> (__gnu_cxx::_Lock_policy)2>::_M_dispose (this=0x674180) at 
> /usr/include/c++/5/bits/shared_ptr_base.h:374
> #18 0x0000000000425744 in 
> std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x674180) 
> at /usr/include/c++/5/bits/shared_ptr_base.h:150
> #19 0x0000000000424439 in 
> std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count 
> (this=0x679960, __in_chrg=<optimized out>) at 
> /usr/include/c++/5/bits/shared_ptr_base.h:659
> #20 0x00007ffff7b1b98a in 
> std::__shared_ptr<apache::thrift::transport::TTransport, 
> (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x679958, 
> __in_chrg=<optimized out>)
>     at /usr/include/c++/5/bits/shared_ptr_base.h:925
> #21 0x00007ffff7b1b9a6 in 
> std::shared_ptr<apache::thrift::transport::TTransport>::~shared_ptr 
> (this=0x679958, __in_chrg=<optimized out>) at 
> /usr/include/c++/5/bits/shared_ptr.h:93
> #22 0x00007ffff6996f92 in 
> apache::thrift::transport::TBufferedTransport::~TBufferedTransport 
> (this=0x679930, __in_chrg=<optimized out>)
>     at 
> /data/thirdparty/thrift-1.0.0.20e16bc/lib/cpp/src/thrift/transport/TBufferTransports.h:184
> #23 0x00007ffff7b2c775 in 
> __gnu_cxx::new_allocator<apache::thrift::transport::TBufferedTransport>::destroy<apache::thrift::transport::TBufferedTransport>
>  (this=0x679930, __p=0x679930)
>     at /usr/include/c++/5/ext/new_allocator.h:124
> #24 0x00007ffff7b2b52f in 
> std::allocator_traits<std::allocator<apache::thrift::transport::TBufferedTransport>
>  >::destroy<apache::thrift::transport::TBufferedTransport> (__a=..., 
> __p=0x679930)
>     at /usr/include/c++/5/bits/alloc_traits.h:542
> #25 0x00007ffff7b2a841 in 
> std::_Sp_counted_ptr_inplace<apache::thrift::transport::TBufferedTransport, 
> std::allocator<apache::thrift::transport::TBufferedTransport>, 
> (__gnu_cxx::_Lock_policy)2>::_M_dispose (this=0x679920) at 
> /usr/include/c++/5/bits/shared_ptr_base.h:531
> #26 0x0000000000425744 in 
> std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x679920) 
> at /usr/include/c++/5/bits/shared_ptr_base.h:150
> #27 0x0000000000424439 in 
> std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count 
> (this=0x675f00, __in_chrg=<optimized out>) at 
> /usr/include/c++/5/bits/shared_ptr_base.h:659
> #28 0x00007ffff7b1b98a in 
> std::__shared_ptr<apache::thrift::transport::TTransport, 
> (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x675ef8, 
> __in_chrg=<optimized out>)
>     at /usr/include/c++/5/bits/shared_ptr_base.h:925
> ---Type <return> to continue, or q <return> to quit---
> #29 0x00007ffff7b1b9a6 in 
> std::shared_ptr<apache::thrift::transport::TTransport>::~shared_ptr 
> (this=0x675ef8, __in_chrg=<optimized out>) at 
> /usr/include/c++/5/bits/shared_ptr.h:93
> #30 0x00007ffff6982d64 in apache::thrift::protocol::TProtocol::~TProtocol 
> (this=0x675ef0, __in_chrg=<optimized out>)
>     at 
> /data/thirdparty/thrift-1.0.0.20e16bc/lib/cpp/src/thrift/protocol/TProtocol.cpp:26
> #31 0x00007ffff7b2992c in 
> apache::thrift::protocol::TProtocolDefaults::~TProtocolDefaults 
> (this=0x675ef0, __in_chrg=<optimized out>)
>     at /data/thirdparty/include/thrift/protocol/TVirtualProtocol.h:42
> #32 0x00007ffff7b2999e in 
> apache::thrift::protocol::TVirtualProtocol<apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport,
>  apache::thrift::protocol::TNetworkBigEndian>, 
> apache::thrift::protocol::TProtocolDefaults>::~TVirtualProtocol 
> (this=0x675ef0, __in_chrg=<optimized out>)
>     at /data/thirdparty/include/thrift/protocol/TVirtualProtocol.h:312
> #33 0x00007ffff7b2a41c in 
> apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport,
>  apache::thrift::protocol::TNetworkBigEndian>::~TBinaryProtocolT 
> (this=0x675ef0, 
>     __in_chrg=<optimized out>) at 
> /data/thirdparty/include/thrift/protocol/TBinaryProtocol.h:38
> #34 0x00007ffff7b2c741 in 
> __gnu_cxx::new_allocator<apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport,
>  apache::thrift::protocol::TNetworkBigEndian> 
> >::destroy<apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport,
>  apache::thrift::protocol::TNetworkBigEndian> > (this=0x675ef0, __p=0x675ef0) 
> at /usr/include/c++/5/ext/new_allocator.h:124
> #35 0x00007ffff7b2b4ef in 
> std::allocator_traits<std::allocator<apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport,
>  apache::thrift::protocol::TNetworkBigEndian> > 
> >::destroy<apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport,
>  apache::thrift::protocol::TNetworkBigEndian> > (__a=..., __p=0x675ef0)
>     at /usr/include/c++/5/bits/alloc_traits.h:542
> #36 0x00007ffff7b2a6af in 
> std::_Sp_counted_ptr_inplace<apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport,
>  apache::thrift::protocol::TNetworkBigEndian>, 
> std::allocator<apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport,
>  apache::thrift::protocol::TNetworkBigEndian> >, 
> (__gnu_cxx::_Lock_policy)2>::_M_dispose (this=0x675ee0)
>     at /usr/include/c++/5/bits/shared_ptr_base.h:531
> #37 0x0000000000425744 in 
> std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x675ee0) 
> at /usr/include/c++/5/bits/shared_ptr_base.h:150
> #38 0x0000000000424439 in 
> std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count 
> (this=0x679b00, __in_chrg=<optimized out>) at 
> /usr/include/c++/5/bits/shared_ptr_base.h:659
> #39 0x00007ffff7b1bde0 in 
> std::__shared_ptr<apache::thrift::protocol::TProtocol, 
> (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x679af8, 
> __in_chrg=<optimized out>)
>     at /usr/include/c++/5/bits/shared_ptr_base.h:925
> #40 0x00007ffff7b1bdfc in 
> std::shared_ptr<apache::thrift::protocol::TProtocol>::~shared_ptr 
> (this=0x679af8, __in_chrg=<optimized out>) at 
> /usr/include/c++/5/bits/shared_ptr.h:93
> #41 0x00007ffff7b9ace0 in LightBISAPI::APIAccessClient::~APIAccessClient 
> (this=0x679af0, __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
> ---Type <return> to continue, or q <return> to quit---
>     at /data/client/src/gen-cpp/APIAccess.h:5550
> #42 0x00007ffff7b9ad36 in LightBISAPI::APIAccessClient::~APIAccessClient 
> (this=0x679af0, __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
>     at /data/client/src/gen-cpp/APIAccess.h:5550
> #43 0x00007ffff7b215f8 in 
> std::default_delete<LightBISAPI::APIAccessClient>::operator() (this=0x6799e0, 
> __ptr=0x679af0) at /usr/include/c++/5/bits/unique_ptr.h:76
> #44 0x00007ffff7b2ab4e in 
> std::_Sp_counted_deleter<LightBISAPI::APIAccessClient*, 
> std::default_delete<LightBISAPI::APIAccessClient>, std::allocator<void>, 
> (__gnu_cxx::_Lock_policy)2>::_M_dispose (
>     this=0x6799d0) at /usr/include/c++/5/bits/shared_ptr_base.h:466
> #45 0x0000000000425744 in 
> std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x6799d0) 
> at /usr/include/c++/5/bits/shared_ptr_base.h:150
> #46 0x0000000000424439 in 
> std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count 
> (this=0x655ba0, __in_chrg=<optimized out>) at 
> /usr/include/c++/5/bits/shared_ptr_base.h:659
> #47 0x00007ffff7b1cd30 in std::__shared_ptr<LightBISAPI::APIAccessClient, 
> (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x655b98, 
> __in_chrg=<optimized out>)
>     at /usr/include/c++/5/bits/shared_ptr_base.h:925
> #48 0x00007ffff7b1cd68 in 
> std::shared_ptr<LightBISAPI::APIAccessClient>::~shared_ptr (this=0x655b98, 
> __in_chrg=<optimized out>) at /usr/include/c++/5/bits/shared_ptr.h:93
> #49 0x00007ffff7b1241e in LightBISClientCpp::~LightBISClientCpp 
> (this=0x655ac0, __in_chrg=<optimized out>) at 
> /data/client/src/LightBISClientCpp.cc:148
> #50 0x000000000042db55 in 
> __gnu_cxx::new_allocator<LightBISClientCpp>::destroy<LightBISClientCpp> 
> (this=0x655ac0, __p=0x655ac0) at /usr/include/c++/5/ext/new_allocator.h:124
> #51 0x000000000042d269 in 
> std::allocator_traits<std::allocator<LightBISClientCpp> 
> >::destroy<LightBISClientCpp> (__a=..., __p=0x655ac0) at 
> /usr/include/c++/5/bits/alloc_traits.h:542
> #52 0x000000000042c1c7 in std::_Sp_counted_ptr_inplace<LightBISClientCpp, 
> std::allocator<LightBISClientCpp>, (__gnu_cxx::_Lock_policy)2>::_M_dispose 
> (this=0x655ab0)
>     at /usr/include/c++/5/bits/shared_ptr_base.h:531
> #53 0x0000000000425744 in 
> std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x655ab0) 
> at /usr/include/c++/5/bits/shared_ptr_base.h:150
> #54 0x0000000000424439 in 
> std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count 
> (this=0x7fffffffd4e8, __in_chrg=<optimized out>) at 
> /usr/include/c++/5/bits/shared_ptr_base.h:659
> #55 0x00000000004238f6 in std::__shared_ptr<LightBISClientCpp, 
> (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x7fffffffd4e0, 
> __in_chrg=<optimized out>)
>     at /usr/include/c++/5/bits/shared_ptr_base.h:925
> #56 0x0000000000423912 in std::shared_ptr<LightBISClientCpp>::~shared_ptr 
> (this=0x7fffffffd4e0, __in_chrg=<optimized out>) at 
> /usr/include/c++/5/bits/shared_ptr.h:93
> #57 0x00000000004223d5 in main (argc=4, argv=0x7fffffffd928) at 
> /data/client/tools/LightBISClientCMDLine/LightBISClientCMDLine.cc:78
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to