about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiXSearch.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-11-09 10:09:34 +0000
committerEric Wong <e@80x24.org>2023-11-09 21:53:46 +0000
commitc8a229eca341949ff37c4958f7c75a9cea3a990d (patch)
tree1c3b8bdbecd5a82f1e8618c8ef31f2b75fcd7456 /lib/PublicInbox/LeiXSearch.pm
parente97a30e7624dfb8645aa33a94844bcf28c7e1379 (diff)
downloadpublic-inbox-c8a229eca341949ff37c4958f7c75a9cea3a990d.tar.gz
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)).
Diffstat (limited to 'lib/PublicInbox/LeiXSearch.pm')
-rw-r--r--lib/PublicInbox/LeiXSearch.pm12
1 files 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 ],