How could two processes bind onto the same port?
- by Matt Ball
I just ran into an issue where a request made to localhost:8080 from curl was hitting a different server than the same request made from inside Node. lsof -i :8080 revealed that two processes were both binding onto the same port:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 51961 mball 14u IPv4 0xd980e0df7f175e13 0t0 TCP *:http-alt (LISTEN)
java 62704 mball 320u IPv6 0xd980e0df7fe08643 0t0 TCP *:http-alt (LISTEN)
How is this possible? Were they binding onto different interfaces? Or was it the IPv4 vs 6?
If you're curious, node was hitting the other node process, curl was hitting the java process. The java process was started after the node process.