Merge pull request #2306 from murgatroid99/grpc-js_retry_memory_leak_fix

grpc-js: Discard buffer tracker entry when RetryingCall ends
This commit is contained in:
Michael Lumish 2023-01-03 12:49:01 -08:00 committed by GitHub
commit 7f5cb7d01a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -202,6 +202,15 @@ export class RetryingCall implements Call {
private reportStatus(statusObject: StatusObject) {
this.trace('ended with status: code=' + statusObject.code + ' details="' + statusObject.details + '"');
this.bufferTracker.freeAll(this.callNumber);
for (let i = 0; i < this.writeBuffer.length; i++) {
if (this.writeBuffer[i].entryType === 'MESSAGE') {
this.writeBuffer[i] = {
entryType: 'FREED',
allocated: false
};
}
}
process.nextTick(() => {
this.listener?.onReceiveStatus(statusObject);
});