[zeromq-dev] [zeromq/2.0 - beginner's question] why do I get a seg fault?

Matias GUIJARRO matias.guijarro at esrf.fr
Tue Nov 17 08:06:12 CET 2009

Hi again,

Martin Sustrik wrote:
>> I am starting to evaluate zeromq, and I found interesting to test the 
>> 2.0 version
>> (even if it is still in alpha state ?). From the web page, it seems 
>> the 2.0 version
>> is much better than the actual stable release.
> It solves couple of problems and inconveniences we've encountered with 
> version 1.0; also the interface is more familiar as it is based on 
> POSIX sockets, however, the code is still alpha, i.e. it haven't been 
> massively tested etc.
I discovered ZeroMQ while looking at a lightweight AMQP implementation ;
how version 2.0 relates to AMQP ? Is it still AMQP, or did you decide to
move away from it ?

(I am new to messaging systems, sorry if my questions look weird - by the
way, what do you think of something like Spread for example ? I plan to
test this as well)

>> I wanted to write a dummy client and a dummy server, just 
>> peer-to-peer. I am
>> programing on a Linux box. I would like to get your inputs on how to 
>> improve the
>> following code and I would like to know why I manage to get seg faults :
> [...]
> Ok, reproduced. It's a bug. I'll have a look at it tomorrow.
Thanks a lot for fixing this ! :-) Please let me know when you will have
sorted it out...

>> Another thing : currently the receiver program is killing my CPU because
>> of the while loop. I wanted to use polling instead (with the right 
>> context
>> initialization with the ZMQ_POLL flag and the appropriate call to 
>> zmq_poll),
>> but I couldn't because "zmq_pollitem_t" is undefined in zmq.h...
> Hm, looking at zmq.h:
> typedef struct
> {
>     void *socket;
>     int fd;
>     short events;
>     short revents;
> } zmq_pollitem_t;
> Any idea why it's undefined on your box? What's the actual error message?
I confirm that I don't have zmq_pollitem_t in my zmq.h file ; I just 
the tarball from zeromq.org, on the 0MQ/2.0 section. Maybe I should get the
very latest source from github ?


More information about the zeromq-dev mailing list