Skip to content

Commit

Permalink
Merge pull request #2306 from murgatroid99/grpc-js_retry_memory_leak_fix
Browse files Browse the repository at this point in the history
grpc-js: Discard buffer tracker entry when RetryingCall ends
  • Loading branch information
murgatroid99 committed Jan 3, 2023
2 parents c9f8f93 + c62d416 commit 7f5cb7d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/grpc-js/src/retrying-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down

0 comments on commit 7f5cb7d

Please sign in to comment.