about OPENSSL_thread_stop

1 篇文章 0 订阅
1 篇文章 0 订阅

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().

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值