project-receptor / python-receptor

Project Receptor is a flexible multi-service relayer with remote execution and orchestration capabilities linking controllers with executors across a mesh of nodes.
Other
32 stars 21 forks source link

Receptor sometimes listens on random port #138

Closed Ichimonji10 closed 4 years ago

Ichimonji10 commented 4 years ago

If receptor is started and no --listen flag is passed, it will listen on *:8888. However, if told to listen on receptor://127.0.0.1, then it will listen on a random port. This behaviour is inconsistent, and at odds with receptor's documented default of listening on port 8888.

--listen absent:

$ poetry run receptor --data-dir="$(mktemp --directory)" node
$ lsof -Pnp 12264 | grep LISTEN
python  12264 ichimonji10    6u     IPv4             254934      0t0      TCP *:8888 (LISTEN)

--listen present:

$ poetry run receptor --data-dir="$(mktemp --directory)" node --listen='receptor://127.0.0.1'
$ lsof -Pnp 11713 | grep LISTEN
python  11713 ichimonji10    6u     IPv4             258329      0t0      TCP 127.0.0.1:39235 (LISTEN)
matburt commented 4 years ago

It looks like it picks a random unassigned port to listen on, which is probably not what you want to happen here.

Ichimonji10 commented 4 years ago

My concerns are:

Randomly picking a port could be fine (I'd appreciate that functionality when writing automated tests!), but that should be done deliberately.

ghjm commented 4 years ago

@Ichimonji10 This is fixed. It now listens on predictable default ports if you don't specify a port.

Ichimonji10 commented 4 years ago

Fixed.

$ poetry run receptor --data-dir="$(mktemp --directory)" node
$ lsof -Pnp 11807 | grep LISTEN
python  11807 ichimonji10    6u     IPv4            1048528      0t0      TCP *:8888 (LISTEN)
$ poetry run receptor --data-dir="$(mktemp --directory)" node --listen='receptor://127.0.0.1'
$ lsof -Pnp 11900 | grep LISTEN
python  11900 ichimonji10    6u     IPv4            1055054      0t0      TCP 127.0.0.1:8888 (LISTEN)