about summary refs log tree commit homepage
path: root/lib/PublicInbox/Git.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/Git.pm')
-rw-r--r--lib/PublicInbox/Git.pm11
1 files changed, 10 insertions, 1 deletions
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;