Re: WAL segment file descriptor leak on read errors can PANIC the server

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Sami Imseih <samimseih(dot)pg(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: WAL segment file descriptor leak on read errors can PANIC the server
Date: 2026-10-05 22:27:24
Message-ID: asQkTCkor0XLYKnY@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 05, 2026 at 09:20:27AM +0000, Bertrand Drouvot wrote:
> The comment above segment_close() says that ws_file shall be set to a negative
> number, while both this callback and XLogReaderFree() check for -1. I wonder if
> they should test >= 0 instead?

Probably just checking for negative is fine here, yes.

> Worth mentioning that this is intended for descriptors not managed by another
> cleanup mechanism, such as those returned by BasicOpenFile()? Otherwise, using
> it with OpenTransientFile() could result in segment_close() being called with a
> stale descriptor.

Hmm. How would you reword this comment?

I am also interested in hearing from Bharath about the latest version
of the patch posted.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-10-05 22:32:19 Re: pg_resetwal: refuse to run when backup_label exists
Previous Message Masahiko Sawada 2026-10-05 22:26:46 Re: Fix "unexpected logical decoding status change" error; from concurrent logical decoding activation