Hi Nir, Great catch! Tha patch is now in the trunk. I've tested on a 8 core box and tcp_shutdown doesn't seem to fail anymore.ipc_shutdown still fails occassionally. Given that both ipc and tcp share the same code (nn_*stream classes) I would say the problem has to do with the fact that ipc connections are often established immediately (connect returns 0), while tcp connection [almost?] never are.
Martin On 11/03/13 06:24, Nir Soffer wrote:
When nn_astream_init fails, bstream was adding an invalid object to the astreams list. This leads to "impossible" failures later. This patch add the astream to the bstream->astreams list inside nn_astream_init, before calling nn_stream_init. If nn_stream_init fails when the astream is included in the astreams list, it is removed properly. This change fixes the random crashes in the tcp_shutdown test. The test runs now 200 time in a loop without an error. License: MIT