lucky_cli
lucky_cli copied to clipboard
Lucky dev/watch can not bind to port on Linux
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 ???
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
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