| From: | violin <1217816127(at)qq(dot)com> |
|---|---|
| To: | Manu <manuelreyesbravo(at)gmail(dot)com>, pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz>, Tomas Vondra <tomas(at)vondra(dot)me> |
| Cc: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
| Subject: | Re: BUG #19764: ManualBug3 Assert failure in pgstat_setup_shared_refs crashes initdb |
| Date: | 2026-10-17 08:48:32 |
| Message-ID: | tencent_F62706A391360C62257D0BED3F77BED58606@qq.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Sorry for the two-day delay in responding, and thank you for the detailed investigation.
I agree with your conclusion. The assertion failure was caused by my incremental build without dependency tracking, which left some `pgstat_*.o` files compiled against the old `PgStat_ShmemControl` layout. It was therefore a build artifact caused by stale object files, not a bug in PostgreSQL 19rc1 or master.
The line-number mismatch also confirms that the backtrace I reported did not come from the claimed REL_19_RC1 tree. I should have verified the exact source tree and reproduced the issue with a clean build before reporting it.
I apologize for the confusion and for the time spent investigating this. Please consider my original report withdrawn.
violin
1217816127(at)qq(dot)com
Original
From: Manu <manuelreyesbravo(at)gmail(dot)com>
Date: 2026-10-17 15:05
To: pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz>, Tomas Vondra <tomas(at)vondra(dot)me>
Cc: 1217816127 <1217816127(at)qq(dot)com>, PG Bug reporting form <noreply(at)postgresql(dot)org>
Subject: Re: BUG #19764: ManualBug3 Assert failure in pgstat_setup_shared_refs crashes initdb
On Fri, Oct 16, 2026 at 1:00 PM Michael Paquier wrote:
> These code paths run under initdb in the buildfarm and the CI on a
> daily basis hundreds of times or even more than that. Of course
> there could be a bug, but I just suspect a false positive.
I ran controlled builds to settle the clean vs incremental build question.
Clean builds (git clean -fdx; ./configure --enable-cassert --enable-debug
--enable-depend; make; make install), initdb run 50 times serially and 50 times
8-way parallel on each:
REL_19_RC1 (0b8bff042a), REL_19_STABLE (58d16be8ac), master (23e7ca78a0)
and 44539786b8: 400/400 OK, no assertion failure.
Incremental build as Tomas described (build at 44539786b8^, check out
44539786b8, make again, configured without --enable-depend): initdb fails
10/10 with
TRAP: failed Assert("pgStatSharedRefAge != 0"), File: "pgstat_shmem.c", Line: 505
The same incremental update with --enable-depend: 100/100 OK.
What goes wrong: 44539786b8 adds kind_hash_handles[] and raw_kind_dsa_area[]
to PgStat_ShmemControl ahead of is_shutdown, which moves gc_request_count from
offset 24 to 552. Without dependency tracking, only pgstat.o and pgstat_shmem.o
get rebuilt; the other pgstat_*.o keep the old layout. The stale
pgstat_archiver_reset_all_cb() still addresses archiver at shmem+288, so its
reset_offset covers 448..584, which now includes gc_request_count. When there
is no stats file, pgstat_restore_stats() -> pgstat_reset_after_failure() calls
that callback, it copies the (zero) stats over reset_offset, and
gc_request_count drops from 1 to 0. That is the sequence in the report; with gdb
I see gc_request_count = 1 on entry to pgstat_archiver_reset_all_cb and 0 in the
next pgstat_setup_shared_refs(). With a clean build the same callback runs and
the counter stays at 1.
Leaving only pgstat_archiver.o stale reproduces it 20/20. Rebuilding only
pgstat_archiver.o makes this assertion go away, but then the other stale objects
corrupt other parts of shared memory (Assert("list->head != procno") in
proclist.h), so a tree in that state isn't usable at all.
So I agree with Tomas and Michael: this is a build artifact, not a bug in 19rc1
or master. 44539786b8 is only on master, and in 19rc1 this assertion is at
pgstat_shmem.c:391, so the trace in the report seems to come from a different
tree than 19rc1.
Regards,
Manu
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Manu | 2026-10-17 09:03:44 | Re: BUG #19764: ManualBug3 Assert failure in pgstat_setup_shared_refs crashes initdb |
| Previous Message | Nitin Motiani | 2026-10-17 07:35:52 | Re: BUG #19765: Wrong result from a chain of LEFT JOINs since v16 |