Several assertion failures relating to large numbers of sockets being created


I have put up a client and server that demonstrate a number of assertion failures at the following gist. They are written in Ruby, tested on 1.9.2 with the latest FFI on a standard Ubuntu 10.10 box with versions of ZMQ referenced below.

The client basically runs requests as fast as it can, creating sockets for each request beyond the first and closing them (this replicates how we managed to create this in the wild, and may or may not be important). Tweaking some settings can demonstrate different assertions against different versions of zeromq. The scripts allow one to tweak the socket and a sleep parameter; see below for what this changes. The scripts could also be clearer but I have been at this one for 3 days and the sooner I leave it behind, the better.

With IPC, and no delay, against HEAD and 2.1, the server fails with:
Assertion failed: inpipes [current_in].active (xrep.cpp:229)

With IPC, and a 10ms delay, against HEAD and 2.1, the client fails with:
Bad file descriptor
rc != -1 (epoll.cpp:68)

With TCP, and no delay, against HEAD, the client fails with:
Assertion failed: new_sndbuf > old_sndbuf (mailbox.cpp:182)

With TCP, and no delay, against 2.1, the server fails with:
Assertion failed: msg_->flags & ZMQ_MSG_MORE (rep.cpp:80)

While I imagine that our internal solution to this is going to be "don't make so many freaking sockets" I thought it would be nice to demonstrate them, especially as the assertion often happens on the server end, which makes debugging so especially interesting, and some of these assertions don't have any meaningful google hits. So, future googlers: don't use so many sockets.