Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto chmod/unlink when listening to domain socket #724

Closed
kyriosli opened this issue Feb 5, 2015 · 2 comments
Closed

Auto chmod/unlink when listening to domain socket #724

kyriosli opened this issue Feb 5, 2015 · 2 comments
Labels
net Issues and PRs related to the net subsystem.

Comments

@kyriosli
Copy link

kyriosli commented Feb 5, 2015

When using domain socket in net or http.createServer, I have to unlink it before service started and sometimes chmod to '777' after service started. Is it necessary to add option keys such as autoUnlink and chmod that do those jobs automatically?

require('net').createServer().listen({
  "path": "/var/run/app.sock",
  "autoUnlink": true, // boolean, default: false
  "chmod": "777" // string | number ( 0777 or, 0o777)
})
@vkurchatkin vkurchatkin added the net Issues and PRs related to the net subsystem. label Feb 5, 2015
@bnoordhuis
Copy link
Member

The reason neither options are supported right now is because of race conditions:

  • With chmod, there is a race window between the call to bind() and chmod().
  • With unlink(), the problem is that the socket may be shared with other processes and there is no 100% foolproof method of detecting whether it's safe to unlink (i.e. whether this process is the last process.)

Auto-unlink used to be the default but was removed because of issues with the cluster module.

@cjihrig
Copy link
Contributor

cjihrig commented Feb 15, 2015

Looks like this should be closed as won't fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
net Issues and PRs related to the net subsystem.
Projects
None yet
Development

No branches or pull requests

4 participants