Re: [PATCH] Fix orphaned backend processes on Windows using Job Objects

2025-11-18 Thread Bryan Green
On 11/6/2025 8:39 PM, Thomas Munro wrote: > On Fri, Nov 7, 2025 at 3:13 AM Bryan Green wrote: >> The reason to still do this patch and clean up the handle inheritance >> mess is that there are states (suspended state, infinite loop, spinlock >> hold, whatever) that a process can be in that keeps i

Re: [PATCH] Fix orphaned backend processes on Windows using Job Objects

2025-11-06 Thread Thomas Munro
On Fri, Nov 7, 2025 at 3:13 AM Bryan Green wrote: > The reason to still do this patch and clean up the handle inheritance > mess is that there are states (suspended state, infinite loop, spinlock > hold, whatever) that a process can be in that keeps it from processing > the event. We don't need t

Re: [PATCH] Fix orphaned backend processes on Windows using Job Objects

2025-11-06 Thread Bryan Green
On 11/6/2025 6:46 AM, Thomas Munro wrote: > On Tue, Nov 4, 2025 at 4:12 AM Bryan Green wrote: >> Current approaches (inherited event handles, shared memory flags) depend >> on the postmaster running code during exit. A segfault or kill bypasses >> all of that. > > Huh. I thought PostmasterHandle

Re: [PATCH] Fix orphaned backend processes on Windows using Job Objects

2025-11-06 Thread Thomas Munro
On Tue, Nov 4, 2025 at 4:12 AM Bryan Green wrote: > Current approaches (inherited event handles, shared memory flags) depend > on the postmaster running code during exit. A segfault or kill bypasses > all of that. Huh. I thought PostmasterHandle should be signalled by the kernel, not by any code

Re: [PATCH] Fix orphaned backend processes on Windows using Job Objects

2025-11-03 Thread Bryan Green
On 11/3/2025 9:29 AM, Andres Freund wrote: > On 2025-11-03 09:25:11 -0600, Bryan Green wrote: >> On 11/3/2025 9:19 AM, Andres Freund wrote: >>> Hi, >>> >>> On 2025-11-03 09:12:03 -0600, Bryan Green wrote: We just need to call CreateJobObject() in PostmasterMain(), configure with JOB_OBJEC

Re: [PATCH] Fix orphaned backend processes on Windows using Job Objects

2025-11-03 Thread Andres Freund
On 2025-11-03 09:25:11 -0600, Bryan Green wrote: > On 11/3/2025 9:19 AM, Andres Freund wrote: > > Hi, > > > > On 2025-11-03 09:12:03 -0600, Bryan Green wrote: > >> We just need to call CreateJobObject() in PostmasterMain(), configure > >> with JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE, and assign the pos

Re: [PATCH] Fix orphaned backend processes on Windows using Job Objects

2025-11-03 Thread Bryan Green
On 11/3/2025 9:19 AM, Andres Freund wrote: > Hi, > > On 2025-11-03 09:12:03 -0600, Bryan Green wrote: >> We just need to call CreateJobObject() in PostmasterMain(), configure >> with JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE, and assign the postmaster. >> Children inherit membership automatically. When t

Re: [PATCH] Fix orphaned backend processes on Windows using Job Objects

2025-11-03 Thread Andres Freund
Hi, On 2025-11-03 09:12:03 -0600, Bryan Green wrote: > We just need to call CreateJobObject() in PostmasterMain(), configure > with JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE, and assign the postmaster. > Children inherit membership automatically. When the job handle closes on > postmaster exit, the kerne

[PATCH] Fix orphaned backend processes on Windows using Job Objects

2025-11-03 Thread Bryan Green
Greetings, When the postmaster exits unexpectedly on Windows (crash, kill, debugger abort), backend processes continue running. Windows lacks any equivalent to Unix's getppid() orphan detection. These orphaned backends hold locks and shared memory, preventing clean restart. This leads to a delay