Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

When would you have multiple pids?


See SO_REUSEPORT in 'man 7 socket'

If, for example, you run nginx in a default configuration, you'll notice both the master and worker processes will have an fd bound to the same port (port 80 or whatever), so it's also not exactly unusual.

Even without SO_REUSEPORT, you can have multiple things on one port if you have multiple IPs, like something listening on "127.0.0.1:80", and a different process listening on "192.168.1.10:80"


So if you had one process listening to the same port on multiple ips, this xargs would fail on the second invocation? Seems like piping through uniq may be a good idea


Probably when binding a socket with SO_REUSEADDR or SO_REUSEPORT.


sshd does this.

sshd 3891262 root 4u IPv4 15450342 0t0 TCP ibpmaas-testing:https->10.10.47.11:49064 (ESTABLISHED)

sshd 3891351 ubuntu 4u IPv4 15450342 0t0 TCP ibpmaas-testing:https->10.10.47.11:49064 (ESTABLISHED)

# lsof -ti ":49064"

3891262 3891351

edit for readability




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: