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 1lMDcQ-0008Lp-NV for pgsql-bugs@arkaria.postgresql.org; Tue, 16 Mar 2021 17:36:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lMDcP-0005j3-KB for pgsql-bugs@arkaria.postgresql.org; Tue, 16 Mar 2021 17:36:33 +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 1lMDcP-0005iw-Dn for pgsql-bugs@lists.postgresql.org; Tue, 16 Mar 2021 17:36:33 +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 1lMDcI-0003Uh-Rn for pgsql-bugs@lists.postgresql.org; Tue, 16 Mar 2021 17:36:32 +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 12GHaOsk3345318; Tue, 16 Mar 2021 13:36:24 -0400 From: Tom Lane To: Jelte Fennema cc: Michael Paquier , duspensky@ya.ru, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16160: Minor memory leak in case of starting postgres server with SSL encryption In-reply-to: References: <16160-18367e56e9a28264@postgresql.org> <20191213063915.GE1942@paquier.xyz> <20191214092456.GB70616@paquier.xyz> <3255514.1615912277@sss.pgh.pa.us> Comments: In-reply-to Jelte Fennema message dated "Tue, 16 Mar 2021 18:17:49 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3345316.1615916184.1@sss.pgh.pa.us> Date: Tue, 16 Mar 2021 13:36:24 -0400 Message-ID: <3345317.1615916184@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jelte Fennema writes: > I'm pretty sure it was the only cause in this specific case. When running > postgres with valgrind this was the only block that was repeatedly being > leaked. Yeah, after doing some testing locally it seems that the non-error path, at least, is free of additional problems. I set up a shell loop to hit the postmaster with SIGHUP ten times a second. Looking at v12, an ssl-enabled postmaster leaks very visibly after a few moments; while there's no detectable leak in HEAD. So +1 for back-patching the DH_free fix. (Michael, do you want to do the honors?) > Looking at it again now, I see that if an error occurs when parsing > ssl_crl_file the root_cert_list is in fact leaked. This was easy to > reproduce by specifying a bogus path for ssl_crl_file. Interesting. While this case doesn't seem likely to pose much of a practical problem, maybe we should clean it up. I'd already wondered what was the point of separating the creation and use of the root_cert_list by so much --- seems like we could install it immediately after creation. regards, tom lane