the official link:
https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_thread_stop.html#NOTES
openssl git issue:
https://github.com/openssl/openssl/issues/6081
PERSONAL_EXPERIENCE:
Before version of openssl_1.1.1-prefx, such as openssl_1.1.0.x, calling OPENSSL_thread_stop() several times in the same thread(some threadpool will execute several runnables in the same thread) may not crash. BUT it does crash since 1.1.1-prefx!!!
Lucky!!! The coder has FIXED it https://github.com/openssl/openssl/pull/6089. We may be good to call OPENSSL_thread_stop after version_1.1.1_pref5(not including this version).
REASON:
Not precisely, the reason may be the codes about drgb and ossl_init_thread_stop.
see this: https://github.com/openssl/openssl/commit/7caf122e717e79afcb986fe217e77a630b67bf4c
Personal handler:
First of all, read the official notes above carefully: it is telling us that we should call OPENSSL_thread_stop() when a thread is about to stop in situations that openssl it-self cannot recycle resources. I think we SHOULD do NOTHING with openssl after we call OPENSSL_thread_stop(), such as network task.
We can use qthreadstorage or something like threadlocal in java, put them in somewhere you will use curl or openssl. Set an object to qthreadstorage for a thread and make sure that there is only one object for the thread. In ~object(), call the OPENSSL_thread_stop().