petros

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

axelson

Scenic Core Team

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

kokolegorille

Hello and welcome,

I usually use double ctrl-c.

petros

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.

Where Next?

Popular in Questions Top

vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

Other popular topics Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54260 488
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

We're in Beta

About us Mission Statement