Re: windows CI failing PMSignalState->PMChildFlags[slot] == PM_CHILD_ASSIGNED

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Alexander Lakhin <exclusion(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: windows CI failing PMSignalState->PMChildFlags[slot] == PM_CHILD_ASSIGNED
Date: 2023-03-14 00:01:28
Message-ID: CA+hUKGLYMr4upL+mdbEgTo0L1987n4K6=fyXVNi19rFPW-3FpA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 14, 2023 at 11:20 AM Andres Freund <andres(at)anarazel(dot)de> wrote:
> On windows it looks like pids can't be reused as long as there are handles for
> the process. Unfortunately, we close the handle for the process in
> pgwin32_deadchild_callback(), which runs in a separate thread, so the pid can
> be reused before we get to waitpid(). And thus it can happen while we start
> new children.

Ahhh. Right, of course. The handle thing makes total sense now that
you point it out, and although I couldn't find it in the fine manual,
a higher authority has it in black and white[1]. Even without knowing
which of those calls is releasing the process table entry, we're doing
all of them on the wrong side of that IOCP. Alright, here is a patch
to schlep most of that code over into waitpid(), where it belongs.

[1] https://devblogs.microsoft.com/oldnewthing/20110107-00/?p=11803

Attachment Content-Type Size
0001-Fix-waitpid-emulation-on-Windows.patch text/x-patch 4.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2023-03-14 00:06:46 Re: Allow logical replication to copy tables in binary format
Previous Message Michael Paquier 2023-03-13 23:40:57 Re: pg_dump/pg_restore: Fix stdin/stdout handling of custom format on Win32