Re: Use proc_exit() in WalRcvWaitForStartPosition

From: Andreas Karlsson <andreas(at)proxel(dot)se>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Use proc_exit() in WalRcvWaitForStartPosition
Date: 2026-04-08 20:59:52
Message-ID: 6a42c40e-eb81-4212-9bca-8c0eb02d47d1@proxel.se
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 4/8/26 11:08 AM, Chao Li wrote:
> While working on another patch, I happened to notice that WalRcvWaitForStartPosition() calls raw exit(1). I think this should use proc_exit(1) instead, so that the normal cleanup machinery is not bypassed.
>
> This tiny patch just replaces exit(1) with proc_exit(1) in WalRcvWaitForStartPosition().

This looks likely to be correct since when we exit in WalReceiverMain()
(on WALRCV_STOPPING and WALRCV_STOPPED) we call proc_exit(1). I feel we
should exit the same way in WalRcvWaitForStartPosition() as we do in
WalReceiverMain() and if not I would like a comment explaining why those
two cases are different.

Andreas

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2026-04-08 21:09:12 s/pg_attribute_always_inline/pg_always_inline/?
Previous Message Jim Jones 2026-04-08 20:52:27 Re: Truncate logs by max_log_size