user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 1/6] git: workaround occasional -watch error message
Date: Tue,  9 Jan 2024 11:39:23 +0000	[thread overview]
Message-ID: <20240109113928.992464-2-e@80x24.org> (raw)
In-Reply-To: <20240109113928.992464-1-e@80x24.org>

I'm not sure how this happens (perl 5.34.1 on FreeBSD 13.2)
but it appears the {sock} check can succeed and then go undef
and become unable to call ->owner_pid.

This happens when libgit2 is in use, so perhaps that's a factor.
In any case, the rest of the tests succeed.
---
 lib/PublicInbox/Git.pm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index 6c4fcf93..7b991c6b 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -208,8 +208,17 @@ sub cat_async_retry ($$) {
 
 sub gcf_inflight ($) {
 	my ($self) = @_;
+	# FIXME: the first {sock} check can succeed but Perl can complain
+	# about calling ->owner_pid on an undefined value.  Not sure why or
+	# how this happens but t/imapd.t can complain about it, sometimes.
 	if ($self->{sock}) {
-		return $self->{inflight} if $self->{sock}->owner_pid == $$;
+		if (eval { $self->{sock}->owner_pid == $$ }) {
+			return $self->{inflight};
+		} elsif ($@) {
+			no warnings 'uninitialized';
+			warn "E: $self sock=$self->{sock}: owner_pid failed: ".
+				"$@ (continuing...)";
+		}
 		delete @$self{qw(sock inflight)};
 	} else {
 		$self->close;

  reply	other threads:[~2024-01-09 11:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-09 11:39 [PATCH 0/6] WWW updates Eric Wong
2024-01-09 11:39 ` Eric Wong [this message]
2024-01-09 11:39 ` [PATCH 2/6] doc: txt2pre: linkify -extindex(1), dedupe -config(5) Eric Wong
2024-01-09 11:39 ` [PATCH 3/6] test_common: key2sub: don't require final ';' in scripts Eric Wong
2024-01-09 11:39 ` [PATCH 4/6] git: lowercase host in host_prefix_url Eric Wong
2024-01-09 11:39 ` [PATCH 5/6] www: linkify inbox addresses in To/Cc headers Eric Wong
2024-01-09 12:49   ` [PATCH 7/6] address: avoid [ undef, undef ] address pairs Eric Wong
2024-01-09 11:39 ` [PATCH 6/6] www: use autodie in more coderepo places 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=20240109113928.992464-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).