zeromq / netmq

A 100% native C# implementation of ZeroMQ for .NET
Other
2.95k stars 744 forks source link

Deadlocking when restarting the push/pull example #889

Closed mrakgr closed 2 years ago

mrakgr commented 4 years ago

Environment

NetMQ Version: 4.0.1.2-pre
Operating System: Windows 10
.NET Version: .NET Core 3.1

Expected behaviour

100 messages get processed.

Actual behaviour

The program deadlocks.

Steps to reproduce the behaviour

Double-press space rapidly.


I made the minimal example here. This is the divide and conquer example translated to NetMQ from the ZeroMQ guide. I've taken some liberties to make them cancellable as for many guide example the only way to end them is to terminate the process.

Unfortunately, even though it might be related this is not the error I am getting on the full example. What happens is that on the full example after a few runs (during which it has finished processing the previous batch) it deadlocks in the middle of the message processing. It does not seem like it disposes of the sockets properly after the end of the previous run. I first noticed this while doing the KillSignal example, but it is present in the DivideAndConquer as well.

mrakgr commented 4 years ago

Thinking back a bit, while building the various examples, I've had trouble disposing the sockets properly as just calling dispose would not disconnect or unbind them right away, instead the calls to that seem to be asynchronous. Personally, I'd like the option to have the disposal be blocking.

Some of the recent pull requests seem to be related to disposal and removal of sockets from the poller. This issue might be related to that, but I am not getting an exception thrown in my code.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had activity for 365 days. It will be closed if no further activity occurs within 56 days. Thank you for your contributions.