cli
cli copied to clipboard
confusing behaviour when both auspice & nextstrain view are running
If nextstrain view
is running & using the default port 4000
, then running auspice view
, which also uses port 4000
, produces confusing behavior. It doesn't matter which command is run first.
What happens:
On MacOS, but not Linux, No error / warning is displayed relating to multiple processes using the same port, and views of http://localhost:4000/ will always connect to the nextstrain view
process. Unknown what happens on windows.
Expected result:
(1) nextstrain view
should display an error similar to if multiple auspice view
commands are run:
[error] Port 4000 is currently in use by another program.
You must either close that program or specify a different port by setting the shell variable
"$PORT". Note that on MacOS / Linux, "lsof -n -i :4000 | grep LISTEN" should
identify the process currently using the port.
(2) auspice should detect that port 4000 is in use (by nextstrain view
) just as it does if the port was opened by a different auspice view
command. Perhaps this is a fix in auspice?
I believe this is due to the way Docker implements host → container port mappings on macOS with network redirection rules instead of opening a host port and ferrying data through it. The issue does not appear on Linux, as Docker attempts to open the host port directly and fails if it is in use.
Hello @jameshadfield @tsibley ,
I've tried to reproduce but didn't manage to:
WHEN nextstrain view
THEN auspice view
:
[verbose] Serving index / favicon etc from "/Users/bordel/development/ncov/nextstrain/auspice"
[verbose] Serving built javascript from "/Users/bordel/development/ncov/nextstrain/auspice/dist"
[error] Port 4000 is currently in use by another program.
You must either close that program or specify a different port by setting the shell variable
"$PORT". Note that on MacOS / Linux, "lsof -n -i :4000 | grep LISTEN" should
identify the process currently using the port.
WHEN auspice view
THEN nextstrain view
:
docker: Error response from daemon: Ports are not available: listen tcp 127.0.0.1:4000: bind: address already in use.
ERRO[0000] error waiting for container: context canceled
Could you try again and let me know if this still an issue?
Thanks
Thanks for looking into this @jstoja. I don't have a Mac so can't test directly, but @jameshadfield should be able to. It's definitely possible that Docker on macOS has switched to binding host ports directly, thus solving the issue for us. :-)
I'll try to test this when I have time, as it seems from the comments that different docker versions may behave differently. Note that this issue actually arose on someone else's machine (MacOS tho). It may have already been solved by docker changing, which would be great! (If not, it's very low priority.)
It's definitely possible that Docker on macOS has switched to binding host ports directly, thus solving the issue for us. :-)
Without doubt. I just cannot reproduce today, so either it's fixed, or I'm missing something.
It may have already been solved by docker changing, which would be great! (If not, it's very low priority.)
Definitely :) I just wanted to close tickets that seemed solved.