http-party / node-portfinder

A simple tool to find an open port or domain socket on the current machine
https://github.com/http-party/node-portfinder
Other
887 stars 95 forks source link

Wait until server is closed before invoking callback. #105

Closed sla89 closed 4 years ago

sla89 commented 4 years ago

Otherwise the port may be blocked because it is signaled to be free while server was not yet closed.

See bug #104

rathboma commented 4 years ago

This seems like a good change. I've seen this error materialize several times -- we test for an open port, then extablish a server to do ssh tunneling. There seem to be ephemeral errors, and this so I guess this is why

eriktrom commented 4 years ago

EDIT: (previous comments we're not clear in the direction I would consider taking this, I have replaced them below).

Here is what I would consider:

-- Reasoning:

1) We have no idea how this lib is being consumed - with 7+ million npm downloads a week, we don't want to break anything nor anyones expectations of its current behavior

2) Such a library, like portlocker™️, can then do one thing and do it well - handle the happens before ordering of async i/o scheduling. This would allow risk free iteration on current and future needs, anything from single threaded async i/o to multi (worker or process) async i/o could be explored. There has been some interest in this by others, in various forms, none of which are core to portfinder's original goals or intents, but which could easily consume portfinder and add such things.

If this proposal gains traction, I will consider. Provide a 👍, and I'll tally the priority and interest.

Keeps the comments light, but feel free to weigh in

eriktrom commented 4 years ago

closing to cleanup issue list, comments or questions still welcome, if needed

Consolidated via #99