"...composable_kernel_rocm.git" did not exist on "3361b80269129df0d6c8eddc89bdc98337232459"
Unverified Commit 81d8ef38 authored by liuzhe-lz's avatar liuzhe-lz Committed by GitHub
Browse files

Catch dispatcher stream error event (#1850)

parent 0bb80f31
...@@ -74,6 +74,8 @@ class IpcInterface { ...@@ -74,6 +74,8 @@ class IpcInterface {
this.readBuffer = Buffer.alloc(0); this.readBuffer = Buffer.alloc(0);
this.incomingStream.on('data', (data: Buffer) => { this.receive(data); }); this.incomingStream.on('data', (data: Buffer) => { this.receive(data); });
this.incomingStream.on('error', (error: Error) => { this.eventEmitter.emit('error', error); });
this.outgoingStream.on('error', (error: Error) => { this.eventEmitter.emit('error', error); });
} }
/** /**
...@@ -106,6 +108,10 @@ class IpcInterface { ...@@ -106,6 +108,10 @@ class IpcInterface {
this.eventEmitter.on('command', listener); this.eventEmitter.on('command', listener);
} }
public onError(listener: (error: Error) => void): void {
this.eventEmitter.on('error', listener);
}
/** /**
* Deal with incoming data from process * Deal with incoming data from process
* Invoke listeners for each complete command received, save incomplete command to buffer * Invoke listeners for each complete command received, save incomplete command to buffer
......
...@@ -652,6 +652,10 @@ class NNIManager implements Manager { ...@@ -652,6 +652,10 @@ class NNIManager implements Manager {
this.criticalError(NNIError.FromError(err, 'Tuner command event error: ')); this.criticalError(NNIError.FromError(err, 'Tuner command event error: '));
}); });
}); });
this.dispatcher.onError((error: Error) => {
this.log.error(`Dispatcher error: ${error.message}`);
this.criticalError(new Error('Dispatcher stream error, tuner may have crashed.'));
});
} }
private sendInitTunerCommands(): void { private sendInitTunerCommands(): void {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment