[zeromq-dev] Assertion failed: Address already in use
Pieter Hintjens
ph at imatix.com
Wed Jun 4 11:09:32 CEST 2014
It may well be a Windows issue.
You're right that the exception should not be escaping. It's also a
strange error to get in the tcp_connector... Could you test again with
the current master, and perhaps we can dig in to see what's happening.
-Pieter
On Wed, Jun 4, 2014 at 7:33 AM, Matthias Kluwe <mkluwe at gmail.com> wrote:
> Obviously it is. I won't really do this in real code.
>
> I just was surprised by the uncaught exception escaping from the library.
>
> Perhaps this is a Windows specific issue. The test code runs for hours on my
> Ubuntu box.
>
> Am 03.06.2014 22:43 schrieb "Pieter Hintjens" <ph at imatix.com>:
>
>> It's poor design to bind on the same port over and over like this.
>> There are timing dependent tear-downs that will hit. E.g. as long as
>> there's a pending connection, the bound address won't be free for new
>> binds.
>>
>>
>> On Tue, Jun 3, 2014 at 10:40 PM, Matthias Kluwe <mkluwe at gmail.com> wrote:
>> > Hi!
>> >
>> > I'm experiencing an unexpected error when using and tearing down a ZMQ
>> > context in a rapid sequence. I tried this with Windows XP using ZeroMQ
>> > 4.04.
>> >
>> > Test code is as follows (using a "fresh" REQ-REP connection once in a
>> > loop):
>> >
>> > #include "zmq.h"
>> > #include <string.h>
>> >
>> > int c_send_receive() {
>> > char buf[ 4 ];
>> >
>> > void *ctx = zmq_ctx_new();
>> > if ( ctx == 0 ) return 0;
>> >
>> > void *rep = zmq_socket( ctx, ZMQ_REP );
>> > if ( rep == 0 ) return 0;
>> > if ( zmq_bind( rep, "tcp://*:5555" ) == -1 ) return 0;
>> >
>> > void *req = zmq_socket( ctx, ZMQ_REQ );
>> > if ( req == 0 ) return 0;
>> > if ( zmq_connect( req, "tcp://localhost:5555" ) == -1 )
>> > return 1;
>> >
>> > if ( zmq_send( req, "MSG", 3, 0 ) == -1 ) return 0;
>> > memset( buf, 0, 4 );
>> > if ( zmq_recv( rep, buf, 3, 0 ) == -1 ) return 0;
>> > if ( strcmp( "MSG", buf ) != 0 ) return 0;
>> >
>> > if ( zmq_close( rep ) == -1 ) return 0;
>> > if ( zmq_close( req ) == -1 ) return 0;
>> > if ( zmq_ctx_term( ctx ) == -1 ) return 0;
>> >
>> > return 1;
>> > }
>> >
>> > int main() {
>> > while ( c_send_receive() );
>> > }
>> >
>> > The code above tries to check for all error code (hopefully), but it
>> > fails throwing the following exception:
>> >
>> > Assertion failed: Address already in use
>> > (..\..\..\src\tcp_connecter.cpp:284)
>> >
>> > I guess this is due to ZeroMQ encountering some unexpected condition.
>> >
>> > Regards,
>> > Matthias
>> > _______________________________________________
>> > zeromq-dev mailing list
>> > zeromq-dev at lists.zeromq.org
>> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
> _______________________________________________
> 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