From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <e@80x24.org>
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net
X-Spam-Level: 
X-Spam-ASN:  
X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00
	shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2
Received: from localhost (dcvr.yhbt.net [127.0.0.1])
	by dcvr.yhbt.net (Postfix) with ESMTP id D10F81F9F4;
	Mon, 22 Nov 2021 06:55:45 +0000 (UTC)
Date: Mon, 22 Nov 2021 06:55:45 +0000
From: Eric Wong <e@80x24.org>
To: =?utf-8?B?SsO2cmcgUsO2ZGVs?= <joro@8bytes.org>
Cc: meta@public-inbox.org
Subject: [PATCH] searchidx: add some extra diagnostics for odd message
Message-ID: <20211122065545.GA31379@dcvr>
References: <YZebmAxlFJy4lqAw@8bytes.org>
 <20211119185411.M766819@dcvr>
 <YZgbMSUTSayOijaz@8bytes.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <YZgbMSUTSayOijaz@8bytes.org>
List-Id: <meta.public-inbox.org>

Jörg Rödel <joro@8bytes.org> wrote:
> Hi Eric,
> 
> thanks a lot for your help!

No problem, and sorry for the failing test.

> > On Fri, Nov 19, 2021 at 06:54:11PM +0000, Eric Wong wrote:
> > Can you provide a more verbose dump of just t/lei-mirror.t?
> > 
> >    make && prove -bvw t/lei-mirror.t
> > 
> > No rush, though, probably going to be busy the next few days.
> > This may be related, but lei will fail completely unless
> > Inline::C or Socket::MsgHdr are available:
> 
> Turned out this was the issue. I ran the prove command and found in the
> output that either Inline::C or Socket::MsgHdr are missing. Added
> Sochet::MsgHdr and now the tests complete without failures.

Will work on a patch to ensure lei ran successfully.

> > > [   59s] Issuing rollback() due to DESTROY without explicit disconnect() of DBD::SQLite::db handle dbname=/home/abuild/rpmbuild/BUILD/public-inbox-1.7.0/t/data-gen/reindex-time-range.v1-master/public-inbox/xapian15/over.sqlite3 at /home/abuild/rpmbuild/BUILD/public-inbox-1.7.0/blib/lib/PublicInbox/Import.pm line 194.
> > > [   59s] /home/abuild/rpmbuild/BUILD/public-inbox-1.7.0/t/data-gen/reindex-time-range.v1-master index failed: Modification of a read-only value attempted at /home/abuild/rpmbuild/BUILD/public-inbox-1.7.0/blib/lib/PublicInbox/SearchIdx.pm line 900, <$r> line 1.
> > > [   59s] 
> > > [   60s] t/reindex-time-range.t ....... ok
> > 
> > That message is still perplexing to me; and I can't reproduce it
> > consistently...
> 
> I havn't checked whether I see it in all of the 'make test' runs, but at
> least it appears pretty frequently here. Let me know if I can help with
> tracking that down.

Sure thing, can you see if this shows anything useful?
------------8<-----------
Subject: [PATCH] searchidx: add some extra diagnostics for odd message

Perhaps these can help us diagnose occasional
"Modification of a read-only value attempted at ..."
errors in t/reindex-time-range.t (which do not cause test
failures).

Link: https://public-inbox.org/meta/YZgbMSUTSayOijaz@8bytes.org/
---
 lib/PublicInbox/SearchIdx.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index 6e2e614c..030a5007 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -897,6 +897,7 @@ sub log2stack ($$$) {
 	}
 	my $fh = $git->popen(@cmd, $range);
 	my ($at, $ct, $stk, $cmt);
+eval { # FIXME: diagnosing "Modification of a read-only value attempted .."
 	while (<$fh>) {
 		return if $sync->{quit};
 		if (/\A([0-9]+)-([0-9]+)-($OID)$/o) {
@@ -921,6 +922,8 @@ sub log2stack ($$$) {
 			$stk->push_rec('m', $at, $ct, $oid, $cmt);
 		}
 	}
+}; # /end diagnosing "Modification of a read-only value attempted .."
+Carp::croak($@, Carp::longmess()) if $@;
 	close $fh or die "git log failed: \$?=$?";
 	$stk //= PublicInbox::IdxStack->new;
 	$stk->read_prepare;