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 1wRhiu-002c25-1m for pgsql-hackers@arkaria.postgresql.org; Tue, 26 May 2026 02:40:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wRhir-002bic-18 for pgsql-hackers@arkaria.postgresql.org; Tue, 26 May 2026 02:40:50 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wRhiq-002bhc-0k for pgsql-hackers@lists.postgresql.org; Tue, 26 May 2026 02:40:49 +0000 Received: from fhigh-b6-smtp.messagingengine.com ([202.12.124.157] helo=fhigh-c6-smtp.messagingengine.com) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wRhio-00000000myC-3Y44 for pgsql-hackers@lists.postgresql.org; Tue, 26 May 2026 02:40:48 +0000 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.stl.internal (Postfix) with ESMTP id 27DEB7A0171; Mon, 25 May 2026 22:40:44 -0400 (EDT) Received: from phl-imap-05 ([10.202.2.95]) by phl-compute-06.internal (MEProxy); Mon, 25 May 2026 22:40:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eulerto.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1779763244; x=1779849644; bh=M5zy3DQ5v0arAThpsBcWe8uI4rFSB/c+hzglpjgw5KI=; b= TzjGVr/piOGzbw529xpInikyax7lx7IcMNWzQQPWmiq0QW3TsPQQQW5GfJl/eI4m 2h96FF8GZj868/Ius3oJqeJXlH8Ri/zhnkwmKxKj8nbEM/JXKmqlCwF/MMVG+ebJ EVyGW3N82pycBVecwY28r50d5L7816DwzxezIEgm4xbSZW81DQAnkseKHhgQGec6 rJ0+gQ8ShM1KEDrYvrwLYu1+A31lR+lwL/5buHBtkuL0Kemx8a/IMSe7qh9mKSOZ T4KmCWKb9Esi7yHDultKSJkzc5mOi6zve/oMeTV+alruEBYaVmSj7hMGdCqwAaDA qPoK2cFOQRHlMHjUneB/ug== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1779763244; x= 1779849644; bh=M5zy3DQ5v0arAThpsBcWe8uI4rFSB/c+hzglpjgw5KI=; b=B 8yl4EYbQu1krgkJx1srupdJMFkVP7gxPryfUQqypNt+P4MDibiu0rUR3wtSmtAJg 9McWD1AeZ/4pzZQfDyL7oVmuXdDGGCONMws8KkZl/Kqu5h+A4kBaniKvCoVpNzKr /JNESEn3THvgp8NOlU6nmF7A+qruMZoBPw2FmeVsG2hwRU0K1Ns8OgwUCvbnsXr6 dh5BthOw0u8EggXfFKURHegjCqGZbCuNLCM/IL7qwjQuGgSIfPfnTnomjN8kqJpr bgXXkIvIOuJYCE/10Ru+cDTWxykF/QpG52nHA3Ok7RzgK2tQNnNA0M4Ur0+XiWAf DOIcPlb4IUS/DPtyOh+Ww== X-ME-Sender: X-ME-Proxy-Cause: dmFkZTGYTKjS77TAGj00Vel3Le0to4gFRaHKJO1RYhZpydmp60GLNZSHkvpUfSOmzs2eKq HSSlNDaLi1tOLWRX69ZW6mN+x+UAqd+IPUGEBRdNpCU3XXybaEVBnAaqFj58I98MtCX13U X4ekQqDTgMyHjICus/Wr4XOsKr8rK21iVhqTQMD81v0VzMh9hviOnZxLVCUMf0s6AyElV1 OTFNPDY8WLaUbBBkFnLnxjTBJNct3WoBsCrP7ijUFJZu+/Gcxt+pEsFJSX+EtKzs+y09Es Qyl/MrQF9cednlhzMTrI0Ng87JoQTaXQ6daKglgcedOJDs1FEBxnt5mpS/rrTfcUxc/ntN k5r9MgYCTmWsh+4wOxM683k5ZUO5gcfxjC53A3EcnmcqSW0On1cU6SC9+wuTYQWepErmQW 2c79DZQHEnTTHrecRQrjonQvz8nGE1Wm4eEWDjqquq3epdTIkWlOE2C9flFi83bZqBNx4A 8g9ETnIjtSomhLP0nCBh5qDZ8nlGRZE8ecjK1XF2BmIYix20pjxSvRWTk+iOj/l+C5TY8m zF0VMbZbgk8IyM6nZf4kTh5jW+9v1NjcgjDUuVIboKtJZAVR/okRUqrTnS9XGPCsamGj9t af3S+mnFIBYZfatZ6I8wyjCk0KuadhbUNO6qgElMO3lojjWosaAyMMFRHRSg X-ME-Proxy: Feedback-ID: i0c21471d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 393E2182007A; Mon, 25 May 2026 22:40:44 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: AjWYCrZjqysk Date: Mon, 25 May 2026 23:39:54 -0300 From: "Euler Taveira" To: "Michael Paquier" , "Postgres hackers" Cc: =?UTF-8?Q?=C3=81lvaro_Herrera?= Message-Id: <746eb248-0787-4633-94fe-f3dbef249f85@app.fastmail.com> In-Reply-To: References: Subject: Re: NULL pointer dereference in syslogger with load_libraries() and -DEXEC_BACKEND at startup Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, May 25, 2026, at 5:21 AM, Michael Paquier wrote: > On Mon, May 25, 2026 at 04:45:41PM +0900, Michael Paquier wrote: >> I did not take the cycles necessary for a bisect, but it looks like >> this has been around for a few months at least. I have pinged >> f3c9e341cdf1 as a safe startup point for now, so that's a 2026 issue. > > Well, well: > 0c8e082fba8d36434552d3d7800abda54acafd57 is the first bad commit=20 > committer: =C3=81lvaro Herrera > date: Wed, 4 Feb 2026 16:56:57 +0100 > Assign "backend" type earlier during process start-up=20 > > I have also checked manually a revert of this commit, and saw that the > problem is gone, so it does not look like I have messed up my bisect. > It seems I was too optimistic about this patch. Since the commit 0c8e082= fba8 sets MyBackendType to B_LOGGER earlier, it breaks the following assumpti= on in syslogger.c. /* * If we're told to write to a structured log file, but it's not= open, * dump the data to syslogFile (which is always open) instead. = This can * happen if structured output is enabled after postmaster start= and we've * been unable to open logFile. There are also race conditions = during a * parameter change whereby backends might send us structured ou= tput * before we open the logFile or after we close it. Writing for= matted * output to the regular log file isn't great, but it beats drop= ping log * output on the floor. It shouldn't assume syslogFile is always open. The send_message_to_serve= r_log() shouldn't be executing the following code path in this case. /* If in the syslogger process, try to write messages direct to file= */ if (MyBackendType =3D=3D B_LOGGER) write_syslogger_file(buf.data, buf.len, LOG_DESTINATION_STDERR); It could set MyBackendType only if child_type !=3D B_LOGGER during launch_backend.c and set it at the same code path as in the past. Howeve= r, I consider this solution ugly and hackish. --=20 Euler Taveira EDB https://www.enterprisedb.com/