-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Empty show more show less
When ChangeStream.prototype.close is called, we close the internal cursor but fail to remove event listeners from it. At best this is a memory leak, and at worst leads to difficult to trace bugs due to the closure still living on with an invalid reference to self. We should remove the events during close like so:
['data', 'close', 'end', 'error'].forEach(event => this.cursor.removeAllListeners(event) );