user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 4/5] lei_to_mail: avoid SEGV on worker exit via SIGTERM
  2021-10-30  8:11  5% [PATCH 0/5] lei: fix various SIGPIPE problems Eric Wong
@ 2021-10-30  8:11  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-10-30  8:11 UTC (permalink / raw)
  To: meta

->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]);
 }
 

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/5] lei: fix various SIGPIPE problems
@ 2021-10-30  8:11  5% Eric Wong
  2021-10-30  8:11  7% ` [PATCH 4/5] lei_to_mail: avoid SEGV on worker exit via SIGTERM Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-10-30  8:11 UTC (permalink / raw)
  To: meta

Most worrying was the the bug fixed in 4/5; but at least there
wasn't data loss involved...

While the bug fixed in 4/5 didn't cause data loss, it was
dumping core files and filling up my disk while polluting the
kernel log buffer.

Eric Wong (5):
  lei: do not access {sock} after SIGPIPE
  lei_to_mail: limit workers for text, reply and v2 outputs
  lei_xsearch: quiet error message on SIG{PIPE,TERM}
  lei_to_mail: avoid SEGV on worker exit via SIGTERM
  doc: lei-security: add a note about core dumps

 Documentation/lei-security.pod |  6 ++++++
 lib/PublicInbox/LEI.pm         |  2 +-
 lib/PublicInbox/LeiQuery.pm    |  2 +-
 lib/PublicInbox/LeiToMail.pm   | 10 +++++++++-
 lib/PublicInbox/LeiXSearch.pm  |  5 ++++-
 t/lei-sigpipe.t                |  7 +++++--
 6 files changed, 26 insertions(+), 6 deletions(-)

^ permalink raw reply	[relevance 5%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-10-30  8:11  5% [PATCH 0/5] lei: fix various SIGPIPE problems Eric Wong
2021-10-30  8:11  7% ` [PATCH 4/5] lei_to_mail: avoid SEGV on worker exit via SIGTERM 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).