Skip to content

Commit 146bea1

Browse files
committed
net: ensure WriteWrap references the handle
`StreamBase::AfterWrite` is passing handle as an argument to the `afterWrite` function in net.js. Thus GC should not collect the handle and the request separately and assume that they are tied together. With this commit - request will always outlive the StreamBase instance, helping us survive the GC pass. Fix: nodejs#1580
1 parent ea5195c commit 146bea1

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

lib/net.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,7 @@ Socket.prototype._writeGeneric = function(writev, data, encoding, cb) {
627627
}
628628

629629
var req = new WriteWrap();
630+
req.handle = this._handle;
630631
req.oncomplete = afterWrite;
631632
req.async = false;
632633
var err;

0 commit comments

Comments
 (0)