Skip to content

Fix a bug that the server process may call kill(-1, SIGUSR1) - #229

Merged
kou merged 1 commit into
apache:mainfrom
kou:executor-pid-race
Nov 16, 2026
Merged

kou merged 1 commit into
apache:mainfrom
kou:executor-pid-race

Conversation

@kou

@kou kou commented Nov 16, 2026

Copy link
Copy Markdown
Member

Closes GH-228

kill(-1, ...) sends the signal to all processes that the calling process has permission to send signals to. So tests were sometimes killed by SIGUSR1.

The server process copies session->executorPID to localSession->peerPID when session->initialized is true. But session->executorPID was set only by the main process after WaitForBackgroundWorkerStartup(). If the executor process set session->initialized = true before it, the server process copied InvalidPid (-1) and used it for kill().

The executor process sets session->executorPID by itself before it sets session->initialized = true with this change.

This also adds Processor::signal_process() that does nothing for InvalidPid and uses it for kill() calls that didn't check InvalidPid.

Closes apacheGH-228

`kill(-1, ...)` sends the signal to all processes that the calling
process has permission to send signals to. So tests were sometimes
killed by `SIGUSR1`.

The server process copies `session->executorPID` to
`localSession->peerPID` when `session->initialized` is `true`. But
`session->executorPID` was set only by the main process after
`WaitForBackgroundWorkerStartup()`. If the executor process set
`session->initialized = true` before it, the server process copied
`InvalidPid` (`-1`) and used it for `kill()`.

The executor process sets `session->executorPID` by itself before it
sets `session->initialized = true` with this change.

This also adds `Processor::signal_process()` that does nothing for
`InvalidPid` and uses it for `kill()` calls that didn't check
`InvalidPid`.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@kou

kou commented Nov 16, 2026

Copy link
Copy Markdown
Member Author

+1

@kou
kou merged commit cc819ee into apache:main Nov 16, 2026
16 checks passed
@kou
kou deleted the executor-pid-race branch November 16, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The server process may call kill(-1, SIGUSR1)

1 participant