[zeromq-dev] segfault in python during poll() (but it's my fault)

Peter Friend pfriend at gehrytech.com
Thu Nov 22 04:15:29 CET 2012


That seems to have fixed it. With my old broken code the REQ socket never sees the message instead of dumping core, which I assume is the desired behavior. No exception is thrown.

Thanks!

Peter

-----Original Message-----
From: zeromq-dev-bounces at lists.zeromq.org [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Martin Hurton
Sent: Wednesday, November 21, 2012 2:55 PM
To: 0MQ development list
Subject: Re: [zeromq-dev] segfault in python during poll() (but it's my fault)

The master contains patch that should fix the crash. Can you please
test and report back? Thanks! - Martin

On Wed, Nov 21, 2012 at 9:33 PM, Martin Hurton <hurtonm at gmail.com> wrote:
> Hi Peter, could you please create an issue for this and attach a
> simple example, best in C,  to reproduce this segfault? Thanks!
>
> - Martin
>
> On Wed, Nov 21, 2012 at 4:49 PM, Martin Hurton <hurtonm at gmail.com> wrote:
>> Thanks for report, I will check it.
>>
>> On Nov 20, 2012 3:18 AM, "Peter Friend" <pfriend at gehrytech.com> wrote:
>>>
>>> I have a client REQ talking to a ROUTER. I am translating some prototype
>>> code from python to Java so the ROUTER is in Java and the REQ client is
>>> python. I was rather perplexed when I got a segfault during poll():
>>>
>>>
>>>
>>> socks = dict(polldev.poll(10 * 1000))
>>>
>>>
>>>
>>> from strace:
>>>
>>> write(6, "\1\0\0\0\0\0\0\0", 8)         = 8
>>>
>>> write(8, "\1\0\0\0\0\0\0\0", 8)         = 8
>>>
>>> poll([{fd=8, events=POLLIN}], 1, 0)     = 1 ([{fd=8, revents=POLLIN}])
>>>
>>> read(8, "\1\0\0\0\0\0\0\0", 8)          = 8
>>>
>>> poll([{fd=8, events=POLLIN}], 1, 0)     = 0 (Timeout)
>>>
>>> write(6, "\1\0\0\0\0\0\0\0", 8)         = 8
>>>
>>> fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
>>>
>>> mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
>>> 0x7fc8abbed000
>>>
>>> write(1, "sending 1\n", 10sending 1
>>>
>>> )             = 10
>>>
>>> poll([{fd=8, events=POLLIN}], 1, 0)     = 1 ([{fd=8, revents=POLLIN}])
>>>
>>> poll([{fd=8, events=POLLIN}], 1, 0)     = 1 ([{fd=8, revents=POLLIN}])
>>>
>>> read(8, "\1\0\0\0\0\0\0\0", 8)          = 8
>>>
>>> poll([{fd=8, events=POLLIN}], 1, 0)     = 0 (Timeout)
>>>
>>> poll([{fd=8, events=POLLIN}], 1, 10000 <unfinished ...>
>>>
>>> +++ killed by SIGSEGV (core dumped) +++
>>>
>>>
>>>
>>> This ended up being caused by the fact that I forgot to put in the empty
>>> frame for the reply to the REQ. Once I did that everything worked, but I
>>> wouldn't expect this to cause a segfault. I am working on a Java REQ client
>>> as well to verify whether it's a core library issue. I am using my own build
>>> of libzmq from the master branch I built today.
>>>
>>>
>>>
>>> Thanks,
>>>
>>>
>>>
>>> Peter
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> zeromq-dev mailing list
>>> zeromq-dev at lists.zeromq.org
>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>>
>>
_______________________________________________
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