Any operations on an fd after POSIX::close() are invalid, so
epoll_ctl will fail. Worse off, in a multi-threaded Perl, the
fd may be reused by another thread and EPOLL_CTL_DEL can hit the
wrong file description as a result.
cf. https://rt.cpan.org/Ticket/Display.html?id=129487
} else {
my $fd = $ev->[0];
warn "epoll() returned fd $fd w/ state $state for which we have no mapping. removing.\n";
- POSIX::close($fd);
epoll_ctl($Epoll, EPOLL_CTL_DEL, $fd, 0);
+ POSIX::close($fd);
}
next;
}