| From: | Fujii Masao <fujii(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: pg_receivewal: Fix resource leaks and error reporting during cle |
| Date: | 2026-11-20 11:31:23 |
| Message-ID: | E1xUMpu-00000000Vht-1HFS@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
pg_receivewal: Fix resource leaks and error reporting during cleanup
Failures while finalizing LZ4 compression or writing the final compressed
data could leak a file descriptor and memory. Without --no-loop,
repeated failures across reconnects could accumulate these resources.
This happened because dir_close() returned immediately on these failures,
skipping the code that closes the file and releases its associated
resources. Fix this by closing the file and executing the common cleanup
code before returning.
Backpatch to all supported versions.
Author: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Reviewed-by: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Reviewed-by: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAHGQGwHfCrEogr6=wr0nCkQevAJ9A3HBqQRjT9iJryO7EjF6Lw@mail.gmail.com
Backpatch-through: 15
Branch
------
REL_17_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/f22e8ad6748ac99f1438adc9fa9dfb6517e82623
Modified Files
--------------
src/bin/pg_basebackup/receivelog.c | 13 ++++++++++---
src/bin/pg_basebackup/walmethods.c | 9 ++++++---
2 files changed, 16 insertions(+), 6 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Fujii Masao | 2026-11-20 11:44:58 | pgsql: pg_rewind: Fix recovery delays at WAL page boundaries |
| Previous Message | Tomas Vondra | 2026-11-20 11:17:32 | Re: pgsql: Forget the prefetcher's current record in XLogPrefetcherBeginRea |