[zeromq-dev] Signaler.cpp hangs on windows intermittently

Martin Robinson martin.robinson at dai.co.uk
Fri May 10 10:55:04 CEST 2013


My ZMQ applications (patched to use ephemeral ports) work just fine on XP and Windows 7 with the Windows Firewall enabled. We did not need to change any firewall settings to allows these loopback connections. It also works fine on top of the Cisco VPN client software, which includes its own firewall.  So it would appear that these firewall problems may only have effected certain 3rd-party firewall products (Zone Alarm perhaps and such like) which earlier versions of windows may have required. Doesn't seem like a real problem now, given that all current versions of Windows include a firewall built in which works fine with ZMQ and ephemeral ports.

Michal Sznajder's problem with ZMQ grabbing random ports that he was trying to bind to seems more like an application design issue rather than a problem with ZMQ itself - he should not assume that port numbers in the ephemeral range will be free! There are various registry settings on Windows that can control the port range used for ephemeral ports (details vary between versions: XP is different from win 7) - so Michal could use this to avoid the conflict he was seeing.

Of course - ZMQ could be rewritten to use Named Pipes instead of sockets for these connections on Windows, but that's quite a big change!

Martin R

-----Original Message-----
From: zeromq-dev-bounces at lists.zeromq.org [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Martin Sustrik
Sent: 09 May 2013 16:06
To: zeromq-dev at lists.zeromq.org
Subject: Re: [zeromq-dev] Signaler.cpp hangs on windows intermittently

IIRC the problem was that some users had problems with firewalls blocking TCP connections on top of loopback interface. Fixed port number allows you to configure the firewall as to allow this kind of "internal" 
connections.

Martin

On 2013-05-09 16:08, KIU Shueng Chuan wrote:
> Browsing through the code history, ephemeral ports were originally 
> used before switching over to fixed port 5905.
> 
> Does anyone know the reason for the change to fixed port?
> 
> We might want to find out why before making any changes.
> On 9 May, 2013 9:55 PM, "Pieter Hintjens" <ph at imatix.com> wrote:
> 
>> Martin,
>> 
>> I think evreryone liked the idea of ephemeral ports, but it needs 
>> someone who can reproduce the problem to make the change and pull 
>> request. Any volunteers?
>> 
>> -Pieter
>> 
>> On Thu, May 9, 2013 at 4:52 AM, Martin Robinson 
>> <martin.robinson at dai.co.uk> wrote:
>>> Pieter,
>>> 
>>> If making changes to this area of signaller.cpp, you might also 
>>> review
>> the change I suggested back on 22nd March to make this use ephemeral 
>> ports instead of a fixed port number.  Seems to solve the problem 
>> completely of the connect failing on XP in signaler_t::make_fdpair.
>>> 
>>> Martin
>>> 
>>> -----Original Message-----
>>> From: zeromq-dev-bounces at lists.zeromq.org [mailto:
>> zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Pieter Hintjens
>>> Sent: 06 May 2013 20:55
>>> To: ZeroMQ development list
>>> Subject: Re: [zeromq-dev] Signaler.cpp hangs on windows 
>>> intermittently
>>> 
>>> Has this been fixed on master but not backported to 3.x?
>>> 
>>> Usually it's up to individual contributors to either do the backport 
>>> (a
>> git cherrypick) or ask someone to help do it.
>>> 
>>> I'm happy to backport the fix for the next 3.2.4 release if someone
>> tells me what commit it was.
>>> 
>>> -Pieter
>>> 
>>> On Mon, May 6, 2013 at 8:32 PM, Felipe Farinon <
>> felipe.farinon at powersyslab.com> wrote:
>>>> Why wasn't this patch released yet?
>>>> 
>>>> In my application i'm trying to fix it by using Mutex considering 
>>>> the case that waiting (WaitForSingleObject) on the mutex results in 
>>>> WAIT_ABANDONED. It seems that it has been fixed. Should I submit a
>> patch?
>>>> 
>>>> Em 19/03/2013 16:45, Pau escreveu:
>>>>> Hi,
>>>>> 
>>>>> I had this problem some weeks ago. This was my problem:
>>>>> 
>>>>> 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.
>>>>> 
>>>>> Perhaps there are other reasons (actually this problem does not 
>>>>> happen like that in W7) anyway whatever crashes between
>>>>> 
>>>>> HANDLE sync = CreateEvent (NULL, FALSE, TRUE, TEXT 
>>>>> ("zmq-signaler-port-sync")); and SetEvent (sync);
>>>>> 
>>>>> will leave the event signaled and any other application in the 
>>>>> system will hang. Closing all apps in a system fixes it.
>>>>> 
>>>>> KIU Shueng Chuan submitted a patch that sets the event when crash 
>>>>> avoiding other applications to ge hanged:
>>>>> 
>>>>> https://github.com/zeromq/libzmq/pull/514
>>>>> 
>>>>> That worked for me...
>>>>> 
>>>>> If you search for "zmq-signaler-port-sync" in previous mails in 
>>>>> this list you will see the complete thread.
>>>>> 
>>>>> best,
>>>>> 
>>>>> Pau
>>>>> 
>>>>> El 19/03/2013 17:18, Felipe Farinon escribió:
>>>>>> Hi,
>>>>>> 
>>>>>> The code
>>>>>> HANDLE sync = CreateEvent (&sa, FALSE, TRUE, TEXT 
>>>>>> ("Global\\zmq-signaler-port-sync"));
>>>>>> 
>>>>>> in signaler.cpp:262 hangs intermittently when starting zeromq 
>>>>>> context through zmq_init in my application. I'm not able to 
>>>>>> reproduce this bug with a minimal test case. I'm running my 
>>>>>> application in a Windows 7 with zeromq compiled with VS2010.
>>>>>> _______________________________________________
>>>>>> zeromq-dev mailing list
>>>>>> zeromq-dev at lists.zeromq.org
>>>>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>>>>> 
>>>>> _______________________________________________
>>>>> zeromq-dev mailing list
>>>>> zeromq-dev at lists.zeromq.org
>>>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>>>> 
>>>> 
>>>> _______________________________________________
>>>> zeromq-dev mailing list
>>>> zeromq-dev at lists.zeromq.org
>>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>> _______________________________________________
>>> zeromq-dev mailing list
>>> zeromq-dev at lists.zeromq.org
>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>> _______________________________________________
>>> zeromq-dev mailing list
>>> zeromq-dev at lists.zeromq.org
>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>> 
> 
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


More information about the zeromq-dev mailing list