Subject: | IO::Async::Loop::Poll doesn't check POLLNVAL, 100% CPU if it happens |
IO::Poll handles() always masks in POLLHUP|POLLERR|POLLNVAL, but IO::Async::Loop::Poll does not check for POLLNVAL to trigger errors on those handles.
If it happens (which is obviously a bug, but I haven't been able to find it in my code yet), then top shows massive CPU usage for the process. Using strace shows poll(2) immediately returning POLLNVAL for the bad descriptor, but the userland just issues some gettimeofday(2) calls and returns to poll(2) with the same request set, which returns POLLNVAL....
Observed (only under production load) using IO::Async 0.63 and IO 1.31 (IO::Poll 0.09) installed from Ubuntu Utopic repositories, but from metacpan's browser, it looks like 0.64 should also be affected.
Using IO::Async::Loop::EV seems to avoid the CPU usage, although it naturally still generates warnings like: EV: error in callback (ignoring): Can't call method "sysread" on an undefined value at /usr/share/perl5/IO/Async/Stream.pm line 909.