user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] lei: do not wait for sto->done on disconnected EOF
@ 2022-08-16  3:44 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2022-08-16  3:44 UTC (permalink / raw)
  To: meta

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.
---
 lib/PublicInbox/LEI.pm | 11 ++++-------
 1 file 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 $@;
 }
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-16  3:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-16  3:44 [PATCH] lei: do not wait for sto->done on disconnected EOF 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).