I've been having this issue for a while and I can't seem to find the root cause. I have done a fresh reinstall of node and npm (with nvm) but to no luck I still face the same problems.
When I run npm start on my create-react-app repo I always receive Something is already running on port <port> but it doesn't actually appear to be a port in use. In this case the port is 5056.
When running sudo lsof -i -n -P | grep TCP from this question: Who is listening on a given TCP port on Mac OS X? I get the following:
CrashPlan 48 root 71u IPv6 0x2c25a5583eff58c1 0t0 TCP 127.0.0.1:4244 (LISTEN)
CrashPlan 48 root 85u IPv6 0x2c25a5583eff3c01 0t0 TCP 127.0.0.1:4244->127.0.0.1:61721 (FIN_WAIT_2)
CrashPlan 48 root 86u IPv6 0x2c25a5583eff41c1 0t0 TCP 127.0.0.1:4244->127.0.0.1:53768 (ESTABLISHED)
vpnagentd 55 root 5u IPv4 0x2c25a5583d8b2181 0t0 TCP 127.0.0.1:29754 (LISTEN)
ciscod 58 root 3u IPv4 0x2c25a5583d8b2b01 0t0 TCP 127.0.0.1:1023 (LISTEN)
apsd 91 root 13u IPv4 0x2c25a55862e8cb01 0t0 TCP 9.240.44.255:60294->17.249.12.152:5223 (ESTABLISHED)
apsd 91 root 15u IPv4 0x2c25a55862e8cb01 0t0 TCP 9.240.44.255:60294->17.249.12.152:5223 (ESTABLISHED)
rapportd 462 myusername 3u IPv4 0x2c25a5586329f481 0t0 TCP *:60276 (LISTEN)
rapportd 462 myusername 4u IPv6 0x2c25a55861ba8301 0t0 TCP *:60276 (LISTEN)
identitys 466 myusername 32u IPv6 0x2c25a5583eff5301 0t0 TCP [fe80:c::992:b67a:e838:6f09]:1024->[fe80:c::d5c2:7935:1b0d:c90f]:1024 (ESTABLISHED)
identitys 466 myusername 33u IPv6 0x2c25a5583eff5301 0t0 TCP [fe80:c::992:b67a:e838:6f09]:1024->[fe80:c::d5c2:7935:1b0d:c90f]:1024 (ESTABLISHED)
identitys 466 myusername 34u IPv6 0x2c25a5583eff2ac1 0t0 TCP [fe80:c::992:b67a:e838:6f09]:1025->[fe80:c::d5c2:7935:1b0d:c90f]:9304 (ESTABLISHED)
identitys 466 myusername 35u IPv6 0x2c25a5583eff2ac1 0t0 TCP [fe80:c::992:b67a:e838:6f09]:1025->[fe80:c::d5c2:7935:1b0d:c90f]:9304 (ESTABLISHED)
expressvp 805 root 11u IPv4 0x2c25a55847c2d481 0t0 TCP 127.0.0.1:2015 (LISTEN)
expressvp 805 root 12u IPv4 0x2c25a5586031d481 0t0 TCP 9.240.44.255:61661->3.212.116.79:443 (CLOSE_WAIT)
expressvp 805 root 16u IPv4 0x2c25a55868fb3b01 0t0 TCP 9.240.44.255:61662->3.212.116.79:443 (CLOSE_WAIT)
CrashPlan 814 myusername 51u IPv4 0x2c25a5584b21c181 0t0 TCP 127.0.0.1:53768->127.0.0.1:4244 (ESTABLISHED)
CrashPlan 814 myusername 53u IPv4 0x2c25a558807adb01 0t0 TCP 127.0.0.1:61721->127.0.0.1:4244 (CLOSE_WAIT)
Postman 22459 myusername 59u IPv4 0x2c25a55862309801 0t0 TCP 9.240.44.255:60336->34.224.76.239:443 (CLOSED)
Postman 22459 myusername 73u IPv4 0x2c25a5586031c181 0t0 TCP 9.240.44.255:60337->34.224.76.239:443 (ESTABLISHED)
Discord 36658 myusername 59u IPv4 0x2c25a5583d8b0e81 0t0 TCP 9.240.44.255:60423->104.16.60.37:443 (ESTABLISHED)
Discord 36658 myusername 67u IPv4 0x2c25a558807ae481 0t0 TCP 9.240.44.255:61654->104.16.59.5:443 (ESTABLISHED)
Discord 36658 myusername 97u IPv4 0x2c25a55857e86181 0t0 TCP 9.240.44.255:60359->35.186.224.47:443 (ESTABLISHED)
Discord 36664 myusername 49u IPv4 0x2c25a5586ce46b01 0t0 TCP 127.0.0.1:6463 (LISTEN)
Slack 51840 myusername 73u IPv4 0x2c25a5586329ce81 0t0 TCP 9.240.44.255:60383->52.37.243.173:443 (ESTABLISHED)
Slack 51840 myusername 112u IPv4 0x2c25a5586329d801 0t0 TCP 9.240.44.255:60333->52.37.243.173:443 (ESTABLISHED)
Slack 51840 myusername 117u IPv4 0x2c25a55847c2ae81 0t0 TCP 9.240.44.255:60339->52.37.243.173:443 (ESTABLISHED)
Slack 51840 myusername 118u IPv4 0x2c25a5586914a181 0t0 TCP 9.240.44.255:60338->52.37.243.173:443 (ESTABLISHED)
Slack 51840 myusername 119u IPv4 0x2c25a55854de1481 0t0 TCP 9.240.44.255:60342->52.37.243.173:443 (ESTABLISHED)
firefox 76426 myusername 95u IPv4 0x2c25a55858abae81 0t0 TCP 9.240.44.255:60326->34.209.103.65:443 (ESTABLISHED)
firefox 76426 myusername 120u IPv4 0x2c25a55857e87481 0t0 TCP 9.240.44.255:60361->159.203.171.189:443 (ESTABLISHED)
Google 76844 myusername 30u IPv4 0x2c25a558807f0481 0t0 TCP 9.240.44.255:61632->104.16.28.34:443 (ESTABLISHED)
Google 76844 myusername 35u IPv4 0x2c25a558807c7481 0t0 TCP 9.240.44.255:60837->159.203.171.189:443 (ESTABLISHED)
Google 76844 myusername 36u IPv4 0x2c25a5588079a181 0t0 TCP 9.240.44.255:61218->192.30.253.125:443 (ESTABLISHED)
Google 76844 myusername 38u IPv4 0x2c25a5587a432481 0t0 TCP 9.240.44.255:61724->52.207.60.84:443 (ESTABLISHED)
Google 76844 myusername 41u IPv4 0x2c25a55880798e81 0t0 TCP 9.240.44.255:61728->192.184.69.195:443 (ESTABLISHED)
Google 76844 myusername 44u IPv4 0x2c25a5586167c801 0t0 TCP 9.240.44.255:61651->162.247.242.21:443 (ESTABLISHED)
Google 76844 myusername 46u IPv4 0x2c25a5583d8b1801 0t0 TCP 9.240.44.255:60305->165.160.13.20:80 (CLOSED)
Google 76844 myusername 50u IPv4 0x2c25a55863665481 0t0 TCP 9.240.44.255:61726->52.207.32.1:443 (ESTABLISHED)
Google 76844 myusername 60u IPv4 0x2c25a55868fb4481 0t0 TCP 9.240.44.255:60306->165.160.13.20:80 (CLOSED)
Google 76844 myusername 63u IPv4 0x2c25a55863662e81 0t0 TCP 9.240.44.255:60308->165.160.15.20:80 (ESTABLISHED)
Google 76844 myusername 64u IPv4 0x2c25a5586031ae81 0t0 TCP 9.240.44.255:60309->165.160.13.20:80 (ESTABLISHED)
Google 76844 myusername 66u IPv4 0x2c25a5586329eb01 0t0 TCP 9.240.44.255:60310->165.160.13.20:80 (ESTABLISHED)
Google 76844 myusername 69u IPv4 0x2c25a5586f554481 0t0 TCP 9.240.44.255:61646->23.222.172.234:443 (ESTABLISHED)
Google 76844 myusername 74u IPv4 0x2c25a5588085e481 0t0 TCP 9.240.44.255:61647->23.222.172.234:443 (ESTABLISHED)
Google 76844 myusername 77u IPv4 0x2c25a5588085be81 0t0 TCP 9.240.44.255:61706->198.252.206.25:443 (ESTABLISHED)
Google 76844 myusername 79u IPv4 0x2c25a558807c6b01 0t0 TCP 9.240.44.255:61729->198.252.206.25:443 (ESTABLISHED)
Google 76844 myusername 81u IPv4 0x2c25a558807c6181 0t0 TCP 9.240.44.255:61629->151.101.1.69:443 (ESTABLISHED)
Google 76844 myusername 85u IPv4 0x2c25a55880792b01 0t0 TCP 9.240.44.255:61712->198.252.206.25:443 (ESTABLISHED)
Google 76844 myusername 86u IPv4 0x2c25a558807d9481 0t0 TCP 9.240.44.255:61727->52.207.32.1:443 (ESTABLISHED)
Google 76844 myusername 93u IPv4 0x2c25a558807b1e81 0t0 TCP 9.240.44.255:61630->192.0.73.2:443 (ESTABLISHED)
Google 76844 myusername 100u IPv4 0x2c25a55863664181 0t0 TCP 9.240.44.255:61634->184.30.231.203:443 (ESTABLISHED)
Google 76844 myusername 114u IPv4 0x2c25a55880791801 0t0 TCP 9.240.44.255:61522->151.101.41.140:443 (ESTABLISHED)
Google 76844 myusername 123u IPv4 0x2c25a55853feab01 0t0 TCP 9.240.44.255:61544->104.244.42.200:443 (ESTABLISHED)
Google 76844 myusername 146u IPv4 0x2c25a5586172e181 0t0 TCP 9.240.44.255:61584->151.101.40.84:443 (ESTABLISHED)
Spotify 92621 myusername 69u IPv4 0x2c25a5588085db01 0t0 TCP *:61682 (LISTEN)
Spotify 92621 myusername 71u IPv4 0x2c25a55847c2b801 0t0 TCP *:57621 (LISTEN)
Spotify 92621 myusername 79u IPv4 0x2c25a5584b21b801 0t0 TCP 9.240.44.255:60556->104.199.65.177:4070 (ESTABLISHED)
Spotify 92621 myusername 112u IPv4 0x2c25a5586167d181 0t0 TCP 9.240.44.255:60562->35.186.224.53:443 (ESTABLISHED)
Spotify 92621 myusername 139u IPv4 0x2c25a55858abb801 0t0 TCP 9.240.44.255:60566->151.101.40.246:443 (CLOSED)
Spotify 92621 myusername 140u IPv4 0x2c25a55858abcb01 0t0 TCP 9.240.44.255:60567->151.101.40.246:443 (CLOSED)
Spotify 92621 myusername 141u IPv4 0x2c25a55858abd481 0t0 TCP 9.240.44.255:60568->151.101.40.246:443 (CLOSED)
I can't seem to find any use of the port and I am stuck trying to find a reason for this issue. If I force the port onto 5056 by modifying the scripts/start.js file it does load as expected, but there are then issues proxying requests so none of my state data loads from the mock API. This is also the case if I choose to run the app on another port.
I get an ETIMEDOUT error saying it failed to proxy the request.
If any one has any ideas as to what could be the cause of the issue then I'd be incredibly grateful. It's probably worth mentioning others are able to run the same repository as expected without any of the aforementioned issues.
EDIT:
When running lsof -i:5056 nothing is returned.
Running lsof -n -i4TCP:3000 | grep LISTEN also returns nothing.
Running the latest XCode update seems to have fixed the issue...
This might be helpful: http://johnharbison.net/something-is-already-running-on-port-3000-mac
Check if your localhost is configured correctly in /etc/hosts.
Related
i'm connecting to mongodb through mongoose, from nodejs server, using this line:
mongoose.createConnection(`${uri}`,{dbName:"user",server: {poolSize : 1}});
mongoose.createConnection(`${uri}`,{dbName:"db2",server: {poolSize : 1}});
curiously when i inspect TCP connection in linux terminal, using lsof -i tcp:27017 , i found that for each connection between nodejs and mongodb server, there are TWO(???) TCP connections, which doubles the amount of connections needed.
I have the screenshot here.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mongod 779 root 5u IPv4 1078325 0t0 TCP localhost:27017->localhost:42688 (ESTABLISHED)
mongod 779 root 11u IPv4 19794 0t0 TCP localhost:27017 (LISTEN)
mongod 779 root 46u IPv4 1078335 0t0 TCP localhost:27017->localhost:42692 (ESTABLISHED)
mongod 779 root 48u IPv4 1077657 0t0 TCP localhost:27017->localhost:42698 (ESTABLISHED)
mongod 779 root 72u IPv4 1042013 0t0 TCP localhost:27017->localhost:41086 (ESTABLISHED)
mongod 779 root 74u IPv4 1042015 0t0 TCP localhost:27017->localhost:41088 (ESTABLISHED)
mongod 779 root 129u IPv4 721690 0t0 TCP localhost:27017->localhost:53000 (ESTABLISHED)
mongod 779 root 133u IPv4 721692 0t0 TCP localhost:27017->localhost:53002 (ESTABLISHED)
mongod 779 root 142u IPv4 758478 0t0 TCP localhost:27017->localhost:55034 (ESTABLISHED)
mongod 779 root 144u IPv4 758483 0t0 TCP localhost:27017->localhost:55038 (ESTABLISHED)
sshd 12453 root 8u IPv4 722486 0t0 TCP localhost:53000->localhost:27017 (ESTABLISHED)
sshd 12453 root 9u IPv4 722488 0t0 TCP localhost:53002->localhost:27017 (ESTABLISHED)
sshd 12453 root 10u IPv4 1041239 0t0 TCP localhost:41086->localhost:27017 (ESTABLISHED)
sshd 12453 root 11u IPv4 1041240 0t0 TCP localhost:41088->localhost:27017 (ESTABLISHED)
sshd 12453 root 12u IPv4 759420 0t0 TCP localhost:55034->localhost:27017 (ESTABLISHED)
sshd 12453 root 13u IPv4 759431 0t0 TCP localhost:55038->localhost:27017 (ESTABLISHED)
node\x20/ 16446 root 20u IPv4 1077542 0t0 TCP localhost:42692->localhost:27017 (ESTABLISHED)
node\x20/ 16446 root 21u IPv4 1077536 0t0 TCP localhost:42688->localhost:27017 (ESTABLISHED)
node\x20/ 16446 root 23u IPv4 1078433 0t0 TCP localhost:42698->localhost:27017 (ESTABLISHED)
notice that TCP connections are port [42692, 42688, 42698] are counted twice.
i also have a few connections made through sshd, and clearly they are single connections, just for reference purposes.
i have a limited amount of con-current connections quota, so the question is, what's wrong here? is it possible to get rid of the doubled connections?
I ran:
# lsof | grep 10900
And its output:
MyExecutab 103497 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103498 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103499 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103500 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103501 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103502 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103503 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
I am trying to figure out which thread is reading from the UDP port 10900.
It seems like there are 7 threads reading from that port, is it true?
I feel that only one thread is actually reading but lsof just listed all child threads (within the same process) and the parent thread.
netstat -plun shows that only the parent thread (PID) is listening to that port:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
udp 0 0 10.7.168.173:10900 0.0.0.0:* 103497/MyExecutable
I also checked /proc/[pid]/fd. Because only 103497 is a PID, the rest are TID, so /proc/ only has 103497 but not the rest.
So is there really a way to figure out which thread listens to a specific UDP port?
I am on CentOS 7 (kernel 3.10).
Thanks!
Run strace -ffp <pid> and see which threads use file descriptor 7.
I have Node app running on port 9800.
It's now throwing an Error listen EADDRINUSE :::9800.
I have looked up stackoverflow and tried all of those answered.
stackoverflow reference
But none of them worked for me.
kill -9 is not killing the process. It just recreates the process with new PID.
Here is the detail.
MacBook-Pro-2:portfolio jiahlee$ lsof -PiTCP -sTCP:LISTEN
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
rapportd 404 jiahlee 3u IPv4 0x75aeedfca27f06f5 0t0 TCP *:49170 (LISTEN)
rapportd 404 jiahlee 4u IPv6 0x75aeedfca221604d 0t0 TCP *:49170 (LISTEN)
Python 800 jiahlee 3u IPv4 0x75aeedfca7815d95 0t0 TCP localhost:24679 (LISTEN)
node 3071 jiahlee 12u IPv6 0x75aeedfca221438d 0t0 TCP *:9800 (LISTEN)
MacBook-Pro-2:portfolio jiahlee$ kill -9 3071
MacBook-Pro-2:portfolio jiahlee$ lsof -PiTCP -sTCP:LISTEN
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
rapportd 404 jiahlee 3u IPv4 0x75aeedfca27f06f5 0t0 TCP *:49170 (LISTEN)
rapportd 404 jiahlee 4u IPv6 0x75aeedfca221604d 0t0 TCP *:49170 (LISTEN)
Python 800 jiahlee 3u IPv4 0x75aeedfca7815d95 0t0 TCP localhost:24679 (LISTEN)
node 3119 jiahlee 12u IPv6 0x75aeedfca2215a8d 0t0 TCP *:9800 (LISTEN)
MacBook-Pro-2:portfolio jiahlee$ sudo kill -9 3119
MacBook-Pro-2:portfolio jiahlee$ lsof -PiTCP -sTCP:LISTEN
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
rapportd 404 jiahlee 3u IPv4 0x75aeedfca27f06f5 0t0 TCP *:49170 (LISTEN)
rapportd 404 jiahlee 4u IPv6 0x75aeedfca221604d 0t0 TCP *:49170 (LISTEN)
Python 800 jiahlee 3u IPv4 0x75aeedfca7815d95 0t0 TCP localhost:24679 (LISTEN)
node 3154 jiahlee 12u IPv6 0x75aeedfca221438d 0t0 TCP *:9800 (LISTEN)
looks like node process is initiated by some parent process so even when you kill the node process it starts again
Can you give me the output of below command
lsof -n | grep 1337 | grep LISTEN
I'm trying to run my node server on my Macbook in port 80 and it keeps giving me this error:
EADDRINUSE : Looks like port 80 is in use
When I run sudo lsof -i :80, I get this:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
Google 7978 worklaptop 168u IPv4 0x2cc8fb4019190baf 0t0 TCP 10.0.98.217:56534->151.101.32.188:http (ESTABLISHED)
Google 7978 worklaptop 170u IPv4 0x2cc8fb4020e369bf 0t0 TCP 10.0.98.217:56535->151.101.32.188:http (ESTABLISHED)
httpd 45908 root 10u IPv6 0x2cc8fb3ffd315087 0t0 TCP *:http (LISTEN)
httpd 45914 daemon 10u IPv6 0x2cc8fb3ffd315087 0t0 TCP *:http (LISTEN)
httpd 45915 daemon 10u IPv6 0x2cc8fb3ffd315087 0t0 TCP *:http (LISTEN)
httpd 45916 daemon 10u IPv6 0x2cc8fb3ffd315087 0t0 TCP *:http (LISTEN)
httpd 45917 daemon 10u IPv6 0x2cc8fb3ffd315087 0t0 TCP *:http (LISTEN)
httpd 45918 daemon 10u IPv6 0x2cc8fb3ffd315087 0t0 TCP *:http (LISTEN)
httpd 46011 daemon 10u IPv6 0x2cc8fb3ffd315087 0t0 TCP *:http (LISTEN)
httpd 46027 daemon 10u IPv6 0x2cc8fb3ffd315087 0t0 TCP *:http (LISTEN)
httpd 46028 daemon 10u IPv6 0x2cc8fb3ffd315087 0t0 TCP *:http (LISTEN)
httpd 46029 daemon 10u IPv6 0x2cc8fb3ffd315087 0t0 TCP *:http (LISTEN)
httpd 46030 daemon 10u IPv6 0x2cc8fb3ffd315087 0t0 TCP *:http (LISTEN)
When I kill the Google processes, it just shuts down my Chrome browser.. Any idea what's happening here?
It's the apache2 webserver. It comes by default with MacOS.
You can stop it by issuing this command in terminal sudo apachectl stop
Also you can permenentaly disable it by command sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
It's very strange.
I write a message distribute server upon nanomsg.
But after some time,when i restart the server, i failed because the listening port has been used.
Here is the situation:
[root#vsmHost12 src]# lsof -n -i:3333
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
hsmcs 105013 root **20u** IPv4 **24845821** 0t0 TCP :dec-notes (LISTEN)
hsmcs 105013 root 66u IPv4 25366582 0t0 TCP 192.168.167.1:dec-notes->192.168.167.1:47826 (ESTABLISHED)
java 111946 root **20u** IPv4 **24845821** 0t0 TCP *:dec-notes (LISTEN)
java 111946 root 34u IPv6 25366581 0t0 TCP 192.168.167.1:47826->192.168.167.1:dec-notes (ESTABLISHED)
It's not because of the java, some other daemon may also have the problem.
Look at the FD number and DEVICE number, it's the SAME!
Can anyone explain it ?