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
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:
@@ -149,7 +149,7 @@ The production binding in `WorkerApplication.Run(string[])` is `EnvironmentVaria
|
||||
|
||||
## Logging
|
||||
|
||||
The worker writes structured key/value lines to standard error. Standard error is used rather than standard output because the gateway side reads worker stdout for diagnostic capture only, while stderr is reserved for log output that does not interfere with any future stdout-based channel.
|
||||
The worker writes structured key/value lines to standard error, and nothing to standard output, so stdout stays free for any future stdout-based channel. The gateway's launcher redirects both streams and forwards every line to the gateway log under the `ZB.MOM.WW.MxGateway.Worker` category, at the level in the line's `level=` prefix. It also keeps the last stderr lines for the `StartupFailed` message of a worker that exits before connecting; see `WorkerProcessLauncher.md` "Worker Output Capture". Before mxaccessgw#259 the streams were not redirected and these lines were lost.
|
||||
|
||||
### The logger contract
|
||||
|
||||
|
||||
Reference in New Issue
Block a user