From 49684178901a3d5db198032da1bb831b2b3e0b65 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 19 Jul 2022 22:42:52 +0000 Subject: lei: avoid deadlock on inotify/EVFILT_VNODE wakeups Enqueuing "note-event" requests from the DS event loop must not wait on workers being able to drain the queue quickly enough. Thus we make the SOCK_SEQPACKET writes nonblocking and rely on the lei-daemon event loop to enqueue writes. This is a unique problem for "note-event" since it reuses workers in between commands, while most lei commands currently fork off new workers. --- lib/PublicInbox/LeiNoteEvent.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox/LeiNoteEvent.pm') diff --git a/lib/PublicInbox/LeiNoteEvent.pm b/lib/PublicInbox/LeiNoteEvent.pm index db387633..93f80116 100644 --- a/lib/PublicInbox/LeiNoteEvent.pm +++ b/lib/PublicInbox/LeiNoteEvent.pm @@ -58,7 +58,7 @@ sub eml_event ($$$$) { } } -sub maildir_event { # via wq_io_do +sub maildir_event { # via wq_nonblock_do my ($self, $fn, $vmd, $state) = @_; if (my $eml = PublicInbox::InboxWritable::eml_from_path($fn)) { eml_event($self, $eml, $vmd, $state); @@ -93,6 +93,7 @@ sub lei_note_event { my ($op_c, $ops) = $lei->workers_start($wq, $jobs); $lei->wait_wq_events($op_c, $ops); note_event_arm_done($lei); + $wq->prepare_nonblock; $lei->{lne} = $wq; }; if ($folder =~ /\Amaildir:/i) { @@ -101,7 +102,7 @@ sub lei_note_event { return if index($fl, 'T') >= 0; my $kw = PublicInbox::MdirReader::flags2kw($fl); my $vmd = { kw => $kw, sync_info => [ $folder, \$bn ] }; - $self->wq_do('maildir_event', $fn, $vmd, $state); + $self->wq_nonblock_do('maildir_event', $fn, $vmd, $state); } # else: TODO: imap } -- cgit v1.2.3-24-ge0c7