Re: Use proc_exit() in WalRcvWaitForStartPosition

Andreas Karlsson <andreas@proxel.se>

From: Andreas Karlsson <andreas@proxel.se>
To: Chao Li <li.evan.chao@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2026-04-08T20:59:52Z
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




Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Use proc_exit() for walreceiver exit in WalRcvWaitForStartPosition()