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.96) (envelope-from ) id 1vs21U-001fac-1x for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Feb 2026 17:04:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vs20U-004966-0N for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Feb 2026 17:03:34 +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.96) (envelope-from ) id 1vs20T-00495y-2Z for pgsql-hackers@lists.postgresql.org; Mon, 16 Feb 2026 17:03:33 +0000 Received: from mail-dl1-x1243.google.com ([2607:f8b0:4864:20::1243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vs20R-000000013Lz-2SGQ for pgsql-hackers@postgresql.org; Mon, 16 Feb 2026 17:03:33 +0000 Received: by mail-dl1-x1243.google.com with SMTP id a92af1059eb24-12732e6a123so3699666c88.1 for ; Mon, 16 Feb 2026 09:03:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1771261409; x=1771866209; darn=postgresql.org; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=j3K7FiRxNJkHvDdiZ7yM3p1/NlcsIbu/Gy6e32jCyQ8=; b=a+vX8jx3MwjnZc/fk7/7BmOCZp+X4/1Dtqb+nyLKf46+KDP4d5olvQ7y1jyBeHpAaq cTecrvuEK5ZQAB/O5lPneNZbTYnQHvmB+ZQUbYqpVl0BWlhVcPNk6AvdyBlyQwAKbD76 0IpcOx1UZogVF+RaiGV+EhZ3lNeLYCuSScxtU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771261409; x=1771866209; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=j3K7FiRxNJkHvDdiZ7yM3p1/NlcsIbu/Gy6e32jCyQ8=; b=FBfc66BP7/ed7CKyMr0u0CWOzPkEwTQgQgaBwIbok4sU+nTOEr2IbqCLMywqSiPgNy cfVmFfLXyV2W3yfSYPX7VIxPFFd2iTQOviSMcj/cpHt8HEO9mOpRv5psaYHsoQ2MFrXV ykwkX/JrZYelUeDa8WQ4LHFgwjGGG9dLMloGqz8v06MOY0GzhBxo7kNUuFo80KrJAtAt 1c5YYgl831X/A6NK+yfJI6ReDzaXh6IF1Hc4z4yXyP0UJtGFBI8dx3UQAjjvcJ5ZST2N booP9tFsEkjkjmuIXMubFMiKpPAsXlGWrnclfFokvMJg0RzV9NKe233LJKi52kjTX9VG 447A== X-Gm-Message-State: AOJu0Yz1Lm4+uQLPj+Srz7ufSc+V09SSg1tuYpU5bBp61ksFdSO6urLT g0l8UaCQEbWSsu1JyPj4Muxszzmkl05R/r3oD0aTKZAxuv4fFjk2i66sF3kzPE22SA== X-Gm-Gg: AZuq6aJmWFVcCks4GFcgnTSaB9eyL1iS6kaERZLGMawHlnysu9C7fprXgJ/LkVXQaSI cQrSK5wzcSVwSwqQFlx9Ek2z0KLIKuZ7nTETF6Moxe8nPuOeW9iZVZG+Rm5P6EBukvmF0KCB/Kv ae7dgCCBlLx019tgCqJYASPjssvIhYSETZc7SRm+hRhhFsjaf78myxAyYDUQVfcQw28dIGh6irQ PSheo+58kLJvI0PATmYzLgg22ugAuOC0WcVa/YtdPnDppOjaNAFshoN6787CRiWjfgjM+YAuTV9 haZIcLcazv/EGo4zcImUi4rVhOfK88BjP2o4jaPgFNBUk3NNWiz8pMkWoiMi/H9CpBELiN1XfTY eXCg1f2HUK5Iq6P63ZLrS2ECaUF5YunkYmm5CFzM01ln8qKXy+PCv3NaT9Lw8XKktNqcaBoRPbr mg/JGmP7GATkpdkJATXj//lxKk1attBDyburb3Y3u3XHvFCb7qRfquctR+71Q= X-Received: by 2002:a05:7022:4186:b0:122:345:a948 with SMTP id a92af1059eb24-1273ae8c2e3mr5781596c88.46.1771261408893; Mon, 16 Feb 2026 09:03:28 -0800 (PST) Received: from rfd.leadboat.com (c-73-15-160-255.hsd1.ca.comcast.net. [73.15.160.255]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-12742cba118sm13038396c88.12.2026.02.16.09.03.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Feb 2026 09:03:28 -0800 (PST) Date: Mon, 16 Feb 2026 09:03:26 -0800 From: Noah Misch To: Alexander Lakhin Cc: pgsql-hackers@postgresql.org Subject: Re: race condition in pg_class Message-ID: <20260216170326.af@rfd.leadboat.com> References: <20231102030915.d3.nmisch@google.com> <20240512232923.aa.nmisch@google.com> <20240605181706.fe.nmisch@google.com> <20240611024525.9f.nmisch@google.com> <20240614003549.c2.nmisch@google.com> <20240621212842.98.nmisch@google.com> <20240628051353.a0.nmisch@google.com> <9f7cc148-55d1-4062-8229-b6886d7aa380@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9f7cc148-55d1-4062-8229-b6886d7aa380@gmail.com> User-Agent: Mutt/2.2.12 (2023-09-09) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Feb 16, 2026 at 08:00:00AM +0200, Alexander Lakhin wrote: > 20.07.2024 11:00, Alexander Lakhin wrote: > > 28.06.2024 08:13, Noah Misch wrote: > > > Pushed. > Could you please look at one more interesting failure produced by > 001_pgbench_with_server.pl [1]? > regress_log_001_pgbench_with_server: > [13:11:27.325](0.001s) ok 3 - concurrent OID generation stderr /(?^:^$)/ > # Running: pgbench ... > [13:11:29.481](2.156s) not ok 4 - concurrent GRANT/VACUUM status (got 2 vs expected 0) # TODO PROC_IN_VACUUM scan breakage > [13:11:29.483](0.002s) #   Failed (TODO) test 'concurrent GRANT/VACUUM status (got 2 vs expected 0)' > #   at C:/tools/xmsys64/home/pgrunner/bf/root/REL_18_STABLE/pgsql/src/bin/pgbench/t/001_pgbench_with_server.pl line 77. > [13:11:29.484](0.001s) not ok 5 - concurrent GRANT/VACUUM stdout > /(?^:processed: 250/250)/ # TODO PROC_IN_VACUUM scan breakage > [13:11:29.485](0.001s) #   Failed (TODO) test 'concurrent GRANT/VACUUM stdout /(?^:processed: 250/250)/' > ... > [13:11:29.486](0.001s) not ok 6 - concurrent GRANT/VACUUM stderr /(?^:^$)/ # TODO PROC_IN_VACUUM scan breakage > [13:11:29.486](0.000s) #   Failed (TODO) test 'concurrent GRANT/VACUUM stderr /(?^:^$)/' > #   at C:/tools/xmsys64/home/pgrunner/bf/root/REL_18_STABLE/pgsql/src/bin/pgbench/t/001_pgbench_with_server.pl line 77. > [13:11:29.487](0.001s) #                   'pgbench: error: client 1 script > 1 aborted in command 0 query 0: ERROR:  relation 266643 deleted while still > in use > # pgbench: error: Run was aborted; the above results are incomplete. > # ' > #     doesn't match '(?^:^$)' > > 001_pgbench_with_server_main.log contains: > 2026-02-12 13:11:28.603 UTC [6012:36] 001_pgbench_with_server.pl ERROR:  relation 266643 deleted while still in use > 2026-02-12 13:11:28.603 UTC [6012:37] 001_pgbench_with_server.pl STATEMENT:  VACUUM ddl_target; > > I'm able to reproduce this error with: > numcouples=40 > for ((j=1;j<=numcouples;j++)); do > createdb db$j > echo "CREATE TABLE t(i int);" | psql -d db$j > done > > for ((i=1;i<=1000;i++)); do >   echo "iteration $i" >   for ((j=1;j<=numcouples;j++)); do >     for ((k=1;k<=100;k++)); do echo "GRANT SELECT ON t TO public /* $k */;"; done | psql -d db$j >psql-grant-$j.log 2>&1 & >     for ((k=1;k<=10;k++)); do echo "VACUUM t /* $k */;"; done | psql -d db$j >psql-vacuum-$j.log 2>&1 & >   done >   wait >   grep -E 'ERROR: ' server.log && break; > done > > This fails for me as below: > ... > iteration 47 > 2026-02-16 07:13:14.855 EET|law|db13|6992a76a.a6983|ERROR:  relation 16434 deleted while still in use > > ... > iteration 6 > 2026-02-16 07:13:42.537 EET|law|db20|6992a786.ab3bc|ERROR:  pg_class entry for relid 16462 vanished during vacuuming > > ... > iteration 7 > 2026-02-16 07:14:01.182 EET|law|db2|6992a799.ad54f|ERROR:  could not open relation with OID 16390 > > ... > iteration 9 > 2026-02-16 07:14:26.160 EET|law|db12|6992a7b2.aedf8|ERROR:  relation 16430 deleted while still in use > ... These symptoms are consistent with the "PROC_IN_VACUUM scan breakage" bug. It's good to have an additional recipe for reproducing that bug, so I've linked to your message from the PROC_IN_VACUUM entry at https://wiki.postgresql.org/wiki/User:Nmisch/Wanted > [1] https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=fairywren&dt=2026-02-12%2012%3A17%3A56&stg=pgbench-check Since the PROC_IN_VACUUM failures are in tests marked TODO, they don't make the test fail. I think this particular buildfarm link is a case of: https://wiki.postgresql.org/wiki/Known_Buildfarm_Test_Failures#Miscellaneous_tests_fail_on_Windows_due_to_a_connection_closed_before_receiving_a_final_error_message Here's the non-TODO failure in that log: [13:11:30.050](0.002s) not ok 10 - no such database stderr /(?^:FATAL: database "no-such-database" does not exist)/ [13:11:30.051](0.001s) # Failed test 'no such database stderr /(?^:FATAL: database "no-such-database" does not exist)/' # at C:/tools/xmsys64/home/pgrunner/bf/root/REL_18_STABLE/pgsql/src/bin/pgbench/t/001_pgbench_with_server.pl line 100. [13:11:30.051](0.000s) # 'pgbench: error: connection to server on socket "C:/tools/xmsys64/tmp/P5YfRmVxhI/.s.PGSQL.10766" failed: server closed the connection unexpectedly # This probably means the server terminated abnormally # before or while processing the request. # pgbench: error: could not create connection for setup # ' # doesn't match '(?^:FATAL: database "no-such-database" does not exist)' The server log has the expected message that pgbench didn't receive: 2026-02-12 13:11:29.662 UTC [8948:1] [unknown] LOG: connection received: host=[local] 2026-02-12 13:11:29.664 UTC [8948:2] [unknown] LOG: connection authenticated: user="pgrunner" method=trust (C:/tools/xmsys64/home/pgrunner/bf/root/REL_18_STABLE/pgsql.build/testrun/pgbench/001_pgbench_with_server/data/t_001_pgbench_with_server_main_data/pgdata/pg_hba.conf:117) 2026-02-12 13:11:29.664 UTC [8948:3] [unknown] LOG: connection authorized: user=pgrunner database=no-such-database application_name=001_pgbench_with_server.pl 2026-02-12 13:11:29.664 UTC [8948:4] [unknown] FATAL: database "no-such-database" does not exist