我正在使用
http://www.openssl.org/docs/crypto/threads.html
使加密库线程安全。如果我链接libssl和libcrypto的静态库,它正在工作。
但是,如果我链接到动态版本的库并运行多个二进制实例,它就会崩溃。
如何解决此问题?
编辑
程序总是崩溃
#0 0x00007f9f42257be5 in ?? () from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
#1 0x00007f9f4225820c in lh_retrieve () from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
#2 0x00007f9f4225ac8e in ?? () from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
#3 0x00007f9f4225bb41 in ERR_get_state () from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
#4 0x00007f9f4225c886 in ERR_clear_error () from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
#5 0x00007f9f44df496c in ?? () from /usr/lib/x86_64-linux-gnu/libcurl.so.4
#6 0x00007f9f44df6015 in Curl_ossl_connect () from /usr/lib/x86_64-linux-gnu/libcurl.so.4
#7 0x00007f9f44e0a349 in Curl_ssl_connect () from /usr/lib/x86_64-linux-gnu/libcurl.so.4
#8 0x00007f9f44de0950 in Curl_http_connect () from /usr/lib/x86_64-linux-gnu/libcurl.so.4
#9 0x00007f9f44df12ba in Curl_protocol_connect () from /usr/lib/x86_64-linux-gnu/libcurl.so.4
#10 0x00007f9f44df15b0 in Curl_connect () from /usr/lib/x86_64-linux-gnu/libcurl.so.4
但是在与静态版本链接时,它并没有崩溃
另一个bt
#0 0x00007f57a01b1be5 in ?? () from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
#1 0x00007f57a01b20bf in lh_delete () from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
#2 0x00007f57a01b45b3 in ?? () from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
#3 0x00007f57a01b5a5a in ERR_remove_thread_state () from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
#4 0x00007f57a2d4ffbb in Curl_ossl_close_all () from /usr/lib/x86_64-linux-gnu/libcurl.so.4
#5 0x00007f57a2d47742 in Curl_close () from /usr/lib/x86_64-linux-gnu/libcurl.so.4