作者:黄石幽兰it | 来源:互联网 | 2023-09-10 14:15
It's simple to recreate the scenario, just call nn_term directly with no nn_sock calling will cause the crash;
I debugged out the reason:
self.lock is not initilized.
self.lock is initilized in nn_lib_init
The situation is rare in my app, that with a dozen of conditions in my multi-thread app accidental satisfied, no agent is created, then the final cleaning that calls nn_term will crash.
It's easy for me to work around, just add a judgement on the agent number.
But I think it should be refined, that manomsg is focus on high reliability regardless on the state.
I suggest add a non-initialized state, that nn_term will not crash even no sock was ever created.
该提问来源于开源项目:nanomsg/nanomsg
Good news, we have nn_once already. So the fix is easy.