From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 5/5] lei_xsearch: allow signals during long queries
Date: Tue, 20 Aug 2024 10:35:21 +0000 [thread overview]
Message-ID: <20240820103522.3548609-6-e@80x24.org> (raw)
In-Reply-To: <20240820103522.3548609-1-e@80x24.org>
Xapian ->mset, remote Xapian calls via remote inboxes, and
lcat dumps can take a long time via wq_io_do and hold
lei_xsearch processes open for too long after a client
disconnects prematurely.
This fixes wait_for_eof shutdown timeouts on the lei-daemon quit
pipe when running t/lei-sigpipe.t with GIANT_INBOX_DIR pointed
to a meta@public-inbox.org mirror on my old laptop.
---
lib/PublicInbox/LeiXSearch.pm | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index 43dedd10..e20b13c6 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -150,6 +150,7 @@ sub mset_progress {
sub query_one_mset { # for --threads and l2m w/o sort
my ($self, $ibxish) = @_;
my $lei = $self->{lei};
+ my $allow_sigs = PublicInbox::DS::allow_sigs qw(INT QUIT TERM);
my ($srch, $over) = ($ibxish->search, $ibxish->over);
my $dir = $ibxish->{inboxdir} // $ibxish->{topdir};
return warn("$dir not indexed by Xapian\n") unless ($srch && $over);
@@ -223,6 +224,7 @@ sub query_one_mset { # for --threads and l2m w/o sort
sub query_combined_mset { # non-parallel for non-"--threads" users
my ($self) = @_;
my $lei = $self->{lei};
+ my $allow_sigs = PublicInbox::DS::allow_sigs qw(INT QUIT TERM);
my $mo = { %{$lei->{mset_opt}} };
local $0 = "$0 C $mo->{qstr}";
my $mset;
@@ -317,6 +319,7 @@ sub fudge_qstr_time ($$$) {
sub query_remote_mboxrd {
my ($self, $uris) = @_;
local $SIG{TERM} = sub { exit(0) }; # for DESTROY (File::Temp, $reap)
+ my $allow_sigs = PublicInbox::DS::allow_sigs qw(INT QUIT TERM);
my $lei = $self->{lei};
my $opt = $lei->{opt};
my $qstr = $lei->{mset_opt}->{qstr};
@@ -633,6 +636,7 @@ sub _lcat2smsg { # git->cat_async callback
sub lcat_dump { # via wq_io_do
my ($self) = @_;
my $lei = $self->{lei};
+ my $allow_sigs = PublicInbox::DS::allow_sigs qw(INT QUIT TERM);
my $each_smsg = $lei->{ovv}->ovv_each_smsg_cb($lei);
my $git = $lei->{ale}->git;
if (!$lei->{l2m}) {
next prev parent reply other threads:[~2024-08-20 10:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-20 10:35 [PATCH 0/5] signal handling fixes Eric Wong
2024-08-20 10:35 ` [PATCH 1/5] treewide: handle EINTR for non-(signalfd|kevent) Eric Wong
2024-08-20 10:35 ` [PATCH 2/5] lei: simplify forced signal check Eric Wong
2024-08-20 10:35 ` [PATCH 3/5] sigfd: call normal Perl %SIG handlers Eric Wong
2024-08-20 10:35 ` [PATCH 4/5] lei: allow Ctrl-C to interrupt IMAP+NNTP reads Eric Wong
2024-08-20 10:35 ` Eric Wong [this message]
2024-08-20 18:40 ` [PATCH 6/5] t/sigfd: reduce getpid() calls and hash lookups Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240820103522.3548609-6-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).