From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 01/13] lei_xsearch: put query in process title for debugging
Date: Thu, 9 Nov 2023 10:09:34 +0000 [thread overview]
Message-ID: <20231109100946.1440611-2-e@80x24.org> (raw)
In-Reply-To: <20231109100946.1440611-1-e@80x24.org>
Having queries in the process titles makes it easier to diagnose
stuck queries due to IPC problems. This was used to diagnose
commit e97a30e7624d (lei: fix SIGPIPE on large result sets to pager)).
---
lib/PublicInbox/LeiXSearch.pm | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index 6c8dfe10..ba8ff293 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -148,13 +148,13 @@ sub mset_progress {
sub query_one_mset { # for --threads and l2m w/o sort
my ($self, $ibxish) = @_;
- local $0 = "$0 query_one_mset";
my $lei = $self->{lei};
my ($srch, $over) = ($ibxish->search, $ibxish->over);
my $dir = $ibxish->{inboxdir} // $ibxish->{topdir};
return warn("$dir not indexed by Xapian\n") unless ($srch && $over);
bless $srch, 'PublicInbox::LeiSearch'; # for ->qparse_new
my $mo = { %{$lei->{mset_opt}} }; # copy
+ local $0 = "$0 1 $mo->{qstr}";
my $mset;
my $each_smsg = $lei->{ovv}->ovv_each_smsg_cb($lei);
my $can_kw = !!$ibxish->can('msg_keywords');
@@ -219,9 +219,9 @@ sub query_one_mset { # for --threads and l2m w/o sort
sub query_combined_mset { # non-parallel for non-"--threads" users
my ($self) = @_;
- local $0 = "$0 query_combined_mset";
my $lei = $self->{lei};
my $mo = { %{$lei->{mset_opt}} };
+ local $0 = "$0 C $mo->{qstr}";
my $mset;
for my $loc (locals($self)) {
attach_external($self, $loc);
@@ -312,12 +312,11 @@ sub fudge_qstr_time ($$$) {
sub query_remote_mboxrd {
my ($self, $uris) = @_;
- local $0 = "$0 query_remote_mboxrd";
local $SIG{TERM} = sub { exit(0) }; # for DESTROY (File::Temp, $reap)
my $lei = $self->{lei};
my $opt = $lei->{opt};
- chomp(my $qstr = $lei->{mset_opt}->{qstr});
- $qstr =~ s/[ \n\t]+/ /sg; # make URLs less ugly
+ my $qstr = $lei->{mset_opt}->{qstr};
+ local $0 = "$0 R $qstr";
my @qform = (x => 'm');
push(@qform, t => 1) if $opt->{threads};
open my $cerr, '+>', undef;
@@ -504,6 +503,9 @@ sub ipc_atfork_child {
sub do_query {
my ($self, $lei) = @_;
my $l2m = $lei->{l2m};
+ my $qstr = \($lei->{mset_opt}->{qstr});
+ chomp $$qstr;
+ $$qstr =~ s/[ \n\t]+/ /sg; # make URLs and $0 less ugly
my $ops = {
sigpipe_handler => [ $lei ],
fail_handler => [ $lei ],
next prev parent reply other threads:[~2023-11-09 10:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-09 10:09 [PATCH 00/13] misc error handling stuff and simplifications Eric Wong
2023-11-09 10:09 ` Eric Wong [this message]
2023-11-09 10:09 ` [PATCH 02/13] lei: use cached $daemon_pid when possible Eric Wong
2023-11-09 10:09 ` [PATCH 03/13] lei: reuse FDs atfork and close explicitly Eric Wong
2023-11-09 10:09 ` [PATCH 04/13] lei_up: use v5.12 Eric Wong
2023-11-09 10:09 ` [PATCH 05/13] net_nntp_socks: more comments around how it works Eric Wong
2023-11-09 10:09 ` [PATCH 06/13] lei ls-mail-source: gracefully handle network failures Eric Wong
2023-11-09 10:09 ` [PATCH 07/13] net: retry on EINTR and check for {quit} flag Eric Wong
2023-11-09 10:09 ` [PATCH 08/13] lei_mirror: note missing local manifests are non-fatal Eric Wong
2023-11-09 10:09 ` [PATCH 09/13] ipc: simplify partial sendmsg fallback Eric Wong
2023-11-09 10:09 ` [PATCH 10/13] lei_input: always close single `eml' inputs Eric Wong
2023-11-09 10:09 ` [PATCH 11/13] xapcmd: get rid of scalar wantarray popen_rd Eric Wong
2023-11-09 10:09 ` [PATCH 12/13] lei: get rid of autoreap usage Eric Wong
2023-11-09 10:09 ` [PATCH 13/13] spawn: get rid of wantarray popen_rd/popen_wr 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=20231109100946.1440611-2-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.
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).