user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 0/4] Danga::Socket bundling cleanups
  @ 2019-05-08 19:18  7% ` Eric Wong
  2019-05-08 19:18  6%   ` [PATCH 4/4] DS: epoll: fix misordered EPOLL_CTL_DEL call Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2019-05-08 19:18 UTC (permalink / raw)
  To: meta

Dropping some unused stuff, and a bugfix for an error path we never hit.
(all bugfixes are queued for the future maintainer via
 bug-Danga-Socket@rt.cpan.org )

Eric Wong (4):
  build: do not manify DS and Syscall pods
  syscall: drop readahead wrapper
  DS: drop unused "_undef" sub
  DS: epoll: fix misordered EPOLL_CTL_DEL call

 Makefile.PL                | 10 ++++++++++
 lib/PublicInbox/DS.pm      |  9 +--------
 lib/PublicInbox/Syscall.pm | 14 --------------
 3 files changed, 11 insertions(+), 22 deletions(-)

The "danga-bundle" is up to 10 patches, now; and dogfooded
on public-inbox.org for several days without problems.
Will merge to "master" soon:

      bundle Danga::Socket and Sys::Syscall
      listener: use EPOLLEXCLUSIVE for listen sockets
      DS: remove unused fields and functions
      DS: drop profiling support
      DS: workaround IO::Kqueue EINTR (mis-)handling
      DS: handle EINTR in IO::Poll path, too
      build: do not manify DS and Syscall pods
      syscall: drop readahead wrapper
      DS: drop unused "_undef" sub
      DS: epoll: fix misordered EPOLL_CTL_DEL call

^ permalink raw reply	[relevance 7%]

* [PATCH 4/4] DS: epoll: fix misordered EPOLL_CTL_DEL call
  2019-05-08 19:18  7% ` [PATCH 0/4] Danga::Socket bundling cleanups Eric Wong
@ 2019-05-08 19:18  6%   ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2019-05-08 19:18 UTC (permalink / raw)
  To: meta

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
---
 lib/PublicInbox/DS.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm
index c03bd5d..779215c 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;
             }
-- 
EW


^ permalink raw reply related	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-05-05  0:52     [PATCH 0/4] bundle Danga::Socket and Sys::Syscall Eric Wong
2019-05-08 19:18  7% ` [PATCH 0/4] Danga::Socket bundling cleanups Eric Wong
2019-05-08 19:18  6%   ` [PATCH 4/4] DS: epoll: fix misordered EPOLL_CTL_DEL call Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).