From 2329f0cda018e310cf9c4756151447fd0e0ff44d Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Tue, 1 Feb 2022 11:00:12 -0500 Subject: [PATCH] child tasks must remove reference to parent on kill or else entangled parent-child tasks will not be gc'ed --- lib/tasks/task.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/tasks/task.js b/lib/tasks/task.js index 7a99493d..6c2434f9 100644 --- a/lib/tasks/task.js +++ b/lib/tasks/task.js @@ -62,7 +62,9 @@ class Task extends Emitter { kill(cs) { if (this.cs && !this.cs.isConfirmCallSession) this.logger.debug(`${this.name} is being killed`); this._killInProgress = true; - // no-op + + /* remove reference to parent task or else entangled parent-child tasks will not be gc'ed */ + setImmediate(() => this.parentTask = null); } /**