crash closing a socket after zmq_msg_send returns EAGAIN

Description

I have a program that sends messages on a ZMQ_DEALER socket with ZMQ_DONTWAIT. If I get back EAGAIN (perhaps because the other end is responding slowly or has gone away) I call zmq_close to close the socket and then re-establish the connection (possibly to a new server) with a new socket. ZMQ_LINGER is set to 0.

I'm occasionally seeing crashes in libzmq that look like:

I've attached a program, zmqtest.c, that reproduces this. Compile it with -lzmq and run it, it should crash after a minute or so (at least it does for me).

Environment

Ubuntu 12.04 LTS, Virtualbox VM (64-bit).

Activity

Show:
AJ Lewis
November 8, 2013, 8:59 PM
Edited

The following also appears to fix it - not sure if this renders the above mentioned patch useless though...

AJ Lewis
November 8, 2013, 10:07 PM
Edited

Hrm...my patch makes the window much harder to hit with Andy's test program, but I still hit it after quite a while (somewhere around 10 minutes). Haven't had a chance to test the reversion of the patch that added in the 'terminating' variable.

AJ Lewis
November 11, 2013, 4:09 PM

Reverting the fix for does allow the test to run indefinitely for me with zeromq 3.2.3. Recommend reverting that fix until a solution that doesn't cause asserts can be found.

AJ Lewis
January 8, 2014, 5:41 PM

The revert of has been committed to zeromq3-x (9e6bdb5b), zeromq4-x (a37c198c) and libzmq (b5d2239a). Marking this resolved.

AJ Lewis
January 8, 2014, 5:42 PM

Note that this will also be fixed in 4.0.4. (4.0.3 and 4.0.4 are not currently options in this system since the bug tracking moved to github)

Fixed

Assignee

Unassigned

Reporter

Andy Tucker

Labels

None

Components

Fix versions

Affects versions

Priority

Major