Skip to content

Commit

Permalink
server: aggressively catch child process pipe errors (#1609)
Browse files Browse the repository at this point in the history
* server: aggressively catch python child process pipe errors

* document error behavior

* move stdio error handling to setupWorker

* handle undefined stdio
  • Loading branch information
bjia56 authored Oct 11, 2024
1 parent 5856ad6 commit 24bcc32
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/src/plugin/runtime/child-process-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ export abstract class ChildProcessWorker extends EventEmitter implements Runtime
this.worker.on('disconnect', () => this.emit('error', new Error('disconnect')));
this.worker.on('exit', (code, signal) => this.emit('exit', code, signal));
this.worker.on('error', e => this.emit('error', e));
// aggressively catch errors
// ECONNRESET can be raised when the child process is killed
for (const stdio of this.worker.stdio || []) {
if (stdio)
stdio.on('error', e => this.emit('error', e));
}
}

get pid() {
Expand Down

0 comments on commit 24bcc32

Please sign in to comment.