[zeromq-dev] [routing branch] Re: tcp_socket assertion after client disconnects

Martin Sustrik sustrik at fastmq.com
Mon Jun 15 09:02:52 CEST 2009


Hi Ferenc,

Jon is right. The routing branch is experimental, thus it misses some 
fixes that were done to the trunk. Sorry about that.

Martin

Jon Dyte wrote:
> On Friday 12 Jun 2009, Ferenc Szalai wrote:
> 
>  > Hi
> 
>  >
> 
>  > I just started to play with routing branch. I used the application (zrr,
> 
>  > zprr) attached to the following mail:
> 
>  >
> 
>  > http://lists.zeromq.org/pipermail/zeromq-dev/2009-May/000775.html
> 
>  >
> 
>  > The server creates this assertion after one client disconnects:
> 
>  >
> 
>  > zrr: tcp_socket.cpp:349: void zmq::tcp_socket_t::blocking_read(void*,
> 
>  > int): Assertion `n >= 0' failed.
> 
>  > Aborted
> 
>  >
> 
>  > I added the 'always true' error handler to the code:
> 
>  >
> 
>  > bool error_handler(const char *s)
> 
>  > {
> 
>  > return true;
> 
>  > }
> 
>  >
> 
>  > int main(..)
> 
>  > set_error_handler(error_handler)
> 
>  > [...]
> 
>  >
> 
>  > but I got the same assertion.
> 
>  >
> 
>  > What does this assertion means and how can I keep my server alive after
> 
>  > one client disconnects?
> 
>  >
> 
>  > --
> 
>  > Regards
> 
>  > Ferenc
> 
>  > _______________________________________________
> 
>  > zeromq-dev mailing list
> 
>  > zeromq-dev at lists.zeromq.org
> 
>  > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> 
>  >
> 
> Currently the routing branch doesnt handle this, as you see it just asserts.
> 
> void zmq::tcp_socket_t::blocking_read (void *data, int size)
> 
> {
> 
> while (size > 0) {
> 
> int n = read (data, size);
> 
> assert (n >= 0);
> 
> size -= n;
> 
> data = (void*) (((unsigned char*) data) + n);
> 
> }
> 
> }
> 
> It looks like the main zmq branch has code to handle disconnection now, 
> so it looks like a merge is in order.
> 
> Jon
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev




More information about the zeromq-dev mailing list