DEV Community

Cover image for Putting an End to the Continuous Node Process Spawning on Port 3000: A Step-by-Step Fix
Paschal Kenechukwu Oruche
Paschal Kenechukwu Oruche

Posted on

Putting an End to the Continuous Node Process Spawning on Port 3000: A Step-by-Step Fix

In the world of software development, encountering unexpected issues and errors is all too common. Recently, I found myself in a frustrating predicament with a persistent problem: port 3000 continuously spawning a new Node process every time I attempted to terminate it. This issue arose while working on our sandbox server, specifically when I was containerizing the frontend application using Docker.

In this article, I will be sharing my journey of troubleshooting this problem, providing insights into the error messages encountered and the various attempts made to rectify the situation.

Join me as I delve into the steps taken to finally fix the persistent port 3000 issue and regain control over the process management.

So I SSHed into the server to containerize the frontend app on the Sandbox branch(SCM) using docker. The container will also utilize port 3000, and I only discovered this issue when I tried running the container.

The error message that kept coming was:

docker: Error response from daemon: driver failed programming external connectivity 
on endpoint chronicle-interface-sandbox 
(fc5d353d06147d84888ffa88ace289e767f7fecf6ce4890cacc6870618a3a07d): 
Error starting userland proxy: listen tcp4 0.0.0.0:300
Enter fullscreen mode Exit fullscreen mode

Also, when I run the command
npm run dev
on the public folder, it also gave the output below:

> dev 
> next dev -H 0.0.0.0 -p 3000  
Port 3000 is already in use.
Enter fullscreen mode Exit fullscreen mode

So, I tried the following ways to fix it,

Check the processes running the port 3000

lsof -i :3000

I Identified the process IDs and kill them,

kill <PID>

Each time I kill a process, another spins up with another ID.

I also tried to stop the Node.js process directly without needing the PID

pkill -f "node.*3000"

It still didn’t fix the issue.

The final thing I did was to restart the Azure VM, and this fixed it:

sudo shutdown -r now

Note: You can restart the server from the Azure portal as well, and once the server is back online, you will need to SSH into it again to access and continue your work.

Top comments (2)

Collapse
 
chuckwood profile image
Charles Wood

Was supervisor respawning the node process?

Collapse
 
oruchepaschal profile image
Paschal Kenechukwu Oruche

Not at all, Charles. I didn't install Supervisor on this VM.