Repository navigation
net: write(cb) not called if destroy():ed before 'connect' #30841
Copy link
Copy link
Closed
Labels
confirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.netIssues and PRs related to the net subsystem.Issues and PRs related to the net subsystem.
Description
Activity
- changed the title
[-]net: write(cb) not called if destroyed[/-][+]net: `write(cb)` not called if `destroy()`:ed before 'connect'[/+]on Dec 7, 2019 - changed the title
[-]net: `write(cb)` not called if `destroy()`:ed before 'connect'[/-][+]net: `write(cb)` not called if `destroy()`:ed before `'connect'`[/+]on Dec 7, 2019 - addednetIssues and PRs related to the net subsystem.Issues and PRs related to the net subsystem.
on Dec 7, 2019 This is fixed
If the expectation is that callback is called this is not fixed.
const assert = require('assert'); const net = require('net'); const socket = new net.Socket(); socket.connect({ port: 80, host: 'example.com', lookup() {} }); assert(socket.connecting); let called = false; socket.write('foo', function() { called = true; }); socket.destroy(); process.on('exit', function() { assert(called); });
Reacted by Robert NagyYea, we should add a test for that.
This seems related to the whole
constructingstate which in this case never gets resolved, i.e._writenever finishes https://github.com/nodejs/node/blob/master/lib/net.js#L763. I can dig into this once/if #29656 lands.yes,
_writeGeneric()is never called as'connect'is never emitted.Reacted by Robert Nagypending resolution to discussion in #31179
'use strict'; const common = require('../common'); const assert = require('assert'); const net = require('net'); const socket = new net.Socket(); socket.connect({ port: 80, host: 'example.com', lookup() {} }); assert(socket.connecting); socket.write('foo', common.mustCall()); socket.destroy();
This requires #29656 in order to be fully resolved.
- addedconfirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.
on Apr 19, 2020
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.netIssues and PRs related to the net subsystem.Issues and PRs related to the net subsystem.
See #30839
_writeGenericwaits for'connect'node/lib/net.js
Line 759 in cf5ce2c
node/lib/net.js
Lines 1106 to 1108 in cf5ce2c
I believe this will fail: