Re: Fix resource leaks in pg_receivewal on LZ4 close failures

From: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, 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-12 03:18:01
Message-ID: CABPTF7VuBh-u+RNry3n2EjzaH7=PYC1TngrTfX4=4PybGPhnBA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Nov 11, 2026 at 11:56 PM Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>
> On Wed, Nov 11, 2026 at 7:52 PM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
> > Which bypasses the operations for successful close(df->fd), is that intentional?
>
> Yes. Previously, if compression finalization or the final write failed,
> the function returned -1 immediately, skipping rename, unlink, and
> sync. So the patch just preserves that behavior while releasing
> the resources.

The fix LGTM. I am also a bit curious why unlink is also skipped
before though it is unrelated to the cur patch.

--
Regards,
Xuneng Zhou
HighGo Software Co., Ltd.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chee Wooson 2026-11-12 03:26:34 Re: [PATCH v2] Avoid carrying self lock-only xmax to updated tuple
Previous Message Chao Li 2026-11-12 03:05:48 Re: extension_control_path: ignore empty elements and deduplicate directories