diff options
author | Eric Wong <e@80x24.org> | 2019-05-08 19:04:17 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-05-08 19:04:17 +0000 |
commit | 90c5a78c8f6239b27c32b816d1cd029196ba2fe2 (patch) | |
tree | c847d11f24951e10714fae649739805a5bd3c22a /lib | |
parent | b6759f4bb35d7eda60044c6f8784274ebd61d729 (diff) | |
download | public-inbox-90c5a78c8f6239b27c32b816d1cd029196ba2fe2.tar.gz |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/DS.pm | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm index c03bd5dd..779215c9 100644 --- a/lib/PublicInbox/DS.pm +++ b/lib/PublicInbox/DS.pm @@ -333,8 +333,8 @@ sub EpollEventLoop { } 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; } |