luckyframework / luckyframework/lucky_cli

Lucky dev/watch can not bind to port on Linux

Open
#705 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
92
Forks
48
PR merge metrics
No merged PRs in 30d

Description

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 ???
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/app_server.cr and src/start_server.cr, then compare the Crystal socket and HTTP server frames in the reported Linux stack trace. Reproduce with lucky dev or lucky watch on an unused port such as 5000; done means the command binds successfully when the port is free.

Written by the indexing model from the issue text.

Assessment

Tech stack
crystal
Domain
cli, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.