Open jcoeltjen opened 7 years ago
The given snippet works fine with JeroMQ but crashes when using JZMQ.
Do you mean the opposite instead?
No the four lines work with JeroMQ (master) but not with JZMQ (master).
The environment is Windows 7 x64 and the version I used the the current master. I think think is caused by the fact that the ZContext closes all Sockets when its close/destroy-method is called without checking if the sockets need to be closed. I don't know if there is an easy way to check whether the sockets has already been destructed or not.
This is not a critical bug because of the easy workaround of just not closing any sockets explicitly and only use the context to clean up. Maybe the error is not even located in JZMQ but libzmq.
I don't think there is an error in libzmq. libzmq does not allow calling zmq_close multiple times. This was just clarified in the docs: https://github.com/zeromq/libzmq/pull/2792/files
I think this is exactly the problem. JZMQ only passes the close() to the underlying libzmq library.
As mentioned in the documentation you referenced the behavior of libzmq is undefined when zmq_close() is called more than once. Maybe this results in the error shown above.
I think we have three possibilities here:
Either way closing a socket more than once should not throw an UnknownError.
Option 3 is not possible. zmq_close ultimately deletes the socket object (asynchronously). Accessing a deleted object always leads to undefined behaviour in "native land".
I don't think any of the options 1-3 is a good idea.
I suggest the following
Hi Guys, I just got the same error: Unknown error (0x80) in a different context. Do you have any clue where 0x80 comes from? As I see JZMQ code ZMQException is initialized with the zmq_errno and zmq_strerror results, but I don't see any 0x80 errno in libzmq or jzmq code anywhere.
0x80 doesn't seem to be anything related to libzmq neither on linux (EKEYREVOKED) or windows (STRUNCATE). Any idea?
When trying to close a ZContext with an associated socket that has already been closed a ZMQException is thrown. The given snippet works fine with JeroMQ but crashes when using JZMQ.
Expected Behavior
ZContext should be closed without exception.
Current Behavior
Possible Solution
Only try to destroy a socket that has not been destroyed previously.
Steps to Reproduce