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 1tIWKa-00Er3O-IA for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Dec 2024 17:05:00 +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 1tIWKX-00BOWO-8L for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Dec 2024 17:04:58 +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.94.2) (envelope-from ) id 1tIWKW-00BOWF-T7 for pgsql-hackers@lists.postgresql.org; Tue, 03 Dec 2024 17:04:58 +0000 Received: from fout-a2-smtp.messagingengine.com ([103.168.172.145]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tIWKV-000r6x-2Z for pgsql-hackers@lists.postgresql.org; Tue, 03 Dec 2024 17:04:56 +0000 Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id C782C1380745; Tue, 3 Dec 2024 12:04:53 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Tue, 03 Dec 2024 12:04:53 -0500 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 :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1733245493; x=1733331893; bh=X toJSf+FdBlx9TTFPJfXwDK9GphwfG03L1ICzzIJ1LQ=; b=RkUcCAlggYTW7PKjq SXaD41RtWqjKcK2JYHwBlbfWdQ0a1ZooDBxB/4nQQe6Krmt3kSYzSqd4ADE5Tv5h gX5iZ5uDA+f2V5nl8GxNGBR6EVpk6lCyEmk5G5yDrAAWqm21qyT4FrhgqNvJQlhY joSS7dJQiXAQ2ULqigY+QclDJcJy1/q4z+RWeZIrVVGRcKvhfZHbxti8MF4itT8j GVhM2myS+CDtx6QgsdwQwPaY8ZkP0HmIGbSefOtlhSJU+uB1fL9u7AADP6/60WNJ a/3LJkRV36btEQUilXsUlQcxKyY/e1rniu/2XW7vFx59Z27+aKqC3vhccaIfvCaN dPHcw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrieefgdeikecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecu hfhrohhmpeetlhhvrghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrd hnohdqihhprdhorhhgqeenucggtffrrghtthgvrhhnpeeuiefgffeukedtgfetueeugfet vdeuhefgheelfeehleejleefffejtddtkedvjeenucffohhmrghinhepphhoshhtghhrrd gvshdpvghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptden ucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiph drohhrghdpnhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpthht ohepghgrsghrihgvlhgvrdgsrghrthholhhinhhisegvnhhtvghrphhrihhsvggusgdrtg homhdprhgtphhtthhopehhohhuiihjrdhfnhhsthesfhhujhhithhsuhdrtghomhdprhgt phhtthhopegrmhhithdrkhgrphhilhgrudeisehgmhgrihhlrdgtohhmpdhrtghpthhtoh epphhgshhqlhdqhhgrtghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 3 Dec 2024 12:04:53 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1733245489; bh=s3MIgOZ/FYv7GmajAlxQzEcGLKONuGeqoZBp7MFU8/8=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=CB39ZMX3FFodZpqXO+s4KSkvE2pqHkFFhdD88EPPxwPI2+jB05BKeNzRtRDiR6UPx vkmNmZs3jsW/d2b0D4GyoLeot4zhjkseQEI0l1ilLYnZq3z20RyHB/JHwjoVozFrnh RzZim87OEBm1jVy1v9OVO6vNzp++M66LjNYoWYdKoBzobXxKmc9OvCS/6713QOq7AS kxYgc6wKl/f+Wre9WG2Dsisr6yKWOOQDUA4iIB18AmCnFW0pjm6eLlp5b4ZSDKLP7a C+AW9Tr8d9CUx7DdIOcK9NQUkT5gW1asgQ+Q0OFnOBeC/hMUBW8uN2IKocgUZ9vZQg 7LBxhB3JTK1gQ== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 68FA88C; Tue, 3 Dec 2024 18:04:49 +0100 (CET) Date: Tue, 3 Dec 2024 18:04:49 +0100 From: Alvaro Herrera To: Amit Kapila , "Zhijie Hou (Fujitsu)" Cc: Pg Hackers , Gabriele Bartolini Subject: Re: crash with synchronized_standby_slots Message-ID: <202412031704.thc75krypvts@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-Nov-29, Amit Kapila wrote: > I tried it on my Windows machine and noticed that ReplicationSlotCtl > is NULL for syslogger, so the problem doesn't occur. The reason is > that we don't attach to shared memory in syslogger, so ideally > ReplicationSlotCtl should be NULL. Because we inherit everything > through the fork for Linux systems and then later for processes that > don't want to attach to shared memory, we call PGSharedMemoryDetach() > from postmaster_child_launch(). The PGSharedMemoryDetach won't > reinitialize the memory pointed to by ReplicationSlotCtl, so, it would > be an invalid memory. Heh, interesting. I'm not sure if we should try to do something about invalid pointers being left around after shmem initialization. Also, is this the first GUC check_hook that needs to take an LWLock? Anyway, I have pushed this. BTW it occurs to me that there might well be some sort of thundering herd problem if every process needs to run the check_hook when a SIGHUP is broadcast, and they'll all be waiting on that particular lwlock and run the same validation locally again and again. I bet if you have a few thousand backends (hi Jakub! [1]) it's problematic. Maybe we need a different way to validate the GUC, but I don't know what that might be; but doing the validation once and storing the result in shmem might be better. On 2024-Nov-29, Zhijie Hou (Fujitsu) wrote: > I can also reproduce this bug and confirmed that the bug is fixed > after applying the patch. In addition to the regression tests, I also > manually tested the behavior of the postmaster, walsender, and user > backend after reloading the configuration, and they all work as > expected. Many thanks for testing! [1] https://postgr.es/m/CAKZiRmwrBjCbCJ433wV5zjvwt_OuY7BsVX12MBKiBu+eNZDm6g@mail.gmail.com -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "I apologize for the confusion in my previous responses. There appears to be an error." (ChatGPT)