[zeromq-dev] zeromq 3.x and pgm

Ben Gray ben at benjamg.com
Wed Sep 28 12:35:12 CEST 2011


Is there some trick to getting pgm working?

I built with --with-pgm and connecting to the endpoints works as expected
however it appears to be trying to process publisher side subscriptions and
then asserting if I actually try and send messages.

My current test case is:

#include <cstring>
#include <string>

#include <zmq.h>

typedef void* context_t;
typedef void* socket_t;

int main(int argc, char* const argv[])
{
        std::string endpoint("pgm://eth0;239.1.1.1:5555");
        std::string payload("hello world");

        context_t context = zmq_init(1);

        socket_t publisher = zmq_socket(context, ZMQ_PUB);
        zmq_connect(publisher, endpoint.c_str());

        socket_t subscriber = zmq_socket(context, ZMQ_SUB);
        zmq_connect(subscriber, endpoint.c_str());

        sleep(1);

        zmq_send(publisher, payload.data(), payload.size(), 0);

        zmq_close(publisher);
        zmq_close(subscriber);
        zmq_term(context);

        return EXIT_SUCCESS;
}

Which gives an "Assertion failed: size > 0 && (*data == 0 || *data == 1)
(xpub.cpp:65)" message

(gdb) bt
#0  0x00007ffff725ed05 in raise (sig=6) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007ffff7262ab6 in abort () at abort.c:92
#2  0x00007ffff7b4e4ed in zmq::xpub_t::xread_activated (this=0x606760,
pipe_=0x60c260) at xpub.cpp:65
#3  0x00007ffff7b4a65a in zmq::socket_base_t::read_activated (this=0x606760,
pipe_=0x60c260) at socket_base.cpp:913
#4  0x00007ffff7b3a3bc in zmq::pipe_t::process_activate_read (this=0x60c260)
at pipe.cpp:207
#5  0x00007ffff7b30255 in zmq::object_t::process_command (this=0x60c260,
cmd_=...) at object.cpp:63
#6  0x00007ffff7b4a214 in zmq::socket_base_t::process_commands
(this=0x606760, timeout_=0, throttle_=true) at socket_base.cpp:777
#7  0x00007ffff7b49647 in zmq::socket_base_t::send (this=0x606760,
msg_=0x7fffffffe590, flags_=0) at socket_base.cpp:510
#8  0x00007ffff7b53422 in zmq_sendmsg (s_=0x606760, msg_=0x7fffffffe590,
flags_=0) at zmq.cpp:266
#9  0x00007ffff7b53132 in zmq_send (s_=0x606760, buf_=0x603068, len_=11,
flags_=0) at zmq.cpp:219
#10 0x0000000000400cbe in main ()

The code appears to be checking to see if subscription requests are valid
and in this case size is actually 0;

(gdb) p size
$1 = 0
(gdb) p sub
$2 = {u = {base = {unused =
"\300\260\366\365\377\177\000\000\340\200`\000\000\000\000\000\060\260\366\365\377\177\000\000\200o\264\367\377",
type = 101 'e',
      flags = 0 '\000'}, vsm = {data =
"\300\260\366\365\377\177\000\000\340\200`\000\000\000\000\000\060\260\366\365\377\177\000\000\200o\264\367\377",
size = 0 '\000',
      type = 101 'e', flags = 0 '\000'}, lmsg = {content = 0x7ffff5f6b0c0,
unused =
"\340\200`\000\000\000\000\000\060\260\366\365\377\177\000\000\200o\264\367\377",

      type = 101 'e', flags = 0 '\000'}, delimiter = {
      unused =
"\300\260\366\365\377\177\000\000\340\200`\000\000\000\000\000\060\260\366\365\377\177\000\000\200o\264\367\377",
type = 101 'e', flags = 0 '\000'}}}

I assume I've forgotten to set something up as I was under the impression
using pgm endpoints disabled publisher side filtering because it multicasts.
If anyone can give me a pointer that would be most helpful.

Regards,
Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110928/db7b88da/attachment.htm>


More information about the zeromq-dev mailing list