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 1tITDZ-00EXSJ-Cs for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Dec 2024 13:45:33 +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 1tITDW-009yBd-Lz for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Dec 2024 13:45:31 +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 1tITDV-009yBV-R6 for pgsql-hackers@lists.postgresql.org; Tue, 03 Dec 2024 13:45:31 +0000 Received: from fout-a8-smtp.messagingengine.com ([103.168.172.151]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tITDT-000pwn-Mx for pgsql-hackers@lists.postgresql.org; Tue, 03 Dec 2024 13:45:30 +0000 Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfout.phl.internal (Postfix) with ESMTP id 6B63013800E4; Tue, 3 Dec 2024 08:45:26 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Tue, 03 Dec 2024 08:45:26 -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=1733233526; x=1733319926; bh=D taINn9VTFkf02HovCWaczXfNT4ZajOzrDKYt3E55GQ=; b=xuW9wE6od+hF3ViCX 87+/X63+i+PDox0E/IVeZusaiAsSRrtfFLRHzUfWwafgW5SB/n1mLlVHJwr6dDsu rp+WbTl7mCOZHP519jCFXP4GoUIMJjt3nZn7VrfjWq5m5vTY7WAoXCU2MtKRrU1e TO4QnCkJwDZvSURbqIUL+3rrAuGpS5BZYxzx9M2psY368WrYUdWe+nedt72uOrlb +rRZL2fe+VS+ch7fBVUadwcH78X31hJRnTNbd+ZpWfGfM6bkHUQKBF5eFOKUT4FU ODu384pEshwKG9HGQ9aKIkGx0hzABR0mzSazYRfZwVp4WWa5V11QZXWfC+jftM4z nhVlw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrieefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecu hfhrohhmpeetlhhvrghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrd hnohdqihhprdhorhhgqeenucggtffrrghtthgvrhhnpedvkedtffduffdtffffheffhfej jefhgfeiueeukeejkeffgfdufffhudffffeuveenucffohhmrghinhepvghnthgvrhhprh hishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghi lhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrghdpnhgspghrtg hpthhtohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoheprghmihhtrdhkrghp ihhlrgduieesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrh hssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrghdprhgtphhtthhopehmihgthhgr vghlsehprghquhhivghrrdighiii X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 3 Dec 2024 08:45:25 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1733233522; bh=aVu6oqe7l9LFTElzIWy4RJtuQ2ZggWX4pmYDT1Ibfb8=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=LPhU2xmq82lgPfdO2wVWhTGqhE/Sj+CXviig81EEOGo6z1VmVdOkEsYoNNFp3IBVw tILrExvmiQag9kp5ZTCIXV4Gy7nM8BOqDphsmH3mP5pzHpSYWHVNoxSpLodfa1tq+B g9/QLEdxldjTONgc923CiMBJO9vlZ1k+acLQKQqC+si3eVgsrAsZKMwlf0z7AYueEC 9hSRf/S+2tc3tZZ2MA/hMy9DtHAKhRS36kbGOLqUUmD+CwUEQJ27XQaFNdRHpUGGnj jtmv4hVfuijmJyv1i+xev8HK+q05tSCkQJnnYy7Kwzyr/iyqUhsEhoU5SxKK6r5hW8 OZ+Z0Puto73Hg== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id D67C395; Tue, 3 Dec 2024 14:45:22 +0100 (CET) Date: Tue, 3 Dec 2024 14:45:22 +0100 From: Alvaro Herrera To: Amit Kapila Cc: Michael Paquier , Postgres hackers Subject: Re: Memory leak in WAL sender with pgoutput (v10~) Message-ID: <202412031345.jxrlhwe2a2qa@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-Dec-03, Amit Kapila wrote: > On Tue, Dec 3, 2024 at 4:03 PM Alvaro Herrera wrote: > > > > If you don't like the idea of a static memcxt in the one block where > > it's needed, I propose to store a new memcxt in PGOutputData, to be used > > exclusively for publications, with a well defined lifetime. > > +1. This sounds like a way to proceed at least for HEAD. For > back-branches, it is less clear whether changing PGOutputData is a > good idea. Can such a change in back branches break any existing > non-core code (extensions)? We can put the new member at the end of the struct, it shouldn't damage anything even if they're using this struct -- which I find pretty unlikely. The only way that could break anything is if somebody is allocating/using arrays of it, which sounds even more unlikely. If we don't want to accept that risk (for which I see no argument, but happy to be proven wrong), I would suggest to use the foreach-pfree pattern Michael first proposed for the backbranches, and the new memory context in master. I think this is conducive to better coding overall as we clean things up in this area. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/