fix(workers): fail fast when the worker exits before connecting; launch-cleanup Kill never masks the launch error (WRK-002, WRK-006, #253)
This commit is contained in:
@@ -54,9 +54,15 @@ path exists, has a `.exe` extension, contains a valid Windows Portable
|
||||
Executable header, and matches the configured `RequiredArchitecture`.
|
||||
|
||||
After the process starts, `IWorkerStartupProbe` waits for startup readiness.
|
||||
The default probe only verifies that the worker did not exit immediately. The
|
||||
worker client replaces this probe when pipe connection, hello, and
|
||||
`WorkerReady` handling are implemented.
|
||||
The default probe only verifies that the worker did not exit immediately, which
|
||||
it checks once, microseconds after the process is created. A worker that dies
|
||||
after that and before it connects is caught by the session factory instead:
|
||||
`SessionWorkerClientFactory` races the pipe connect against the process exit,
|
||||
so an early exit fails the open at once with `StartupFailed` and the worker's
|
||||
exit code rather than holding the open (and its session slot) for the whole
|
||||
startup timeout and reporting a timeout. Once the pipe is connected, a worker
|
||||
exit surfaces as pipe end-of-stream in the handshake reads. The worker's stderr
|
||||
is not redirected, so the failure carries the exit code only.
|
||||
|
||||
The startup probe runs once, bounded by `WorkerOptions.StartupTimeoutSeconds`;
|
||||
it is not retried. The default probe only checks that the process is still
|
||||
@@ -71,7 +77,11 @@ retry loop.
|
||||
If startup fails or exceeds `WorkerOptions.StartupTimeoutSeconds`, the launcher
|
||||
kills the worker process tree, disposes the process handle, disposes the
|
||||
optional pipe reservation, records a worker kill metric, and reports a
|
||||
`WorkerProcessLaunchException`.
|
||||
`WorkerProcessLaunchException`. A `Kill` that throws during this cleanup (the
|
||||
process is mid-termination, access is denied, a descendant could not be
|
||||
terminated) is logged and does not replace the launch error; the process handle
|
||||
and the pipe are disposed regardless. The session factory's own cleanup follows
|
||||
the same rule.
|
||||
|
||||
## Verification
|
||||
|
||||
|
||||
Reference in New Issue
Block a user