The time-based input limiting contains a buffer, that gets drained only once all chunks were handled.
This way fast producers can easily exhaust memory and will crash the terminal / browser engine.
Relevant code:
|
if (this.writeBuffer.length > bufferOffset) { |
|
// Allow renderer to catch up before processing the next batch |
|
setTimeout(() => this._innerWrite(bufferOffset), 0); |
|
} else { |
|
this._writeInProgress = false; |
|
this.writeBuffer = []; |
|
} |
Partial fix: Trim/slice already handled chunks from the buffer.
Even with this partial fix a long running producer that is faster than the terminal can handle incoming chunks will grow the buffer up to a possible crash. For a full fix we have to implement a reliable back pressure mechanism.
The time-based input limiting contains a buffer, that gets drained only once all chunks were handled.
This way fast producers can easily exhaust memory and will crash the terminal / browser engine.
Relevant code:
xterm.js/src/Terminal.ts
Lines 1441 to 1447 in af81acc
Partial fix: Trim/slice already handled chunks from the buffer.
Even with this partial fix a long running producer that is faster than the terminal can handle incoming chunks will grow the buffer up to a possible crash. For a full fix we have to implement a reliable back pressure mechanism.