[zeromq-dev] Assertion failed: !(msg_->flags () & msg_t::more)(session_base.cpp:157)

RohanB rohanb at cs.uchicago.edu
Mon Sep 24 20:47:00 CEST 2012


Ian Barber <ian.barber <at> gmail.com> writes:

> 
> On Mon, Sep 24, 2012 at 3:07 PM, RohanB <rohanb <at> cs.uchicago.edu> wrote:
> > the entire thing
> > happens before any package exchange takes place. What I mean is there is no
> > publisher running when I bring up the subscriber on the failing box. Even 
then
> > its aborts with the assertion. You see what I mean?
> 
> Ah, that's interesting. Could you post up a code sample of a
> stand-along subscriber that works on one box and not the other?
> 
> > I am pretty certain I need some configuration on the failing box that the 
other
> > box has and I just can't figure out what. Could you give me some info on the
> > earlier issue you mentioned and what the assert means?
> 
> It's just attempting to pick the identity out of the message iirc,
> which potentially means ZMQ is receiving message data when it
> shouldn't be - certainly if no one has actually started sending!
> 
> Ian
> 


ahh.. I see what you mean. Here's the snippet.... Pretty straightforward... 

Same code works on 1 box and not the other..... Both boxes are enabled to 
receive data on that multicast address and there is no other publisher currently 
running.

int main (int argc, char* argv[])
{
    if (argc < 2)
    {
        std::cout << "\nUsage: pgm_sub [topic_name]\n(for wildcard: pgm_sub 
all)\n" << std::endl;;
        return 0;
    }

    zmq::context_t context (1);
    zmq::socket_t subscriber(context, ZMQ_SUB);

    subscriber.connect("epgm://10.34.253.16;239.196.1.1:16000");

    const char* topic = strcmp(argv[1], "all") == 0 ? "\x00" : argv[1];
    subscriber.setsockopt(ZMQ_SUBSCRIBE, topic, strlen(topic));

    int rate = 10000;
    subscriber.setsockopt(ZMQ_RATE, &rate, sizeof(rate));

    while (1)
    {
        zmq::message_t update;
        subscriber.recv(&update);

        char* msg_buffer = reinterpret_cast<char*>(update.data());
        std::string topic_name(msg_buffer);

        books::Price priceUpdate;
        priceUpdate.ParseFromArray(msg_buffer+28,450);
        print_price(priceUpdate);
    }

    return 0;
}





More information about the zeromq-dev mailing list