[zeromq-dev] Assertion during zmq_recv in 3.x

Stuart Brandt stu at compuserve.com
Tue Jul 31 17:48:14 CEST 2012


Done. LIBZMQ-406

Thanks for confirmation.  Let me know if there's any additional context 
needed.

- Stuart

On 7/31/2012 6:04 AM, Martin Hurton wrote:
> Hi Stuart, could you please file an issue for this?
>
> - Martin
>
> On Fri, Jul 27, 2012 at 9:23 PM, Stuart Brandt <stu at compuserve.com> wrote:
>> I get an assertion during a call to zmq_recv on 2 different OSes (OSX
>> 10.7.4 and CentOS 5.8) under two different builds of 3.x (v3.2.0-rc1 and
>> a recent build off latest at github.com/zeromq/libzmq).
>>
>> The assertion is:
>> Assertion failed: (msg_->flags () & msg_t::identity) == 0 (router.cpp:220)
>> Aborted
>>
>> The setup involves:
>> 1) the simple message queue broker found at
>> https://github.com/imatix/zguide/blob/master/examples/C/msgqueue.c
>> I modified the #include to look for zmq.h rather than zhelpers.h to get
>> it to compile with ZMQ 3.x
>>
>> 2) a minimal server implementation that connects to the broker and does
>> a zmq_recv. Code is:
>> //
>> //  Demo of assertion in ZMQ 3.x by REP socket connecting to ROUTER socket
>> //  Connects to tcp://localhost:5560
>> //
>> #include <stdio.h>
>> #include <zmq.h>
>>
>> int main (void)
>> {
>>       char buf[80];   // buffer for zmq_recv call
>>       int len;        // len returned by zmq_recv
>>       void *ctx;      // ZMQ context
>>       void *sock;     // ZMQ socket
>>
>>       // init ZMQ context, create a REP socket, and connect to ROUTER
>>       ctx = zmq_ctx_new();
>>       sock = zmq_socket(ctx,ZMQ_REP);
>>       zmq_connect (sock, "tcp://localhost:5560");
>>
>>       // do a basic zmq_recv call...warn if it fails
>>       len = zmq_recv(sock,buf,sizeof(buf),0);
>>       if (len < 0) {
>>           printf("zmq_recv failed - %s\n",zmq_strerror(errno));
>>       }
>>
>>       // Done. Clean up and end
>>       zmq_close (sock);
>>       zmq_term (ctx);
>>       return 0;
>> }
>>
>>
>> Steps to repro are start server, start broker, kill broker (spec.
>> ctrl-C), restart broker. Server aborts with the above assertion.
>>
>> Is there something my code should be doing differently?
>>
>> Thanks....Stuart
>>
>>
>>
>> _______________________________________________
>> 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