Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xHyUD-00000003OkJ-2oCY for pgsql-bugs@arkaria.postgresql.org; Sat, 17 Oct 2026 07:05:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xHyUA-0000000HCuP-3kwN for pgsql-bugs@arkaria.postgresql.org; Sat, 17 Oct 2026 07:05:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xHyUA-0000000HCuF-2Mup for pgsql-bugs@lists.postgresql.org; Sat, 17 Oct 2026 07:05:42 +0000 Received: from mail-dy1-x132e.google.com ([2607:f8b0:4864:20::132e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1xHyU7-00000002cxM-30ru for pgsql-bugs@lists.postgresql.org; Sat, 17 Oct 2026 07:05:41 +0000 Received: by mail-dy1-x132e.google.com with SMTP id 5a478bee46e88-34c522572bfso58937eec.3 for ; Sat, 17 Oct 2026 00:05:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1792220737; x=1792825537; darn=lists.postgresql.org; h=mime-version:content-transfer-encoding:content-type:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=58m4TwgDRjs6g4XFIlluZHk9dvK8rsAf1rnvZ5wAoUY=; b=Z59eTcZOADSQ1/hkjgiTSlGqjde5eiaCAsd8ca4nUvcgtq6UgDceQMhIZqqwYzKRcS q8nY/8MednTeoGGqXzwHimKHBhe70GclkmxEPmWXc+3DSUxcKF0a5bdGt9bYRwNWN1Ye PBKb2iH9k7uYoCxp7gvVQlcz6QbSn8/TJ/1BxmRlLhxMMhoEhvRged9ZxXKbMgkDOfKi KZN6qZChyVesYbCNgbs64pbeY9EV8+obddKTmfd57brYY6wcjbW1OWhDT8SS3JvTdGHN WYS+4WQz+bzhjpkg3VtMUogVuKSsFeRx8yqoQfCfVbBh32zF4A5oYp2oEr2ewwadpYWQ bLSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792220737; x=1792825537; h=mime-version:content-transfer-encoding:content-type:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=58m4TwgDRjs6g4XFIlluZHk9dvK8rsAf1rnvZ5wAoUY=; b=XuUJjmXETJBKhVf5GO72GIGMsHlZPQHor1uu5uAg2J6k63I5E3BBe0MAAeLj5KkPfa PgdZpJ7ct8PsXnwdQoU62q5GLoWg48XewuNvKoGsXzr/6EwTbeEWF24K8VzJFi5OPzpe CnGi66Qs2/ONMs0SQNzrRpvrJe0DLy607Rfb/IjVpnJDdFX+aS+TIORys3KgP/z369zF JloCXhF53i3CZrnUPdurShWdwWbLTrxDckUFvClXv229GAPJRyBCO4rpDG/I0rgazoee 3Zb/oGcVJg6RaUYYAJLjLo5iC1Khfz471BHdLUuJlWxgF+WkLWhI6s6ITbTCR8ZznTLb mYXg== X-Gm-Message-State: AFq9FYJHYgNdm5WHZOMkvWiyu148LsVYE6rcFbsdbp5vAX/Ilz28xjWd zRs0KRpJG+tpbaJ8FO7gn1aywD3qMoB8UMc3EuIcGfhwdQCNv4PJ+X40zS32mLRy X-Gm-Gg: AYBFou2gm6/BqeqFrRfRmDSwTXgutV3wSlfRIn4eB5NMvUo0Xy6PmDW9R190Ll2bIqb QU5Em+bhD7XmcdZXC2Z+LLqq4jyJ180i8lMAJj+fuWuX9QIa2Zohv6lE3rZWxOYb2+fXPh6Bpgz ABc7AKp6ggQdrVe2HUaNxHrcUAVd//eio9t61vIslkcWsAFuC6iccnWFvnhEsS1YkyYD1osAMOL URdI147MUaTMySCsvE/sZZvZ2EzaFDKns0yQwHxVxKBYU5Z/fX/TeZ18LUmaJHLn/bg3Kvo8fbN 1YK2FuVh16PzZK01U4l2jyk6dUfnzwB9VUnoiddvGeaMDHYMkKtVcSxisDrXtC87nm1+aWv+5ON Vc0g49kP6IhX85ySV+h8bP91zXk/EmCAK4Ilb/L5k4Q9/MdlqegGCneugzWyPKZdh3LKqu0SBvm XG+dgov3/b98qgXwv3HJFD9kpHdvedp819TEY4dfwX2AsZkV4bdDAeno99AzXaeoDmbJiGcRLCR n6heBMkzvCID5+3q9jhme9i6e67HHuT9oJtidsWUHp+lMTunTzBn5FFUXhEhJkkOV5xlZ0i+35+ y88jCc0Z1G4Y9Nnltgvgrr3/1Q== X-Received: by 2002:a05:7022:170a:b0:165:be2f:c56e with SMTP id a92af1059eb24-185106a1606mr4486156c88.2.1792220736636; Sat, 17 Oct 2026 00:05:36 -0700 (PDT) Received: from 192.168.1.109 ([2803:3c90:cee:ea00:5c3c:7e70:29e3:7a55]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1831ca95700sm10900331c88.23.2026.10.17.00.05.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Oct 2026 00:05:36 -0700 (PDT) From: Manu To: pgsql-bugs@lists.postgresql.org, Michael Paquier , Tomas Vondra Cc: 1217816127@qq.com, PG Bug reporting form Subject: Re: BUG #19764: ManualBug3 Assert failure in pgstat_setup_shared_refs crashes initdb Date: Sat, 17 Oct 2026 04:05:31 -0300 Message-ID: <179222073151.2432792.4555994957685675734@gmail.com> In-Reply-To: References: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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 tim= es 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 !=3D 0"), File: "pgstat_shmem.c", L= ine: 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 =3D 1 on entry to pgstat_archiver_reset_all_cb and 0 i= n 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 obje= cts corrupt other parts of shared memory (Assert("list->head !=3D 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 19r= c1 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