petros
Zombie phoenix server after quiting
Hi,
I quit phx.server using Ctrl+C and then a for Abort. This seems to leave the server process alive occupying port 4000. If I don’t kill the process, I can’t start the server again after that. I get the following error:
[error] Failed to start Ranch listener RumblWeb.Endpoint.HTTP in :ranch_tcp:listen([cacerts: :..., key: :..., cert: :..., port: 4000]) for reason :eaddrinuse (address already in use)
What am I doing wrong? Is there a better way to quit the server?
I am using macOS. Latest version of Erlang/Elixir/Phoenix.
Most Liked
axelson
Could the sockets be temporarily stuck in a TIME_WAIT state? Not sure if phoenix sets SO_REUSEADDR. Some background info: https://www.thecodingforums.com/threads/how-to-reuse-tcp-listening-socket-immediately-after-it-was-connectedat-least-once.685380/
kokolegorille
petros
Thanks @kokolegorille. I just noticed this is probably not caused by Abort. Both Ctrl+c + a and double Ctrl+c seem to work fine now.
I think something else causes the server to become a zombie. Maybe it has to do with quiting the terminal without quiting the server? Although I tried that now and it quit properly.
I dunno. I am sorry for the noise. I will come back and post the cause if I discover it.
Just to make this a bit more useful in case anyone runs into the problem itself, here is how I check for what’s listening to 4000:
lsof -i -P -n | grep LISTEN | grep 4000
If there’s a process (Phoenix) and I know I had quit phx.server, I can kill it with kill -9 PID.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









