Preliminary Findings on Localhost Port Mystery
Port 3000 is in use. Nothing visible is running on port 3000. Something is running on port 3000.
PRELIMINARY FINDINGS Subject: Port 3000 occupation by an unidentified process Status: Identified as identified
The Initial Error
The development server was started with the standard command. The command returned: EADDRINUSE port 3000.
Port 3000 is the expected port. Port 3000 is in use by something. The something is not visible in any open terminal window. No development server was believed to be running.
The Investigation
Command: lsof -i :3000
Output: a process with an ID of 47834, named 'node', started at some point on a previous day.
The process was started during a previous work session. The terminal window running it was closed. Closing the terminal window did not kill the process. The process continued running in the background without awareness.
The Process's Status
The process was running a development server for a project that had not been worked on for three days. The project's code had not changed. The server was running correctly on port 3000, serving nothing to nobody, for three days.
It had been doing this quietly. It had occupied a port. It had consumed a small amount of memory. It had not been asked to stop because nobody knew to ask.
The Resolution
The process was killed: kill -9 47834
Port 3000 was freed. The development server for the current project was started. The server came up correctly.
The Pattern
This will happen again. A terminal will be closed. A process will continue. A port will be occupied. The investigation will take approximately four minutes.
The resolution is: always stop servers before closing the terminal. This is known. The practice is inconsistent.