fix(workers): capture worker stderr/stdout, forward it to the gateway log, and attach the stderr tail to early-exit StartupFailed (WRK-002, #259)
ci / windows-x86 (push) Successful in 3m50s
ci / java (push) Failing after 10m14s
ci / portable (push) Failing after 19m55s

The worker was started with CreateNoWindow and no redirection, so its log lines
went to a hidden console of its own and were lost under both a console run and
the NSSM service (verified on windev). The launcher now redirects both streams
and WorkerOutputCapture drains them: each line is forwarded under the
ZB.MOM.WW.MxGateway.Worker category at the worker's own level, the session
nonce is scrubbed, and the last 50 lines / 4 KB of stderr are kept. The drain
never waits on the logger (bounded drop-oldest queue) and ends at EOF when the
worker exits. A worker that exits before connecting (session factory race) or
that the probe finds already exited now fails StartupFailed with the stderr tail.
This commit is contained in:
Joseph Doherty
2026-12-03 13:10:12 -05:00
parent 6804341152
commit ee0f836886
18 changed files with 995 additions and 26 deletions
+5 -4
View File
@@ -537,10 +537,11 @@ with the pin alone.
The pin only warms a cache. It changes no MXAccess behaviour, and a failure is never fatal. The
outcome is in `MxStatusProxyRecordInfoPin.Status`. During the handshake `WorkerPipeSession` logs it
as `WorkerRecordInfoPin` and copies it into `WorkerReady.record_info_pin_status`, unless the runtime
already filled that field. The copy is the one operators see: the worker's own log goes to stderr,
which the gateway's launcher does not redirect. The gateway logs the reported status (Warning when
it is not a successful pin) and shows it on the dashboard's session details page; see
`GatewayProcessDesign.md`.
already filled that field. The worker's own log goes to stderr, which the gateway forwards to its
log at the line's level (see `WorkerProcessLauncher.md`), so the `WorkerRecordInfoPin` line itself
is always Information. The copy in `WorkerReady` is the graded one: the gateway logs the reported
status (Warning when it is not a successful pin) and shows it on the dashboard's session details
page; see `GatewayProcessDesign.md`.
If COM creation fails, the worker should send a structured fault with: