yapapi
yapapi copied to clipboard
SocketProxy doesn't check if the port is already in use.
Issue
While progressing with the development of the Golem portal, we stumbled upon an unexpected issue related to Socketproxy's port allocation.
We found that Yapapi permits the allocation of the same port to two instances of an identical script, without issuing any warning or error message. The lack of notification or exception on Yapapi's part was surprising, considering our expectation that it would raise some sort of alert in such situation.
Steps to Replicate:
- Open two terminal instances.
- In each terminal, run the same SSH example provided in the Yapapi examples.
Update
The error is printed after shutting down the script, which doesn't seem intended.
in this case, it's not really a problem with the library itself but with the code that starts the proxy - we'll update the example but you'd be responsible for updating the script you're using the SocketProxy in...
in this case, it's not really a problem with the library itself but with the code that starts the proxy - we'll update the example but you'd be responsible for updating the script you're using the SocketProxy in...
Wouldn't it make more sense to hide away this check from the examples and instead put it inside the internals of yapapi as a type of Exception?
I would personally refrain from us having to add extra code in the examples to check if its in use or not. It's extra "bloat" for the eyes of new users, which could be hidden away.