about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-08-16 03:44:03 +0000
committerEric Wong <e@80x24.org>2022-08-16 03:46:45 +0000
commit79d2267323dc67d70bf4798157dcc2bf822c313d (patch)
treec434f5e10d801e4932fa9506e0f58f7fb489a7d9 /lib
parentd36b6085b7cb78eba6e904d5df82bbe5f938ed2a (diff)
downloadpublic-inbox-79d2267323dc67d70bf4798157dcc2bf822c313d.tar.gz
lei: do not wait for sto->done on disconnected EOF
lei-daemon (the top-level daemon process) should not have
synchronous waits, and this was causing a deadlock with
interrupted commands.  There may still be a bug lurking in
lei/store despite this fix, though.  I originally thought commit
fd261b9e65674505 (lei_store_err: use level-trigger for error pipe, 2022-08-15)
was sufficient, but at least this change is needed, as well.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/LEI.pm11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index d81ca296..595b3fa9 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -1520,13 +1520,10 @@ sub sto_done_request {
         return unless $lei->{sto};
         local $current_lei = $lei;
         my $sock = $wq ? $wq->{lei_sock} : undef;
-        eval {
-                if ($sock //= $lei->{sock}) { # issue, async wait
-                        $lei->{sto}->wq_io_do('done', [ $sock ]);
-                } else { # forcibly wait
-                        my $wait = $lei->{sto}->wq_do('done');
-                }
-        };
+        $sock //= $lei->{sock};
+        my @io;
+        push(@io, $sock) if $sock; # async wait iff possible
+        eval { $lei->{sto}->wq_io_do('done', \@io) };
         warn($@) if $@;
 }