[zeromq-dev] epgm example

1,080 views
Skip to first unread message

Roberto Palmer

unread,
Oct 10, 2011, 11:57:33 AM10/10/11
to zerom...@lists.zeromq.org
Hello all,
I have a problem while trying to make a simple example with epgm.
I wrote the following simple C program, but it makes a core dump
with the following error:

Assertion failed: rc == 0 (connect_session.cpp:84).
Aborted (core dumped)

I'm using zmq 2.1.10 with F15.

What I'm missing ?
Thanks for any help.

R.

#include <string.h>
#include <assert.h>

#include <zmq.h>


int
main(int argc, char** argv)
{
void *ctx;
void *s;
zmq_msg_t msg;
int rc;


ctx = zmq_init (1);
assert(ctx);

s = zmq_socket(ctx, ZMQ_PUB);

rc = zmq_connect(s, "epgm://239.192.1.1:5555");
assert (rc == 0);

rc = zmq_msg_init_size (&msg, 4);
assert (rc == 0);

memset(zmq_msg_data (&msg), 'A', 4);

rc = zmq_send(s, &msg, 0);
assert (rc == 0);

zmq_msg_close(&msg);
assert (rc == 0);

sleep(3);
return 0;
}

_______________________________________________
zeromq-dev mailing list
zerom...@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Steven McCoy

unread,
Oct 10, 2011, 12:31:53 PM10/10/11
to ZeroMQ development list
On 10 October 2011 11:57, Roberto Palmer <roberto...@gmail.com> wrote:
Hello all,
I have a problem while trying to make a simple example with epgm.
I wrote the following simple C program, but it makes a core dump
with the following error:

       Assertion failed: rc == 0 (connect_session.cpp:84).
       Aborted (core dumped)

Looks like the infamously vague error handling problems interpreting the network parameter:
 
       rc = zmq_connect(s, "epgm://239.192.1.1:5555");

The network parameter here does not specify the interface and it is likely the system is presenting multiple options and cannot decide between them.  Solution is to explicitly define the interface to use.  You have a choice between hostname, IP address, network address, or network name, for example:

       rc = zmq_connect(s, "epgm://eth0;239.192.1.1:5555");

Would likely fail if you have IPv6 enabled too.

       rc = zmq_connect(s, "epgm://192.168.1.1;239.192.1.1:5555");

More explicit.  To have some abstraction you can use DNS or the NSS naming system for networks.  The NSS subsystem does not support IPv6 and so OpenPGM provides an internal implementation if necessary.

       rc = zmq_connect(s, "epgm://myhostname-eth0;239.192.1.1:5555");
       rc = zmq_connect(s, "epgm://mynetwork;239.192.1.1:5555");

/etc/hosts
  192.168.1.1       myhostname-eth0

/etc/networks:
  mynetwork         192.168.1


Alternative compatibility NSS:

/tmp/mynetworks:
  mynetwork         192.168.1

PGM_NETDB=/tmp/networks ./myØMQapp ...

-- 
Steve-o

Roberto Palmer

unread,
Oct 10, 2011, 7:43:56 PM10/10/11
to zerom...@lists.zeromq.org
Thankyou Steve for your explanation.
BTW using the interface name (em2 on my system)
still doesn't work and the program ends with a
slightly different error:

Segmentation fault (core dumped)

So my only choice is to use the ip address/network address method.

Rgds,
Roberto

Steven McCoy

unread,
Oct 12, 2011, 5:27:55 PM10/12/11
to ZeroMQ development list
On 10 October 2011 19:43, Roberto Palmer <roberto...@gmail.com> wrote:
Thankyou Steve for your explanation.
BTW using the interface name (em2 on my system)
still doesn't work and the program ends with a
slightly different error:

Segmentation fault (core dumped)

So my only choice is to use the ip address/network address method.


To bring the list back in on this conversation, it looks like there are problems with Consistent Device Naming in Fedora 15.  GDB is proving useless though:

Starting program: /home/local/libpgm/trunk/openpgm/pgm/ref/debug-Linux-x86_64/examples/purinrecv -i
[Thread debugging using libthread_db enabled]
プリン プリン
Info: IP Configuration
Info: lo: index=1 flags=65609<UP,LOOPBACK>
Info: inet 127.0.0.1 netmask 255.0.0.0
Info: p2p1: index=2 flags=69699<UP,BROADCAST,MULTICAST>
Info: inet 10.0.2.15 netmask 255.255.255.0
Info: lo: index=1 flags=65609<UP,LOOPBACK>
Info: inet6 ::1 prefixlen 128 scopeid 0x0
Info: p2p1: index=2 flags=69699<UP,BROADCAST,MULTICAST>
Info: inet6 fe80::a00:27ff:fe91:26e2%p2p1 prefixlen 64 scopeid 0x2
[Inferior 1 (process 1556) exited normally]
(gdb) bt
No stack.

Ugh, copy & paste isn't working with VirtualBox either.

-- 
Steve-o

Steven McCoy

unread,
Oct 12, 2011, 5:32:32 PM10/12/11
to ZeroMQ development list
On 12 October 2011 17:27, Steven McCoy <steven...@miru.hk> wrote:
On 10 October 2011 19:43, Roberto Palmer <roberto...@gmail.com> wrote:
Thankyou Steve for your explanation.
BTW using the interface name (em2 on my system)
still doesn't work and the program ends with a
slightly different error:

Segmentation fault (core dumped)

So my only choice is to use the ip address/network address method.


To bring the list back in on this conversation, it looks like there are problems with Consistent Device Naming in Fedora 15.  GDB is proving useless though:

Starting program: /home/local/libpgm/trunk/openpgm/pgm/ref/debug-Linux-x86_64/examples/purinrecv -i
[Thread debugging using libthread_db enabled]
プリン プリン
Info: IP Configuration
Info: lo: index=1 flags=65609<UP,LOOPBACK>
Info: inet 127.0.0.1 netmask 255.0.0.0
Info: p2p1: index=2 flags=69699<UP,BROADCAST,MULTICAST>
Info: inet 10.0.2.15 netmask 255.255.255.0
Info: lo: index=1 flags=65609<UP,LOOPBACK>
Info: inet6 ::1 prefixlen 128 scopeid 0x0
Info: p2p1: index=2 flags=69699<UP,BROADCAST,MULTICAST>
Info: inet6 fe80::a00:27ff:fe91:26e2%p2p1 prefixlen 64 scopeid 0x2

<... insert long delay here ...>
 
[Inferior 1 (process 1556) exited normally]
(gdb) bt
No stack.


A quick break with GDB shows that it's a DNS lookup of the hostname and Fedora 15 hasn't configured /etc/hosts to match the installer specified name.

This implies an OpenPGM bug when the hostname fails though.

-- 
Steve-o
Reply all
Reply to author
Forward
0 new messages