[zeromq-dev] ZMQ Crash from unknown DNS name

Martin Sustrik sustrik at 250bpm.com
Thu Jan 27 08:42:16 CET 2011


Hi David,

> I had similar problems.  I get an assertion on an i/o thread anytime I
> called connect() to a malformed or unresolvable address, and bind() to
> an unknown or malformed interface.
>
> My quick fix was to check the address and interface in
> socket_base::bind() and socket_base::connect().  Obviously for connect()
> this will put the delays to do name resolution in the application thread
> instead of the i/o thread.  Also, since I don't keep the resolved name,
> the name gets looked-up a second time in the i/o thread.  For my
> application both of these are acceptable.
>
> I've pasted my change below in case you want to do something similar.

The real solution IMO would be to introduce a new "address" structure 
that would contain the address as such, with no elements to resolve.

zmq_connect() call would translate the connection string to the 
"address" and pass it to the I/O thread.

I/O thread would then use the "address" to connect (no name resolving 
needed).

Anyone fancy implementing this?
Martin



More information about the zeromq-dev mailing list