I can no longer access my node.js application. I see thee following behaviours.
1> netstat shows the server listening on the port I expect it to.
2> tcpdump shows traffic from my laptop on the server when I attempt to open the page.
3> When I try to kill the node process with kill -9 or pkill node nothing happens.
I see the pid for the node process is changing continuously as if it was constantly being restarted. I see posts similar to this but none of them have definitive answers.
I have stopped and started the node site as we all restarting the host. Which I don't like doing as a problem resolution as you don't really know what the underlying problem is.
I also don't see an error log for node.
Any advice or guidance on how to determine what the problem is would be appreciated.
Related
I'm trying to learn Appium but I'm already stuck in the beginning.
When I try to start Appium using the terminal I get an error message that looks like this:
Could not start REST http interface listener. The requested port may already be in use. Please make sure there is no other instance of this server running already.
Fatal Error: listen EADDRINUSE: address already in use 0.0.0.0:4723
So I tried to find out what instance is using that port using the statement lsof -i :4723
I found out there is a running node instance that uses this port so I tried to kill the instance with kill -9 PID . After I killed the instance I used lsof -i :4723 again to see if it worked but the node instance was still there but with a new PID. I guess the kill was successful but node just immediately starts a new instance and occupies the port 4237.
Is there anyone who might have an idea what I can try or maybe knows a solution to this problem?
I found a small workaround which works for now but shouldn't be final. When I use kill -9 PID | appium it works because Appium occupies the port immediately after kill got executed.
Thanks for your help in advance
Try running appium on different port appium -p 4725
The error shown with it, no idea to fix this. can someone help?
I am new with this thing.
The error is really clear. The errorcode EADDRINUSE shows that the port you are using for your NodeJS application already is in use. Therefore your NodeJS application can't connect to this port anymore. Close all applications that is using that port or use a port that is not in use.
I see that you are using Nodemon. It's possible that your nodemon process hang. This can be the result of unexpected close of the terminal or errors in your application.
Check all running nodemon processes by using the command:
ps -ef | grep node
And kill the process by using:
sudo kill -9 <PID>
https://yarnpkg.com/en/docs/cli/
Is there a way to stop what is started from the command "yarn run"? Is my only option to lookup the process number and call kill on it?
The usual way ctrl-c should work. If it doesn't work, than you have bug in the script. The script's author missed handler for shutdown (SIGINT/SIGTERM/etc).
I had a similar issue having it running after ctl+c and then I thought, maybe it is just running on the cache
so went to http://localhost:3000/
ctrl+F5
which forces refresh without cache showed me that the actual project wasn't really running anymore!
;)
*hadn't it worked I would have had to sudo kill the 3000 port
I know this is a well-answered question. However, it behaved once very strange when I was running a sample React code which was auto-created by the create-react-app CLI, on my Windows 10.
After hitting Ctrl+C, which is the most suggested standard way to stop the yarn run, though I got back the command prompt, there was a ghost process lingering around there, which was still actively listening to 3000(default) port, and localhost:3000 was working as normal.
So finally this is how I fixed it:
netstat -ano | grep ":3000" (yeah, I ran this from my git-bash instead of command prompt!)
Noted down the PID of the line where it says LISTENING on 3000
Pressed Ctrl+Shift+Esc to open the Task Manager
Went to the Process tab
Right clicked on one of the headings, say Name
Selected PID --> This added the PID column to the display
Located the PID in question
Right clicked on it and clicked "End task"
Luckily Windows knew how to kill that misbehaving, ghost process and the port became free for me.
NOTE: Prior to the above-mentioned steps, I tried to kill that PID from git-bash using the famous (or notorious as per its meaning?? >8)) kill -9 command. It was responding back with no such PID msg, however netstat -ano was clearly displaying the PID and browser was proving that the ghost process is up and alive!!
I am following the directions here: https://github.com/node-inspector/node-inspector
Pretty simple. npm install node-inspector. In one shell run node-inspector and in another run node --debug app.js. Shell spits out an localhost address with specific port for the debugger. Open that address in a browser — it loads your code. From there add breakpoints, debug network, etc..
But this does not work.
The following message endlessly logs in my shell:
Failed to open socket on port 5858, waiting 1000 ms before retrying
..and no connection is made.
So my question is has anyone had this problem and successfully found a solution. Would love to get this working, would be super useful. My only experience in server-side debuggers is Ruby's Byebug which was a piece of cake to set up.
The message you see is printed because there is another process listening on port 5858. Either a different application, or simply another instance of a node process under the debugger.
An update based on comments below this answer
If your application is running in a cluster mode via Node.js core module "cluster", then you end up with multiple worker processes, where each of them is trying to listen on port 5858.
Node Inspector cannot debug multiple worker processes at the same time. You have to pick one process and enable the debugger in that process only. When you start the app via node --debug, all processes try to enable the debugger, therefore you cannot use this command.
Instead, you have to:
Start your app without the debugger enabled.
Then you need to find the pid (process id) of the worker process you would like to debug.
Once you have the PID, you need to enable the debugger in the target process. You can run kill -1 <pid> on UNIX, or use node debug -p <pid> that works on all platforms. Don't forget to exit node debug before proceeding further.
Once the target process has debugger listening on 5858, you can start Node Inspector the usual way.
My answer is based on the following blog post: https://strongloop.com/strongblog/whats-new-nodejs-v0-12-debugging-clusters/, check it out for more details.
I am using Neo4j 2.0.3 Community server by installing it on my linux system (by unzipping the tar.gz). I got this error while I tried to start the server
WARNING! You are using an unsupported Java runtime.
process [50690]... waiting for server to be ready.neo4j-community-2.0.3/bin/neo4j: line 147: lsof : command not found
.neo4j-community-2.0.3/bin/neo4j: line 147: lsof : command not found
.neo4j-community-2.0.3/bin/neo4j: line 147: lsof : command not found
. Failed to start within 120 seconds.
Neo4j Server may have failed to start, please check the logs.
I checked for the solution for this and came to know that /usr/sbin had to be added to the path. On doing so and restarting the server, I got the following message
Another server-process is running with [40903], cannot start a new one. Exiting.
However, when I run the command neo4j staus , it says
Neo4j Server is not running
Can anybody please help me with how should I get started with it?
This is very late, but might help others.
If it tells you this, and you check that process id with, for example, ps aux | grep 40903, and it's not neo4j, the problem might be that the port is being used.
By default neo4j uses 7474, but can change this on the neo4j folder /conf/neo4j-server.properties and that was my problem, I had set the port to '22' which was being used. SO make sure it is set to a port that is open and available.
Hope this helps.
You might want to examine the startup script.
Another server-process is running with [40903], cannot start a new one. Exiting.
indicates (me to) that there might be a pid file (or the script uses them) which was written and is checked before attempting to start a new instances. This the normal thing to do.
I think you need to kill the other process using kill
You can see this answer for how to kill the process:
https://unix.stackexchange.com/questions/8916/when-should-i-not-kill-9-a-process
Otherwise, restarting the operating system will also do the job. For me, I normally start neo4j in the console, as in ./neo4j console. This makes it easier to stop the process.