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

Finalizer thread blocked if ZmqContext goes out of scope #167

Open
rtanase opened this issue Apr 14, 2015 · 1 comment
Open

Finalizer thread blocked if ZmqContext goes out of scope #167

rtanase opened this issue Apr 14, 2015 · 1 comment

Comments

@rtanase
Copy link

rtanase commented Apr 14, 2015

Hi,

If we're not careful to dispose the ZmqSockets created and the ZmqContext goes out of scope, the finalizer thread is stuck forever. The documentation says that we're supposed to use a non-default Linger setting to make sure sockets would not stay blocked, but even with that option I'm still unable to avoid the blocking on the finalizer.

A simple repro is here:

var context = ZmqContext.Create();
var socket = context.CreateSocket(SocketType.PUB);
socket.Identity = Guid.NewGuid().ToByteArray();
socket.Linger = TimeSpan.FromSeconds(1);
socket.TcpKeepalive = TcpKeepaliveBehaviour.Enable;
context = null;
GC.Collect();
GC.WaitForPendingFinalizers();

@fynman
Copy link

fynman commented Oct 5, 2015

add socket.Close() before context = null

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

No branches or pull requests

2 participants