Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lRJOF-0002xC-57 for pgsql-general@arkaria.postgresql.org; Tue, 30 Mar 2021 18:46:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lRJNh-0006z9-MD for pgsql-general@arkaria.postgresql.org; Tue, 30 Mar 2021 18:46:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lRJNh-0006yz-EV for pgsql-general@lists.postgresql.org; Tue, 30 Mar 2021 18:46:25 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lRJNf-00012G-Fj for pgsql-general@lists.postgresql.org; Tue, 30 Mar 2021 18:46:25 +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 12UIkL4M2919658; Tue, 30 Mar 2021 14:46:21 -0400 From: Tom Lane To: Stephan Knauss cc: "pgsql-generallists.postgresql.org" Subject: Re: Debugging leaking memory in Postgresql 13.2/Postgis 3.1 In-reply-to: <9f73e655-14b8-feaf-bd66-c0f506224b9e@stephans-server.de> References: <9f73e655-14b8-feaf-bd66-c0f506224b9e@stephans-server.de> Comments: In-reply-to Stephan Knauss message dated "Tue, 30 Mar 2021 20:33:27 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2919656.1617129981.1@sss.pgh.pa.us> Date: Tue, 30 Mar 2021 14:46:21 -0400 Message-ID: <2919657.1617129981@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Stephan Knauss writes: > The wiki suggested to dump MemoryContext states for more details, but > something strange happens when attaching gdb. It seems that the process > is immediately killed and I can no longer dump such details. You might try running the postmaster under a restrictive ulimit (I think the -v option is the one that matters on Linux, not -d as you might guess). The idea here is that the backends would get an actual ENOMEM failure from malloc() before reaching the point where the kernel's OOM-kill behavior takes over. Given that, they'd dump memory maps to stderr of their own accord, and you could maybe get some insight as to what's leaking. This'd also reduce the severity of the problem when it does happen. regards, tom lane