[zeromq-dev] Assertion during zmq_recv in 3.x
Stuart Brandt
stu at compuserve.com
Tue Jul 31 03:01:55 CEST 2012
Just a followup that a similar issue appears to exist with ZMQ_ROUTER
connecting the ZMQ_DEALER. In this case I'm seeing...
Assertion failed: (prefetched_msg.flags () & msg_t::identity) == 0
(router.cpp:274)
Aborted
I repro'd this one with two Queue devices connecting back-to-back -- the
2nd Queue's front-end Router connecting to the back-end Dealer of the
first Queue, then killing and restarting the process with the first
Queue. Is there some sockopt I'm missing that could be contributing to this?
On 7/27/2012 3:23 PM, Stuart Brandt 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
More information about the zeromq-dev
mailing list