node server is starting automatically and can't be killed - node.js

Environment
Windows 10 Pro
PATH setting:
C:\Program Files (x86)\nodejs\ (v0.10.13)
C:\Program Files\nodejs (v6.2.2)
node version global: v6.2.2
npm version : 3.9.5
Description
I installed node.js, and right after installation I got problem because nodejs starting background process taking port 8080 which must not be taken.
running command:
>netstat -ano | find "8080"
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 4428
running command:
>taskkill /IM "node.exe" /T /F
SUCCESS: The process with PID 6140 (child process of PID 4428) has been terminated.
SUCCESS: The process with PID 2916 (child process of PID 2776) has been terminated.
SUCCESS: The process with PID 10888 (child process of PID 2776) has been terminated.
SUCCESS: The process with PID 4428 (child process of PID 2556) has been terminated.
SUCCESS: The process with PID 2776 (child process of PID 2560) has been terminated.
>netstat -ano | find "8080"
But after some time server is started again:
>netstat -ano | find "8080"
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 11052
Looked up startup applications, services and scheduled tasks, found nothing containing node or npm.
Also found no info on this event in application logs of mmc console.
What part of windows system can cause startup of node server?
How can I change this default port for node server?
Also noticed that if i'll start some other process and bind it to 8080 right after killing node.exe processes, then node trying to: [start new process and connect to 8080]----{fail}---->[retry attempt].
Task manager displays 2 node.exe processes on port 8000 and 8080. Get request on those ports result in "Cannot get /". All processes of node pointing to C:\Program Files (x86)\nodejs\ (v0.10.13).
SOLVED
Don't know why exactly, but it seems that version v0.10.13 of node which (was installed along with aptana studio 3) has some sort of service, which wasn't easily visible in service list and which was causing the trouble. Removal of this old version of node removed server instances from processes.

Related

dev uncaught exception: listen EADDRINUSE: address already in use :::5000

I am getting the above error
[nodemon] starting `ts-node index.ts`
dev uncaught exception: listen EADDRINUSE: address already in use :::5000 +0ms
[nodemon] app crashed - waiting for file changes before starting...
I tried to find the pid with sudo lsof -i :5000
then kill -9
But then a new process pops up at the same port again. It keeps happening infinitely so I found the parent process with pid 1 and killed it and laptop restarted.
I am unable to run my node app on 5000. Any suggestions?
Edit: My repo is a node app at the root level and has a client folder which is the react app.

Is there a way to restore a killed process?

I'm trying to start httpd on my web server but when I try to start it, I was getting "httpd (pd 10989) already running", so I killed the process in hopes httpd might start up. No luck.
Now I am getting:
Starting HTTPD
(98)Address already in use: AH00072: make_sock: could not bind to
address [::]:9011
(98)Address already in use: AH00072: make_sock: could not bind to
address 0.0.0.0:9011
no listening sockets available, shutting down
AH00015: Unable to open logs
After I killed the process using:
kill -9 10989
Is there a way to restore this process?
Thanks for any help in advance!

sudo ./jetty Stop or Start Failure

The jetty on our linux server is not installed as a service as we have multiple jetty servers on different ports. And we use command./jetty.sh stop and ./jetty.sh start to stop and start jetty.
However, when I add sudo to the command, the server never stop/start successfully. When I run sudo ./jetty.sh stop, it shows
Stopping Jetty: start-stop-daemon: warning: failed to kill 18772: No such process
1 pids were not killed
No process in pidfile '/var/run/jetty.pid' found running; none killed.
and the server was not stopped.
When I run sudo ./jetty.sh start, it shows
Starting Jetty: FAILED Tue Apr 23 23:07:15 CST 2019
How could this happen? From my understanding. Using sudo gives you more power and privilege to run commands. If you can successfully execute without sudo, then the command should never fail with sudo, since it only grants superuser privilege.
As a user it uses $HOME.
As root it uses system paths.
The error you got ..
Stopping Jetty: start-stop-daemon: warning: failed to kill 18772: No such process
1 pids were not killed
No process in pidfile '/var/run/jetty.pid' found running; none killed.
... means that there was a bad pid file sitting around for a process that no longer exists.
Short answer, the processing is different if you are root (a service) vs a user (just an application).

Unable to stop Tomcat

I am very new to Tomcat and just configured my tomcat with jprofiler. But now unable to stop tomcat server, getting the following error message.
[root#localhost bin]# service tomcat stop
Stopping .
Using CATALINA_BASE: /data/applications/apache-tomcat-6.0.26
Using CATALINA_HOME: /data/applications/apache-tomcat-6.0.26
Using CATALINA_TMPDIR: /data/applications/apache-tomcat-6.0.26/temp
Using JRE_HOME: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0
Using CLASSPATH: /data/applications/apache-tomcat-6.0.26/bin/bootstrap.jar
JProfiler> Protocol version 35
JProfiler> Using JVMTI
JProfiler> JVMTI version 1.1 detected.
JProfiler> 32-bit library
JProfiler> Listening on port: 8849.
JProfiler> Instrumenting native methods.
JProfiler> Can retransform classes.
JProfiler> Can retransform any class.
JProfiler> Native library initialized
JProfiler> VM initialized
JProfiler> Waiting for a connection from the JProfiler GUI ...
JProfiler> ERROR: Could not bind socket.
\n\nTomcat has shutdown
I am not sure what is wrong in my configuration and yes firewall is disabled on the box.
[root#localhost bin]# service iptables status
Firewall is stopped.
In order to find tomcat PID run:
ps -ef | grep tomcat
then use this command:
kill -9 PID
Or in one command:
kill -9 $(ps -ef | grep tomcat | grep -v "grep" | awk '{print $2}')
Another thing, you might have a watchdog running that keeps bringing tomcat back up - in such case you'll want to turn off (or kill) the watchdog as well
You have inserted VM parameters for loading the JProfiler agent in your tomcat script. The JProfiler agent expects to be able to listen for incoming connections on a specific port (by default 8849). The port is already in use by the running Tomcat. When you start the tomcat script again, the initialization of the JVM fails because the profiling agent could not be initialized.
You would have to remove the JVM parameter -agentlib:[path to jprofilerti.dll] from your tomcat start script or make it conditional so that it is not applied for the "stop" command.
As per the Tomcat documentation, you can defined a PID file which is supposed to store the Process ID of Tomcat.
Create a shell script "setenv.sh" in Tomcat bin directory.
This file is referenced in catalina.sh, so it should have exactly the same name.
You can just have the tomcat pid information in "setenv.sh". Something like below..
#!/bin/bash
CATALINA_PID="$CATALINA_BASE/bin/catalina.pid"
With the above step, tomcat will look for a file named as "catalina.pid" in its bin directory. So just create it.
You're done. Just don't forget to stop tomcat with -force option.
./shutdown.sh -force
The force option tells tomcat to kill tomcat by PID, if it's not able to stop within given time.

Error initializing sockets: port=6000. Address already in use

I lunched a simulator program which developed on C++ in my Ubuntu 11 when i want kill this process from process list of Linux and want to run it again, i faced to this error:
Error initializing sockets: port=6000. Address already in use
I used lsof command to find PID of process:
saman#jack:~$ lsof -i:6000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
rcssserve 8764 saman 3u IPv4 81762 0t0 UDP *:x11
after that i tried to kill PID of 8764. but still it has error.
How can i fix it?
I think the problem you are having is that the socket if it is not shutdown correctly then it is still reserved and waiting for a timeout to be closed by the kernel.
Try doing a netstat -nutap and see if there's a line like this:
tcp 0 0 AAA.AAA.AAA.AAA:6000 XXX.XXX.XXX.XXX:YYYY TIME_WAIT -
if that's the case you just have to wait until the kernel drops it (30 secs approx) until you can open the socket at 6000 without conflict
It would seem that port 6000 is used by the X windowing system (the GUI part of linux) and is probably just restarted when you kill the process... either you'll need run the simulation without X-windows running, or you tweak the code to use a different port..

Resources