yapapi icon indicating copy to clipboard operation
yapapi copied to clipboard

SocketProxy doesn't check if the port is already in use.

Open cryptobench opened this issue 1 year ago • 3 comments

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:

  1. Open two terminal instances.
  2. In each terminal, run the same SSH example provided in the Yapapi examples.
image

cryptobench avatar Jun 28 '23 12:06 cryptobench

Update

The error is printed after shutting down the script, which doesn't seem intended.

image

cryptobench avatar Jun 28 '23 13:06 cryptobench

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...

shadeofblue avatar Jun 28 '23 13:06 shadeofblue

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.

cryptobench avatar Jun 28 '23 13:06 cryptobench