Some bisecting pointed out the CoreFoundation backend mode. It seems
it gets spurious poll events.
Test case:
int main(int argc, array argv)
{
Pike.DefaultBackend.enable_core_foundation(1);
for (int i = 1; i <= 20; i++) {
object client = Protocols.DNS.async_client ("212.247.28.2");
werror ("Loop: %d\n", i);
client->ip_to_host (sprintf ("212.247.28.%d", i),
lambda (mixed ... args)
{
werror ("%O\n", args);
});
}
return -1;
}
Output with POLL_DEBUG below. It seems fd 12 gets a second READ event
and then it hangs in the read callback because there's nothing to read.
--- cut some stuff ---
[1962238720]BACKEND[0]: Creating wakeup pipe...
[1962238720]BACKEND[0]: Initializing wakeup pipe...
update_fd_set(0x100602d10, 28, 0x00000000, 0x00000001)
[1962238720]BACKEND[0]: pdb_update_fd_set(.., 28, 0, 1, 0):
[1962238720]BACKEND[0]: fd:28 READ, ADD
[1962238720]BACKEND[0]: change_fd_for_box: fd from -1 to 28
[1962238720]BACKEND[0]: Wakeup pipe is [29, 1129270852]
[1962238720]BACKEND[0]: Doing poll on fds:
=> 32 (timeout was: 4)
[1962238720]BACKEND[0]: fd:25166112 filter:-15688 flags:0x0000001d
UNKNOWN(25166144)
[1962238720]BACKEND[0]: fd:32 filter:-4016 flags:0x00005fbf
UNKNOWN[ERROR](1606414128)
[1962238720]BACKEND[0]: fd:13109 filter:4 flags:0x00000000 UNKNOWN(1950392)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(653005601)
[1962238720]BACKEND[0]: fd:6148 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:1 flags:0x00000000 UNKNOWN(1606414224)
[1962238720]BACKEND[0]: fd:1606414544 filter:-14156 flags:0x00000019
UNKNOWN(16849152)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(1606414288)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(3)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:156897360 filter:0 flags:0x00000000
UNKNOWN(1428914176)
[1962238720]BACKEND[0]: fd:-2147483622 filter:26 flags:0x00008000
UNKNOWN[EOF](1)
[1962238720]BACKEND[0]: fd:159 filter:159 flags:0x00000000 UNKNOWN(-2147483648)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:12 filter:-1 flags:0x00000001 EVFILT_READ(204)
[1962238720]BACKEND[0]: POLLRDNORM|POLLIN on 12
[1962238720]BACKEND[0]: hooking in box for fd 12
[1962238720]BACKEND[0]: fd:11 filter:-1 flags:0x00000001 EVFILT_READ(102)
[1962238720]BACKEND[0]: POLLRDNORM|POLLIN on 11
[1962238720]BACKEND[0]: hooking in box for fd 11
[1962238720]BACKEND[0]: fd:10 filter:-1 flags:0x00000001 EVFILT_READ(201)
[1962238720]BACKEND[0]: POLLRDNORM|POLLIN on 10
[1962238720]BACKEND[0]: hooking in box for fd 10
[1962238720]BACKEND[0]: fd:9 filter:-1 flags:0x00000001 EVFILT_READ(201)
[1962238720]BACKEND[0]: POLLRDNORM|POLLIN on 9
[1962238720]BACKEND[0]: hooking in box for fd 9
[1962238720]BACKEND[0]: fd:8 filter:-1 flags:0x00000001 EVFILT_READ(217)
[1962238720]BACKEND[0]: POLLRDNORM|POLLIN on 8
[1962238720]BACKEND[0]: hooking in box for fd 8
[1962238720]BACKEND[0]: Examining box for fd 8 revents:0x0001
[1962238720]BACKEND[0]: read_callback(8, 0x1008d8a80)
({ /* 2 elements */
"212.247.28.1",
"lin-fw-internal.roxen.com"
})
[1962238720]BACKEND[0]: Examining box for fd 9 revents:0x0001
[1962238720]BACKEND[0]: read_callback(9, 0x1008d8c00)
({ /* 2 elements */
"212.247.28.2",
"ns3.roxen.com"
})
[1962238720]BACKEND[0]: Examining box for fd 10 revents:0x0001
[1962238720]BACKEND[0]: read_callback(10, 0x1008d94a0)
({ /* 2 elements */
"212.247.28.3",
"ns4.roxen.com"
})
[1962238720]BACKEND[0]: Examining box for fd 11 revents:0x0001
[1962238720]BACKEND[0]: read_callback(11, 0x1008d9200)
({ /* 2 elements */
"212.247.28.4",
0
})
[1962238720]BACKEND[0]: Examining box for fd 12 revents:0x0001
[1962238720]BACKEND[0]: read_callback(12, 0x1008d8ed0)
({ /* 2 elements */
"212.247.28.5",
"yp.roxen.com"
})
[1962238720]BACKEND[0]: Examining box for fd -1 revents:0x0000
[1962238720]BACKEND[0]: Doing poll on fds:
=> 32 (timeout was: 4)
[1962238720]BACKEND[0]: fd:25166112 filter:-15688 flags:0x0000001d
UNKNOWN(25166144)
[1962238720]BACKEND[0]: fd:32 filter:-4016 flags:0x00005fbf
UNKNOWN[ERROR](1606414128)
[1962238720]BACKEND[0]: fd:13109 filter:4 flags:0x00000000 UNKNOWN(1950392)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(653005601)
[1962238720]BACKEND[0]: fd:6148 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:1 flags:0x00000000 UNKNOWN(1606414224)
[1962238720]BACKEND[0]: fd:1606414544 filter:-14156 flags:0x00000019
UNKNOWN(16849152)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(1606414288)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(3)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:156897360 filter:0 flags:0x00000000
UNKNOWN(1428914176)
[1962238720]BACKEND[0]: fd:-2147483622 filter:26 flags:0x00008000
UNKNOWN[EOF](1)
[1962238720]BACKEND[0]: fd:159 filter:159 flags:0x00000000 UNKNOWN(-2147483648)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:0 filter:0 flags:0x00000000 UNKNOWN(0)
[1962238720]BACKEND[0]: fd:12 filter:-1 flags:0x00000001 EVFILT_READ(204)
[1962238720]BACKEND[0]: POLLRDNORM|POLLIN on 12
[1962238720]BACKEND[0]: hooking in box for fd 12
[1962238720]BACKEND[0]: fd:16 filter:-1 flags:0x00000001 EVFILT_READ(212)
[1962238720]BACKEND[0]: POLLRDNORM|POLLIN on 16
[1962238720]BACKEND[0]: hooking in box for fd 16
[1962238720]BACKEND[0]: fd:15 filter:-1 flags:0x00000001 EVFILT_READ(102)
[1962238720]BACKEND[0]: POLLRDNORM|POLLIN on 15
[1962238720]BACKEND[0]: hooking in box for fd 15
[1962238720]BACKEND[0]: fd:14 filter:-1 flags:0x00000001 EVFILT_READ(102)
[1962238720]BACKEND[0]: POLLRDNORM|POLLIN on 14
[1962238720]BACKEND[0]: hooking in box for fd 14
[1962238720]BACKEND[0]: fd:13 filter:-1 flags:0x00000001 EVFILT_READ(205)
[1962238720]BACKEND[0]: POLLRDNORM|POLLIN on 13
[1962238720]BACKEND[0]: hooking in box for fd 13
[1962238720]BACKEND[0]: Examining box for fd 13 revents:0x0001
[1962238720]BACKEND[0]: read_callback(13, 0x1008d9770)
({ /* 2 elements */
"212.247.28.6",
"yp2.roxen.com"
})
[1962238720]BACKEND[0]: Examining box for fd 14 revents:0x0001
[1962238720]BACKEND[0]: read_callback(14, 0x1008d8ae0)
({ /* 2 elements */
"212.247.28.7",
0
})
[1962238720]BACKEND[0]: Examining box for fd 15 revents:0x0001
[1962238720]BACKEND[0]: read_callback(15, 0x1008d91a0)
({ /* 2 elements */
"212.247.28.8",
0
})
[1962238720]BACKEND[0]: Examining box for fd 16 revents:0x0001
[1962238720]BACKEND[0]: read_callback(16, 0x1008d92c0)
({ /* 2 elements */
"212.247.28.9",
"ldapmaster.roxen.com"
})
[1962238720]BACKEND[0]: Examining box for fd 12 revents:0x0001
[1962238720]BACKEND[0]: read_callback(12, 0x1008d8ed0)
[New Thread 0x190b of process 55510]
^C
Program received signal SIGINT, Interrupt.
0x00007fff8a8e133a in ?? ()
(gdb) bt
#0 0x00007fff8a8e133a in ?? ()
#1 0x000000010018a8ae in udp_read (args=<optimized out>) at
/Users/marty/projects/Pike/8.0/src/modules/_Stdio/udp.c:812
#2 0x0000000100014704 in lower_mega_apply (args=0, o=0x1008d8ed0, fun=51) at
/Users/marty/projects/Pike/8.0/src/interpret.c:2172
#3 0x0000000100014ba2 in jump_opcode_F_MARK_CALL_LFUN (arg1=<optimized out>)
at /Users/marty/projects/Pike/8.0/src/interpret_functions.h:2406
#4 0x0000000101be98cd in ?? ()
#5 0x4b00365126ec1321 in ?? ()
#6 0x000000000000a028 in ?? ()
#7 0x000000000000000c in ?? ()
#8 0x0000000100479e60 in ?? ()
#9 0x00000001001dc2b8 in ?? ()
#10 0x0000000000000150 in ?? ()
#11 0x00007fff5fbfea50 in ?? ()
#12 0x0000000100017215 in eval_instruction (pc=<optimized out>) at
/Users/marty/projects/Pike/8.0/src/interpret.c:1711
#13 mega_apply (type=<optimized out>, args=1606346880, arg1=0x10000,
arg2=<optimized out>) at /Users/marty/projects/Pike/8.0/src/interpret.c:2694
Backtrace stopped: frame did not save the PC
(gdb)