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

Lucky dev/watch can not bind to port on Linux #705

Open
mraffonso opened this issue Dec 3, 2021 · 2 comments
Open

Lucky dev/watch can not bind to port on Linux #705

mraffonso opened this issue Dec 3, 2021 · 2 comments
Labels

Comments

@mraffonso
Copy link

After updating from v0.28 to v0.29 lucky watch and lucky dev can not bind to port 5000 even though the port is not in use.

I used lsof to verify that the port is not in use.

sudo lsof -i:5000

The error:

Unhandled exception: Could not bind to '127.0.0.1:5000': Address already in use (Socket::BindError)
  from /home/mario/.anyenv/envs/crenv/versions/1.2.1/share/crystal/src/socket/addrinfo.cr:74:17 in 'initialize:reuse_port'
  from /home/mario/.anyenv/envs/crenv/versions/1.2.1/share/crystal/src/socket/tcp_server.cr:32:3 in 'new:reuse_port'
  from /home/mario/.anyenv/envs/crenv/versions/1.2.1/share/crystal/src/http/server.cr:211:5 in 'bind_tcp'
  from /home/mario/.anyenv/envs/crenv/versions/1.2.1/share/crystal/src/http/server.cr:441:5 in 'listen'
  from src/app_server.cr:29:5 in 'listen'
  from src/start_server.cr:16:1 in '__crystal_main'
  from /home/mario/.anyenv/envs/crenv/versions/1.2.1/share/crystal/src/crystal/main.cr:110:5 in 'main_user_code'
  from /home/mario/.anyenv/envs/crenv/versions/1.2.1/share/crystal/src/crystal/main.cr:96:7 in 'main'
  from /home/mario/.anyenv/envs/crenv/versions/1.2.1/share/crystal/src/crystal/main.cr:119:3 in 'main'
  from __libc_start_main
  from _start
  from ???
@mraffonso
Copy link
Author

The current work around is to change the following line in src/app_server.cr.

server.listen(host, port, reuse_port: false)

to:

server.listen

@jwoertink jwoertink added the bug label Dec 3, 2021
@skojin
Copy link
Contributor

skojin commented Dec 4, 2021

I just updated to 0.29 and not have this issue on my vagrant with ubuntu-20.04

I use forego for Procfile
Crystal 1.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants