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 1uyipa-00Bomm-Eh for pgsql-committers@arkaria.postgresql.org; Wed, 17 Sep 2025 03:27:42 +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 1uyipY-004Jq6-9V for pgsql-committers@arkaria.postgresql.org; Wed, 17 Sep 2025 03:27:41 +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 1uyipX-004Jpx-W8 for pgsql-committers@lists.postgresql.org; Wed, 17 Sep 2025 03:27:40 +0000 Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uyipU-001EuQ-2I for pgsql-committers@lists.postgresql.org; Wed, 17 Sep 2025 03:27:40 +0000 Received: by mail-il1-x132.google.com with SMTP id e9e14a558f8ab-424081ae9f2so12609285ab.0 for ; Tue, 16 Sep 2025 20:27:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758079657; x=1758684457; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=HvBEQMgVoEL0QO0Q3QsbOxIjuiHLTK0nuK2fseslgc0=; b=X1otGg7HDDAhlCOBvciJOFYgrEJ33hQP+L7sa68FpuWfrSlWer4qzU6VQ9Mb0cEHAD YO8u/yPDvG9gKXCXluLZbI8pd7EqF3XGjx3P00NlWovhgiZso8SfBztjt6LAoxqqpNF5 8cbNNKpBaeV2LQKsknOi5TvqsT6AD9lmC01PM5MOJe+M3IC3wxXA2b3bPBECHwHqCmxV NYzWIAKoj10LYkqk1rzh8LvJfmRcz/f4NJgk7J2nKpFBrWmt13S0UM6P+bP4b+n+VUYQ 7CtCY2sWqynmTfFriLmGN5z1ztMe7vPVDiPRuJ+7ApJ46xBl/sHmwiFAPteHblbrezMh 2kRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758079657; x=1758684457; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=HvBEQMgVoEL0QO0Q3QsbOxIjuiHLTK0nuK2fseslgc0=; b=Q2/cS654XDk/GrsjgxxSSJDIdUCAdnGGHyHhnkWVLiRaAaMy4g7JCu/V9VTVoaWuwv E/RmI3BxRXBW47OknbvmEvNdVdat4owIO90LMpQqtiMWfIbofPXIL0hNALhybnd8Q5/4 JDL5Tc7PopK3eLpUCmnaML728weaYevFNa1xExCGecm5mtGCsO2XXfmpzQJdyktk96x5 /ekU/9MccEVXoBDhiHjMI6pK+FAykqylaNyJjOj+buDcG3PNNwGrGYd+OItr5KTpPEvk mr/5yQEJjoyOAnVemeRixNcqYBilM3WJtlZtsm8VMfz5v52W5MQ0BEusgZOTVo73E2Ob AyEw== X-Forwarded-Encrypted: i=1; AJvYcCVTFRlUrHNoN0Mhp8L/ytRTzsOFH0jiUJUnS0vfkOy8FBvGltUOV1luTp/hcfFQB2G/ZzUiV+sBOxbxrMiGKNXV@lists.postgresql.org X-Gm-Message-State: AOJu0YwII02gxAXtCLpHdSZ47jAlmcTsEDysYwAtvsHHDCSn9vc2C94l 4GGYZYLs/HinbgcugVOMQ/6HM9OnfNfQryFdXy3Nkd1RMmeSot7gn89kzOuiPA== X-Gm-Gg: ASbGnctj04C+e9AA5D+Q2AY4vqwqXC2l96428lc4SqYyE8U0oFSKUr6IhgXTVQSuYb9 IBg0I9ZKeZ/IQ1TSPn0iB94m2XSQ/kkrUUu6ZGoaNcZeeORc5Gi6CjKc6f5oThJtD/Y1TEyzuC4 jlRCs3VpKIDtNcEoFRr4rOl7Dbdkr1zJ0mAfzEDwc9LYZmdLDg7ENcUi3jmkikdg6XfBHLq2ONY PKyMy6XBR1kNhjX/9IYcUs65Xw2zdkKgYGkCiq0+UJwh1cA52fRp5RIgp+qS3PKQVJCNNnLPynm /mpRY8+NqUzh7Sm8fMekgRIMqvm8Hb0qh5jx26R+sXa8uR2QBMGltcih8d/Ck4wf6ydK9XWkJOm LHOZ/BqvjrcIUlSLkd0w4YdNvOTeeNvYbvE+tFpIJ5pKKY51z321rxXUlGaPdyAVKrGbgoUqpdj CKoPy9xK34fXJrWSMuaJObtto= X-Google-Smtp-Source: AGHT+IGnO5a/QQgiTmBrGYaSyaiCfvZoKxwtyHThaUMojyJx8gLjarKR9zDM3OOe/d8Mc0wh/SGbnA== X-Received: by 2002:a05:6e02:3cc9:b0:424:b0a:9680 with SMTP id e9e14a558f8ab-4241a574714mr7868115ab.31.1758079656669; Tue, 16 Sep 2025 20:27:36 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-511f3067b89sm6465300173.38.2025.09.16.20.27.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Sep 2025 20:27:35 -0700 (PDT) Date: Tue, 16 Sep 2025 22:27:34 -0500 From: Nathan Bossart To: Michael Paquier Cc: Nathan Bossart , pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Move named LWLock tranche requests to shared memory. Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="90DLrh6oh+Wqjmvg" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --90DLrh6oh+Wqjmvg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Sep 17, 2025 at 11:35:56AM +0900, Michael Paquier wrote: > Since this commit has been merged, batta has kept failing. Here is > the first failure: > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=batta&dt=2025-09-12%2002%3A05%3A01 Thanks for bringing this to my attention. > And here is the backtrace: > #0 0x000055fcdf6bc97a in NumLWLocksForNamedTranches () at lwlock.c:385 > 385 numLocks += NamedLWLockTrancheRequestArray[i].num_lwlocks; > (gdb) bt > #0 0x000055fcdf6bc97a in NumLWLocksForNamedTranches () at lwlock.c:385 > #1 0x000055fcdf6bc9b3 in LWLockShmemSize () at lwlock.c:400 > #2 0x000055fcdf65bda5 in CalculateShmemSize (num_semaphores=0x7ffcaf7a78e4) at ipci.c:130 > #3 0x000055fcdf65c0b1 in CreateSharedMemoryAndSemaphores () at ipci.c:210 > #4 0x000055fcdf42830c in PostmasterStateMachine () at postmaster.c:3223 > #5 0x000055fcdf42703f in process_pm_child_exit () at postmaster.c:2558 > #6 0x000055fcdf425729 in ServerLoop () at postmaster.c:1696 > #7 0x000055fcdf424be1 in PostmasterMain (argc=4, argv=0x55fd0a8faa10) at postmaster.c:1403 > #8 0x000055fcdef80a19 in main (argc=4, argv=0x55fd0a8faa10) at main.c:231 > (gdb) p i > $3 = 0 > (gdb) p NamedLWLockTrancheRequestArray[0] > Cannot access memory at address 0x7f15ee4ccc08 It looks like the postmaster is trying to access the request array after re-initializing shared memory, which of course fails. So, we need to keep the request array in postmaster's local memory, too. Attached is a quick attempt at a fix. -- nathan --90DLrh6oh+Wqjmvg Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0001-fix-LWLock-shmem-reinitialization.patch