Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numerous resource leaks fixed #7

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

lukaszsamson
Copy link

Before this patch erlzmq was leaking enif_resource which prevented closed sockets and terminated context to be garbage collected due to unbalanced enif_resource_keep calls. Moreover, it leaked an unjoined thread. All threads created by https://erlang.org/doc/man/erl_driver.html#erl_drv_thread_create must be joined before unloading driver.
One of the tests was also invalid - it incorrectly assumed that zmq_term will close all sockets. See http://api.zeromq.org/master:zmq-term

fix enif_resource leaks on socket and context
add destructors
assert in destructors that close or term was called
fix deadlock on socket close immediately after term
zmq_term will NOT close sockets. It will block until sockets are closed with zmq_close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant