[zeromq-dev] zmq-signaler-port-sync

Pau pau at teleopsia.com
Mon Jan 21 18:23:58 CET 2013


I am using (not yet in production) ZMQ on Windows and I have found what 
I think is a big problem for Windows users.
We use WXP and W7 and Visual C++ different versions. ZMQ version 3.2.0 
(as far as I see the same problem happens in 3.2.2)

I do not fully understand ZMQ internals but I've seen that every time a 
socket is created the function make_fdpair(..) is called and in 
signaler.cpp(line244) a system event "zmq-signaler-port-sync" is created.
This event is used as a system-wide critical section and, so all 
applications that try to create an event will WaitForSingleObject (sync, 
INFINITE) until  SetEvent (...) is called.
The problem is that the code between:
  HANDLE sync = CreateEvent (NULL, FALSE, TRUE, TEXT 
SetEvent (sync);
is full of wsa_asserts(..) that will terminate the application if 
something goes wrong.

It is clear that terminating the application not leaving the system-wide 
critical section is a bad idea because all applications in the system 
will hang and you will have to stop all them to start again.
I understand that no errors should happen but anyway to escape from the 
error is not a good idea in this case.

I do not know all possible reasons to generate a fatal wsa_assert(..) 
but there is at least one:

I have seen that in XP it is possible that line 301  rc = connect (*w_, 
(sockaddr *) &addr, sizeof (addr)); returns an error when a socket tries 
to connect to 5905 and this has happened many times.
Windows uses port numbers starting near 1400 and XP has a limit at 5000. 
In W7 this does not look as a problem because maximum is 65000
It sounds as if the number was big enough but apart from the fact that 
ZMQ uses a big number of connections (at least in my tests) I have 
experienced that Windows jumps port numbers by 7, so 5000 happens 
sometimes with catastrophic consequences.


Pau Ceano

More information about the zeromq-dev mailing list