nickdesaulniers / node-nanomsg

Node.js binding for nanomsg
MIT License
402 stars 70 forks source link

socket.close() does not remove socket file for IPC #191

Closed ghost closed 6 years ago

ghost commented 6 years ago

Example:

const nn = require('nanomsg');
const push = nn.socket('push');

push.bind('ipc:///tmp/server.ipc');

process.on('SIGINT', () => {
    console.log(push.close());
    process.exit();
});

Run node test.js and press Ctrl + c. push.close() return 0 but /tmp/server.ipc is not deleted and re-run I cant't.

node: 8.9.3 node-nanomsg: 4.0.0 OS X 10.13.1

nickdesaulniers commented 6 years ago

What happens if you bind then immediately close without waiting for sigint?

ghost commented 6 years ago

Same.

const nn = require('nanomsg');
const push = nn.socket('push');

push.bind('ipc:///tmp/server.ipc');
console.log(push.close())

First run returned 0 Second run throw error Error: Address already in use

I check this case on Centos 7 and it is the same behavior.