about summary refs log tree commit homepage
path: root/lib/PublicInbox/Daemon.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/Daemon.pm')
-rw-r--r--lib/PublicInbox/Daemon.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index 2b7ac266..2046a7f5 100644
--- a/lib/PublicInbox/Daemon.pm
+++ b/lib/PublicInbox/Daemon.pm
@@ -155,9 +155,9 @@ sub daemon_prepare ($) {
                 my $s = eval { $sock_pkg->new(%o) };
                 warn "error binding $l: $! ($@)\n" unless $s;
                 umask $prev;
-
                 if ($s) {
                         $listener_names{sockname($s)} = $s;
+                        $s->blocking(0);
                         push @listeners, $s;
                 }
         }
@@ -363,6 +363,14 @@ sub inherit () {
         foreach my $fd (3..$end) {
                 my $s = IO::Handle->new_from_fd($fd, 'r');
                 if (my $k = sockname($s)) {
+                        if ($s->blocking) {
+                                $s->blocking(0);
+                                warn <<"";
+Inherited socket (fd=$fd) is blocking, making it non-blocking.
+Set 'NonBlocking = true' in the systemd.service unit to avoid stalled
+processes when multiple service instances start.
+
+                        }
                         $listener_names{$k} = $s;
                         push @rv, $s;
                 } else {