Charles-François Natali added the comment: So I assume that the second failure is fixed, which means that OS-X returns a funny event (and not POLLIN/POLLHUP/POLLERR) in case of ECONNREFUSED :-(
> 2 - In EventLoopTestsMixin::test_writer_callback if the writer socket isn't > non-blocking, the test hangs forever.. This test is buggy: """ def test_writer_callback(self): el = events.get_event_loop() r, w = unix_events.socketpair() el.add_writer(w.fileno(), w.send, b'x'*100) el.call_later(0.1, el.remove_writer, w.fileno()) el.run() w.close() """ Because the writer socket isn't non-blocking, if the output socket buffer fills up in less than 0.1 seconds, the call to w.send(b'x'*100) will block. select()/poll()/kqueue() use a watermark to decide whether the FD is readable/writable: for a Unix domain socket, I guess OS-X returns that the socket is writable is there's at least one byte free in the output socket buffer: since send() tries to write 100 bytes at once, it blocks. I can reproduce the hang on Linux with vanilla (unpatched) tulip by increasing the number of bytes sent() in one syscall: """ --- tulip-bf4cb136c121/tulip/events_test.py 2092-08-05 00:00:00.000000000 +0200 +++ tulip/tulip/events_test.py 2013-01-08 11:35:27.400198000 +0100 @@ -149,7 +149,7 @@ def test_writer_callback(self): el = events.get_event_loop() r, w = unix_events.socketpair() - el.add_writer(w.fileno(), w.send, b'x'*100) + el.add_writer(w.fileno(), w.send, b'x'*(1<<18)) el.call_later(0.1, el.remove_writer, w.fileno()) el.run() w.close() """ (I have to do that because Linux uses an adaptive watermark, see http://lxr.free-electrons.com/source/net/unix/af_unix.c#L2156 and http://lxr.free-electrons.com/source/net/unix/af_unix.c#L319 ). That's why all FDs monitored with select()/poll()/epoll() must be non-blocking (and there's also the risk of spurious wakeups...). > 3 - Errors: > > ERROR: testCreateSslTransport (tulip.events_test.PollEventLoopTests) > File "/Users/felipecruz/Projects/tulip3/tulip/selectors.py", line 180, in > _key_from_fd > raise RuntimeError("No key found for fd {}".format(fd)) > RuntimeError: No key found for fd -2 > > > ERROR: test_sock_client_ops (tulip.events_test.KqueueEventLoopTests) > File "/Users/felipecruz/Projects/tulip3/tulip/selectors.py", line 180, in > _key_from_fd > raise RuntimeError("No key found for fd {}".format(fd)) > RuntimeError: No key found for fd 77 Yes, it's the same problem: poll()/kqueue() returning garbage. I guess I'll have to patch Selector to ignore unknown FDs, but that really looks like an OS-X bug. Could you dump the content of the returned kevent when the fd is not found? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16853> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com