Re: Fix resource leaks in pg_receivewal on LZ4 close failures

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix resource leaks in pg_receivewal on LZ4 close failures
Date: 2026-11-19 07:42:09
Message-ID: D5AD2DC8-50F3-4640-9A38-5E7D34EC2031@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Nov 19, 2026, at 15:19, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>
> On Thu, Nov 12, 2026 at 9:36 AM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>> This call is intended to delete a temporary file, so I don’t think an LZ4F error should prevent that deletion. Maybe fix this leak as well?
>
> Maybe yes, seems we can attempt to unlink the file on error when
> CLOSE_UNLINK is specified. This should also cover close() and gzclose()
> failures, not just LZ4 finalization or final write failures? If so, I think
> a separate patch would be better, since this changes cleanup behavior
> beyond the LZ4 resource leak fix.
>

Sounds fair.

Would you prepare for a follow up patch? Or if you want me to do so?

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2026-11-19 07:45:54 Re: [PATCH] Fix leak when a plpgsql exception block catches an error from CALL
Previous Message Amit Kapila 2026-11-19 07:39:42 Re: Detect mismatched subscription and replication slot properties