Skip to content

docs clarification #1080

Description

@boneskull
  • Node.js Version: 9.4.0
  • OS: macos
  • Scope (install, code, runtime, meta, other?): docs
  • Module (and version) (if relevant): net

I'm checking out the documentation on IPC connections, but the wording is unclear to me.

It says (basically) that a named pipe in UNIX "persist until unlinked". This seems to imply that one must manually unlink when finished using it. This is untrue, because calling close() on the Server object will apparently do so for you (?).

In Windows, it claims pipes will "not persist", and are removed "when the last reference to them is closed". How exactly does this differ from the UNIX behavior? Does it have something to do with garbage collection, or the socket object falling out of scope...?

Thanks!

Activity

  1. gireeshpunathil commented on Jan 26, 2018

    @gireeshpunathil
    Member

    persist until unlinked is true, and this unlinking is performed on server close. So you are right, there is an ambiguity in this section in terms of who unlinks the pipe. Would you be interested in improving it through a PR?

    I am not sure how exactly the windows (external) behavior is different from UNIX,
    /cc @nodejs/platform-windows

  2. gireeshpunathil commented on Mar 20, 2018

    @gireeshpunathil
    Member

    @boneskull - a PR in progress to address your concerns.

    Does it have something to do with garbage collection, or the socket object falling out of scope...?

    I did the below check and determined that the collection is done by the operating system, not Node.js . As you can see, the named pipe is removed when the program is abruptly terminated. This is different from UNIX where the DOMAIN socket persists on such abrupt termination. So the reference count is maintained by Windows.

    var net = require('net')
    const p= '\\\\.\\pipe\\test.sock'
      console.log(p)
    var k = net.createServer((s) => {
      s.end('hello!')
    }).listen(p, () => {
      var socket = net.connect(p)
      socket.on('data', (d) => {
        // k.close()
      })
    })
    $ node 1080.js
    \\.\pipe\test.sock
    ^C  // kill abruptly
    $
    

    from the powershell:

    PS> [System.IO.Directory]::GetFiles("\\.\\pipe\\") | grep test
    \\.\\pipe\\test.sock
    PS> [System.IO.Directory]::GetFiles("\\.\\pipe\\") | grep test
    PS>
    

    Hoep this helps!

  3. gireeshpunathil commented on Mar 29, 2018

    @gireeshpunathil
    Member

    @boneskull - have a look at the PR and see if you believe the changes meets your expected clarity and coverage.

  4. gireeshpunathil commented on Apr 6, 2018

    @gireeshpunathil
    Member

    closing as addressed.

  5. added a commit that references this issue on Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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