Skip to content

Commit

Permalink
fix: don't call nng_fini() by default
Browse files Browse the repository at this point in the history
  • Loading branch information
broglep-work committed May 24, 2024
1 parent 9b651be commit b56f2d8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pynng/nng.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@
# during a callback to _nng_pipe_cb
# * Cleanup background queue threads used by NNG

# NOTE: enabling this can lead to nng panic / crash on python runtime shutdown. Depending on when the atexit function
# is called and objects garbage are collected, it might be possible that nng_fini is already called, but we are is
# still calling the nng lib (e.g. nni_aio_free by AIOHelper.__del__).

nng_fini_at_exit = False

def _pynng_atexit():
lib.nng_fini()
if nng_fini_at_exit:
lib.nng_fini()


atexit.register(_pynng_atexit)
Expand Down

0 comments on commit b56f2d8

Please sign in to comment.