Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

The net.js client does not release the socket on DNS errors #2688

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
3 participants

Which means that the socket stays there forever and the event loop waits for a connection that is not going to happen. The http.js client is patched against this behavior, but the issue lies within net.js.

A simple script to reproduce it:

var net = require('net');
var socket = net.connect(80, '.foo.bar', function () {
  console.log('connected');
  socket.destroy();
});
socket.on('error', function (err) {
  console.error(err);
});

The result is simple: the process hangs.

This small patch makes sure of that it is destroyed when the deferred error event is sent. Also added a specific test for this issue. I also corrected the http-dns-error error test that didn't test the https.js specifically because this bug.

+1 LGTM

Owner

bnoordhuis commented Feb 3, 2012

Thanks Stefan, merged in 4671e54 and 07a983a.

@bnoordhuis bnoordhuis closed this Feb 3, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment