Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Accessing remoteAddress or remotePort properties immediately after remote connection failure throws #3455

@reid

Description

@reid

Consider the following code:

var assert = require('assert');
var net = require('net');
var server = net.createServer();
server.listen(function () {
  var client = net.createConnection(server.address().port);
  // server's connect event has not yet fired
  server.close();
  assert.doesNotThrow(function() {
    client.remoteAddress;
    client.remotePort;
  });
  process.exit(0);
});

Accessing either client.remoteAddress or client.remotePort will throw from net.js. I have noticed this crash with SockJS immediately after I kill a connected browser sending lots of data over a WebSocket.

I'm working on a patch with a new test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions