]> Sergey Matveev's repositories - public-inbox.git/commitdiff
listener: EPOLL_CTL_ADD errors are non fatal
authorEric Wong <e@yhbt.net>
Thu, 9 Jan 2020 11:14:50 +0000 (11:14 +0000)
committerEric Wong <e@80x24.org>
Thu, 9 Jan 2020 11:23:31 +0000 (11:23 +0000)
EPOLL_CTL_ADD may fail with transient ENOMEM or ENOSPC errors,
so don't tear down the process when that happens.

lib/PublicInbox/Listener.pm

index 928d9301902fdb059ddbd4a2603af92cb6848736..cdfd34a275bc532c4bc71dd3c14485751351d899 100644 (file)
@@ -40,7 +40,8 @@ sub event_step {
        # on high-traffic sites.
        if (my $addr = accept(my $c, $sock)) {
                IO::Handle::blocking($c, 0); # no accept4 :<
-               $self->{post_accept}->($c, $addr, $sock);
+               eval { $self->{post_accept}->($c, $addr, $sock) };
+               warn "E: $@\n" if $@;
                $self->requeue;
        } elsif ($! == EAGAIN || $! == ECONNABORTED || $! == EPERM) {
                # EAGAIN is common and likely