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.94.2) (envelope-from ) id 1qsDeh-007Bh4-J2 for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Oct 2023 02:48:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qsDdg-00Eqpz-6u for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Oct 2023 02:47:28 +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.94.2) (envelope-from ) id 1qsDdf-00Eqpq-Tc for pgsql-hackers@lists.postgresql.org; Mon, 16 Oct 2023 02:47:28 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qsDdb-000t42-TV for pgsql-hackers@lists.postgresql.org; Mon, 16 Oct 2023 02:47:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 39G2lMdM2186073; Sun, 15 Oct 2023 22:47:22 -0400 From: Tom Lane To: Michael Paquier cc: Robert Haas , "Drouvot, Bertrand" , Bharath Rupireddy , PostgreSQL Hackers Subject: Re: Add a new BGWORKER_BYPASS_ROLELOGINCHECK flag In-reply-to: References: <06124373-5fdd-4925-9424-9d036d481f3b@gmail.com> <590ec36a-13cb-4253-934b-b6a220d1026e@gmail.com> <2b530754-56c0-4272-a326-11d30a0bca55@gmail.com> <43fe63f9-a324-4a78-97f8-ebe10e73e61e@gmail.com> Comments: In-reply-to Michael Paquier message dated "Mon, 16 Oct 2023 11:22:38 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2186071.1697424442.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 15 Oct 2023 22:47:22 -0400 Message-ID: <2186072.1697424442@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Michael Paquier writes: > The buildfarm has provided some feedback, and the new tests have been > unstable on mamba: > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=3Dmamba&dt=3D202= 3-10-15%2005%3A04%3A21 Yeah. FWIW, I tried to reproduce this on mamba's host, but did not see it again in 100 or so tries. > In more details: > # poll_query_until timed out executing this query: > # SELECT datname, usename, wait_event FROM pg_stat_activity > # WHERE backend_type =3D 'worker_spi dynamic' AND > # pid =3D ; > # with stderr: > # ERROR: syntax error at or near ";" > # LINE 3: pid =3D ; > So this looks like a hard failure in starting the worker that should > bypass the role login check. The logs don't offer much information, > but I think I know what's going on here: at this stage of the tests, > the number of workers created is 7, very close to the limit of > max_worker_processes, at 8 by default. So one parallel worker spawned > by any of the other bgworkers would be enough to prevent the last one > to start, and mamba has been slow enough in the startup of the static > workers to show that this could be possible. I agree that that probably is the root cause, and we should fix it by bumping up max_worker_processes in this test. But this failure is annoying in another way. Evidently, worker_spi_launch returned NULL, which must have been from here: if (!RegisterDynamicBackgroundWorker(&worker, &handle)) PG_RETURN_NULL(); Why in the world is that "return NULL", and not "ereport(ERROR)" like all the other failure conditions in that function? If there's actually a defensible reason for the C code to act like that, then all the call sites need to have checks for a null result. (cc'ing Robert, as this coding originated at 090d0f205.) regards, tom lane