[zeromq-dev] Crash with nbytes != -1 (tcp_socket.cpp:217) on Linux

Martin Sustrik sustrik at 250bpm.com
Fri Nov 26 20:29:08 CET 2010


On 11/26/2010 08:11 PM, Alexey Ermakov wrote:
> Our application sometimes crashes with nbytes != -1
> (tcp_socket.cpp:221) assertion (on Debian and Centos).
> It seems to happen when a VPN connection (set up with racoon) drops
> and reconnects, but, curiously, it doesn't happen each time (mostly
> just once a day or so). We send 0MQ packets over this VPN, so this
> probably happens when the interface disappears in the middle of
> recv(). errno is set to EINVAL when this crash happens, so maybe it
> should be added to the second set of flags (peer crashed)? Or are
> there some issues with it that could cause more trouble?

Currently, 0MQ asserts in case of EINVAL because according to POSIX 
EINVAL seems to indicate a bug in 0MQ rather than an external problem 
such as VPN reconnection:

[EINVAL]
     The MSG_OOB flag is set and no out-of-band data is available.

Rasing EINVAL if all the parameters are OK, just because of 
disconnection seems to be a bug in VPN... it can be solved by allowing 
for EINVAL as a valid error from recv in 0MQ, however, it would be 
preferable to fix the original bug in VPN.

Martin



More information about the zeromq-dev mailing list