Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If specified port is already taken, the app dies #22

Closed
bbtgnn opened this issue Dec 5, 2023 · 12 comments · Fixed by #186
Closed

If specified port is already taken, the app dies #22

bbtgnn opened this issue Dec 5, 2023 · 12 comments · Fixed by #186
Assignees

Comments

@bbtgnn
Copy link
Contributor

bbtgnn commented Dec 5, 2023

Add a human readable error to explain what's happening

@bbtgnn
Copy link
Contributor Author

bbtgnn commented Dec 6, 2023

I'm having issues trying to reproduce the issue.

I launched:

  • a server with python -m http.server 8000 --bind 0.0.0.0
  • ncr with pnpm dev -p 8000 --hostname 0.0.0.0

But I don't get any errors. @puria do you have any ideas?

@puria
Copy link
Member

puria commented Dec 6, 2023

No idea... then maybe should be something else... are you stil able to reproduce it by playing with the PORT variable in the .env file?

@puria
Copy link
Member

puria commented Dec 6, 2023

OK! Yes I can do that also when you don't have permission to open the port... like use a port under 300...

@bbtgnn
Copy link
Contributor Author

bbtgnn commented Dec 6, 2023

I tried to open it on port 200, but the application still works

@puria
Copy link
Member

puria commented Dec 6, 2023

prova con la 80... a milano c'è il 🌞

@bbtgnn
Copy link
Contributor Author

bbtgnn commented Dec 6, 2023

Non si rompe eheh

@puria
Copy link
Member

puria commented Dec 6, 2023

È una bomba, l'ho sempre saputo! have you tried both from the .env and from the cli arguments?

@bbtgnn
Copy link
Contributor Author

bbtgnn commented Dec 6, 2023

yuppp

@bbtgnn
Copy link
Contributor Author

bbtgnn commented Dec 12, 2023

It seems to fail only when docker has taken the port.

The line of code responsible for the fail is this one:

const port = us_socket_local_port(socket);

I tried putting it in a try catch, but it doesn't catch – it just dies there.
@puria how should we address this? we should check the port before this point?

@puria
Copy link
Member

puria commented Dec 12, 2023

@bbtgnn I guess that the environment variable PORT is clashing, plz rename all the variables to have more specific names eg. NCR_PORT

@bbtgnn
Copy link
Contributor Author

bbtgnn commented Dec 12, 2023 via email

@puria
Copy link
Member

puria commented Mar 12, 2024

The point is that docker uses the same env vriable that we use... namely: PORT
so docker and ncr both try to rear the same var... if you change it to PORT_NCR or something different that should be safer. If you try it and is not yet an issue, we can close this!

@matteo-cristino matteo-cristino linked a pull request May 31, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants