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

ZeroMQ will crash under Windows if port 5905 is in use by another process #1542

Closed
mattbolgercsiro opened this issue Aug 21, 2015 · 4 comments

Comments

@mattbolgercsiro
Copy link
Contributor

The use of port 5906 as the event_signaler_port is hard coded in two locations (signaler.cpp and config.hpp). If this port is already in use (in my case by RealVNC) then ZeroMQ will crash on the first call to WinSock select().

Shouldn't this port being in use be handled more gracefully and be caught at the actual setup of the sockets in signaler_t::make_fdpair()?

http://lists.zeromq.org/pipermail/zeromq-dev/2015-August/029451.html

@pijyoi
Copy link
Contributor

pijyoi commented Aug 21, 2015

The original implementation of a Windows signaler socket used port 5905 instead of letting the OS choose a free port. This also required a global mutex to be locked to prevent simultaneously running zeromq programs from clashing.

Unfortunately the mutex was implemented with an Event instead of a Mutex. Changing it to a Mutex would break compatibility with existing programs unless the port was also changed.

The hardcoded value of 5905 in signaler.cpp is just to check what port was configured in config.hpp. If 5905 it uses back the old Event implementation else it uses a Mutex.

If 0, it lets the OS choose a free port without requiring use of a global mutex. (This is the best solution imho)

You could submit a PR to change the default value in config.hpp to 0.

mattbolgercsiro added a commit to csiro-workspace/libzmq that referenced this issue Aug 21, 2015
…er than crashing if 5905 is in use (zeromq#1542)

-Added config.hpp to the source list so it shows up in generated projects
-Remove CMAKE_BUILD_TYPE setting for generators that don't use it
@hitstergtd
Copy link
Member

Close issue as PR was accepted and merged.

aburgm pushed a commit to aburgm/zeromq4-1 that referenced this issue Jun 4, 2016
…er than crashing if 5905 is in use (zeromq/libzmq#1542)

-Added config.hpp to the source list so it shows up in generated projects
-Remove CMAKE_BUILD_TYPE setting for generators that don't use it
@caidongyun
Copy link

Client.exe (2492), 5905, 30487, TCP, Established
Client.exe (2492), 5905, 30490, TCP, Established
Client.exe (2492), 5905, 30492, TCP, Established
Client.exe (2492), 5905, 30493, TCP, Established
Client.exe (2492), 5905, 30494, TCP, Established
Client.exe (2492), 5905, 30500, TCP, Established
Client.exe (2492), 5905, 30586, TCP, Established
Client.exe (2492), 5905, 30596, TCP, Established

Too many connections 5905

I asked this question, is there a problem with my usage? Or this mechanism to establish a local connection will lead to this problem

@bluca
Copy link
Member

bluca commented Mar 13, 2018

This was fixed a good while ago, which version are you using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants