->DESTROY ordering via "exit()" calls is tricky, and dedupe
checks were causing problems.

AFAIK, this only affects users who manually enable WAL on
lei/store/ei*/over.sqlite3.  Fortunately, there is no data
corruption as a result even though "read-only" WAL requires
write permissions.
---
 lib/PublicInbox/LeiToMail.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/LeiToMail.pm b/lib/PublicInbox/LeiToMail.pm
index 90db30e53089..3c5e7e59e8ee 100644
--- a/lib/PublicInbox/LeiToMail.pm
+++ b/lib/PublicInbox/LeiToMail.pm
@@ -756,6 +756,12 @@ sub ipc_atfork_child {
        $lei->_lei_atfork_child;
        $lei->{auth}->do_auth_atfork($self) if $lei->{auth};
        $SIG{__WARN__} = PublicInbox::Eml::warn_ignore_cb();
+       $self->{git} = $self->{lei}->{ale}->git;
+       $SIG{TERM} = sub { # avoid ->DESTROY ordering problems
+               my $git = delete $self->{git};
+               $git->async_wait_all if $git;
+               exit(15 + 128);
+       };
        $self->SUPER::ipc_atfork_child;
 }
 
@@ -776,7 +782,7 @@ sub write_mail { # via ->wq_io_do
        my ($self, $smsg, $eml) = @_;
        return $self->{wcb}->(undef, $smsg, $eml) if $eml;
        $smsg->{-lms_rw} = $self->{-lms_rw};
-       $self->{lei}->{ale}->git->cat_async($smsg->{blob}, \&git_to_mail,
+       $self->{git}->cat_async($smsg->{blob}, \&git_to_mail,
                                [$self->{wcb}, $smsg]);
 }
 
--
unsubscribe: one-click, see List-Unsubscribe header
archive: https://public-inbox.org/meta/

Reply via email to