From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 764DB1F51B for ; Tue, 20 Aug 2024 10:35:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1724150123; bh=WZgzxCoc+ip6W2LaK9AzR5tB3gcwj9UZv5gvCbLIFOw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=2/zO+DVSstFBZH9dRnLwxgqateGG8dzy4Po1cK4MPw+3wYgkZIiJV796klm0+uja8 wpP2Gd2wWX3G40pjJ7DhSVTy7tBgBs1ZEoySBNCwCTL8Tbc8zXmsjTnIvkU2QKWynm 0HohaR8AzqyKIqG/q6RhGEv0LWepWI5S+FjqNkyw= From: Eric Wong 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 Message-ID: <20240820103522.3548609-6-e@80x24.org> In-Reply-To: <20240820103522.3548609-1-e@80x24.org> References: <20240820103522.3548609-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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}) {