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 C9C751F406 for ; Sun, 26 Nov 2023 21:10:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1701033034; bh=qLhMVQeg3GzDjCa78sqixrZDwATpjbw7EUxUdhHvHnc=; h=Date:From:To:Subject:References:In-Reply-To:From; b=CMH+CsnU7D4Vvr/ufCQkvLLNlfuAXzRYTjhXIcXZkzvJ2pDDq/+UVa4ZPAkhjs65f ZDeLacIkemR9DZOFwMxrCJClfvy/5FlHaxoZpUGrRJSejJdGWk3t3hTMzYTCrL16Yi y53K4FL0S9TbIsr8hJmtneg2XqAzpCz4xofSifnA= Date: Sun, 26 Nov 2023 21:08:01 +0000 From: Eric Wong To: meta@public-inbox.org Subject: [PATCH v2] drop redundant calls to DS->Reset Message-ID: <20231126210802.M17016@dcvr> References: <20231126021105.408573-1-e@80x24.org> <20231126021105.408573-8-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231126021105.408573-8-e@80x24.org> List-Id: Reset gets called on END{} anyways to workaround DBI lifetime problems, so there's no need to call it near exit. We can't replace calls to POSIX::_exit with `exit' to force END{} to run just yet, as there are still some lingering destruction ordering problems on newer DBI and or Perls. --- Dropping POSIX::_exit was too aggressive and caused segfaults on my FreeBSD 13.2 VM. lib/PublicInbox/CodeSearchIdx.pm | 1 - lib/PublicInbox/Daemon.pm | 1 - lib/PublicInbox/IO.pm | 6 ++---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm index 3764f13e..bb1d698b 100644 --- a/lib/PublicInbox/CodeSearchIdx.pm +++ b/lib/PublicInbox/CodeSearchIdx.pm @@ -1292,7 +1292,6 @@ sub cidx_run { # main entry point local @PublicInbox::DS::post_loop_do = (\&shards_active); PublicInbox::DS::event_loop($MY_SIG, $SIGSET); - PublicInbox::DS->Reset; $self->lock_release(!!$NCHANGE); show_json($self); } diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm index f33f6f17..a2c1ed6e 100644 --- a/lib/PublicInbox/Daemon.pm +++ b/lib/PublicInbox/Daemon.pm @@ -703,7 +703,6 @@ sub run { local %POST_ACCEPT; daemon_loop(); - PublicInbox::DS->Reset; # ->DESTROY runs when $for_destroy goes out-of-scope } diff --git a/lib/PublicInbox/IO.pm b/lib/PublicInbox/IO.pm index 6593dcdf..5654f3b0 100644 --- a/lib/PublicInbox/IO.pm +++ b/lib/PublicInbox/IO.pm @@ -15,10 +15,8 @@ use Errno qw(EINTR EAGAIN); sub waitcb { # awaitpid callback my ($pid, $errref, $cb, @args) = @_; - $errref //= \my $workaround_await_pids_clobbered; - $$errref = $?; # sets .cerr for _close + $$errref = $? if $errref; # sets .cerr for _close $cb->($pid, @args) if $cb; # may clobber $? - $? = $$errref; } sub attach_pid { @@ -52,7 +50,7 @@ sub close { } else { # wait synchronously my $w = awaitpid($reap->[1]); } - $? ? '' : $ret; # use $?, AWAIT_PIDS may be cleared on ->Reset (FIXME?) + $? ? '' : $ret; } sub DESTROY {