Assertion failed: Bad address (tcp_socket.cpp:229)

Description

Running a ZMQ_PUB server instance which crashes shortly after a 2nd ZMQ_SUBSCRIBE client connects.
Crash is triggered when the client calls zmq_recv();

This seems to be occurring in zmq_engine.cpp in zmq::zmq_engine_t::in_event() and I'm speculating that decoder.get_buffer() is somehow returning the wrong buffer, maybe for the wrong IO thread.

This seems to work perfectly well when only one client is connected but fails repeatably on the AVR32 linux target.
Unfortunatly the same code works flawlessly on my x86 PC linux box.

Environment

AVR32 Linux, SuSE Linux Enterprise Server 11 SP1 x86_64

Attachments

1
  • 20 Jul 2012, 12:56 AM

Activity

Show:

Mika Fischer October 26, 2012 at 8:13 AM

For us, this bug is very very hard to reproduce. It only happened once ever.

However I think your commits should fix the issue. Thanks a lot!

Martin Hurton October 25, 2012 at 5:04 PM

Jeremy, could you try to reproduce this with the latest version of libzmq?

Mika Fischer September 11, 2012 at 12:02 PM

We also get this assertion with errno = ENETUNREACH.

To be honest, I think it is very bad practice for a library to try to build a whitelist of error conditions, which won't kill my application instantly.

Instead, only the error conditions that make continuing completely impossible or indicate an internal error in ZMQ should lead to an assertion, everything else should be handled as gracefully as possible.

From just a short glace at /usr/include/asm-generic/errno.h at least the following return values would currently crash an application using ZMQ for no good reason:
ENETDOWN, ENETUNREACH, ENETREST, ECONNABORTED, EHOSTDOWN and probably others.

Same thing applies to tcp_socket_t::write, which asserts on even more errno values and also to stream_engine_t in ZeroMQ 3...

Martin Hurton July 31, 2012 at 10:18 AM

Jeremy, could you find out what the errno value is when the assertion fails?

Jeremy Bowen July 20, 2012 at 12:56 AM

This is the ZMQ_PUB server instance that demonstrates the assertion failure.

Details

Assignee

Reporter

Labels

Components

Affects versions

Priority

Created July 19, 2012 at 11:55 PM
Updated October 26, 2012 at 8:13 AM