[zeromq-dev] Bad File Descriptor / nbytes != -1 error (mailbox.cpp:241)
Dhammika Pathirana
dhammika at gmail.com
Wed Feb 16 07:09:39 CET 2011
Hi Andrew,
On Mon, Feb 14, 2011 at 6:29 PM, Andrew Cholakian <andrew at andrewvc.com> wrote:
> It looks like what's happening is the following sequence inside of ZeroMQ
> 1. zmq tries to recvfrom FD 22, on FD in an internal zmq socketpair, and
> gets some data.
> 2. Periodic attempts after that (always in groups of 3 recvfroms) all return
> eagain.
> 3. ZMQ calls shutdown on FD 22.
> 4. ZMQ calls close on FD 22
> 5. ZMQ starts shutting down ALL socket pairs, starting with the lowest
> numbers.
> 6. ZMQ tries to recvfrom FD 22, even though it's already been closed, and
> gets an EBADF
Is this in master branch?
It's binding following ports,
[pid 11284] bind(24, {sa_family=AF_INET, sin_port=htons(8080),
sin_addr=inet_addr("0.0.0.0")}, 16) = 0
[pid 11284] bind(33, {sa_family=AF_INET, sin_port=htons(2205),
sin_addr=inet_addr("127.0.0.1")}, 16) = 0
[pid 11284] bind(36, {sa_family=AF_INET, sin_port=htons(2201),
sin_addr=inet_addr("127.0.0.1")}, 16) = 0
[pid 11284] bind(39, {sa_family=AF_INET, sin_port=htons(2204),
sin_addr=inet_addr("127.0.0.1")}, 16) = 0
[pid 11284] bind(40, {sa_family=AF_INET, sin_port=htons(2206),
sin_addr=inet_addr("127.0.0.1")}, 16) = 0
But there are repeated attempts to connect to port #2200
[pid 11292] connect(48, {sa_family=AF_INET, sin_port=htons(2200),
sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now
in progress)
[pid 11292] connect(48, {sa_family=AF_INET, sin_port=htons(2200),
sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now
in progress)
[pid 11292] connect(48, {sa_family=AF_INET, sin_port=htons(2200),
sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now
in progress)
[pid 11292] connect(48, {sa_family=AF_INET, sin_port=htons(2200),
sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now
in progress)
[pid 11292] connect(48, {sa_family=AF_INET, sin_port=htons(2200),
sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now
in progress)
> 7. ZMQ then calls fcntl(22, F_GETFL) on FD 22, then calls close(22), then
> prints out the "Bad File Descriptor" error followed by "nbytes != -1
> mailbox.cpp:241" error.
>
> This looks like a threading error, like something's signaling ZMQ to shut
> down, but it does so uncleanly. Any ideas? That strace is available here,
> the last few lines are the most important.
> http://dl.dropbox.com/u/7376989/weirdzmqstrace.txt
BTW, why does it fork xterm?
[pid 11284] clone(Process 11288 attached
child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0x7f22dd45a9f0) = 11288
[pid 11284] close(7) = 0
[pid 11284] read(6, <unfinished ...>
[pid 11288] close(6) = 0
[pid 11288] dup2(7, 1) = 1
[pid 11288] execve("/bin/sh", ["sh", "-c", "tput cols 2>&1"], [/* 55
vars */]) = 0
Dhammika
More information about the zeromq-dev
mailing list