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.

net: unref() is not persistent #7077

Closed
Closed

Description

@bnoordhuis
var net = require('net');
var server = net.createServer();
server.unref();
server.listen();
net.connect(server.address().port).unref();

It hangs because of the unref() that comes before listen() and the one after connect(). In that vein:

require('net').connect(42).unref();

It fails with ECONNREFUSED because the unref() is a no-op. The expected behavior for both scripts is that they simply quit. Affects v0.10 and master.

The documentation doesn't mention when it's okay to call unref(). For the sake of user friendliness, net.Socket and net.Server should remember the ref state and retroactively apply it when the handle is created. Probably applies to other handle types as well.

Activity

  1. self-assigned this
    on Feb 19, 2014
  2. added this to the v0.10 milestone on Feb 19, 2014
  3. tjfontaine commented on Feb 19, 2014

    @tjfontaine

    Right this is definitely a bug that should be squashed. Assigned to me.

  4. cjihrig commented on May 19, 2015

    @cjihrig

    nodejs/node@85d9983 just landed. It can either be ported, or we can close this and pick up the changes in the converged branch.

  5. removed their assignment
    on Dec 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions