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 1EE8E1F452 for ; Thu, 9 Nov 2023 10:09:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1699524587; bh=VLuQUQentoATHpYFxcrzWBzbgw9GbWLdK/o/9ugb11w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=KL6I/szRoxP599FTI5beJiygh0V0L7Vhq5OsuzUNLjSYwK4wNBrynzSVIocdll8Fy tRkSo07a0E6B4WZTruNR7/1q+b2Riyb4el8WZTQ0jwnOOJEVG0LgpymNZd+HiikchQ R5EIA47NI/W8WUe3kEEUkkgUJyCXO6Q8RtKght5I= From: Eric Wong 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 Message-ID: <20231109100946.1440611-2-e@80x24.org> In-Reply-To: <20231109100946.1440611-1-e@80x24.org> References: <20231109100946.1440611-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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 ],