I'm trying to debug an issue where sockets aren't being properly closed in a Java application. It works under Linux, but with FreeBSD a socket appears to be left open though with no associated file descriptor (according to sockstat)
While the server on port 9999 is running, here's some output from sockstat and netstat:
It looks correct and as expected. Now, when the app closes its server socket, the following system call is seen from truss:
The 2nd argument is the same file descriptor listening on 9999 (fd 17), so my understanding is that it should be close()'d then. (BTW, Why does truss show all those extra arguments? Shouldn't there only be 2?)
Following this, the output from sockstat/netstat is:
and although the app thinks it's closed the socket, it is still lingering around.
Does anyone know what's happening to the socket here? Why is sockstat displaying question marks?
(For context, here is the minimal app I've been testing with: https://gist.github.com/ericdahl/0dc63c44cd05a6f5bd9a)
While the server on port 9999 is running, here's some output from sockstat and netstat:
Code:
[ecd@qk ~]$ sockstat -4 | grep 9999
ecd java 48847 17 tcp4 127.0.0.1:9999 *:*
[ecd@qk ~]$ netstat -an | grep 9999
tcp4 0 0 127.0.0.1.9999 *.* LISTEN
Code:
48847: dup2(0x18,0x11,0x8028769a8,0xc,0x80469e000,0x0) = 17 (0x11)
Following this, the output from sockstat/netstat is:
Code:
[ecd@qk ~]$ sockstat -4 | grep 9999
? ? ? ? tcp4 127.0.0.1:9999 *:*
[ecd@qk ~]$ netstat -an | grep 9999
tcp4 0 0 127.0.0.1.9999 *.* LISTEN
Does anyone know what's happening to the socket here? Why is sockstat displaying question marks?
(For context, here is the minimal app I've been testing with: https://gist.github.com/ericdahl/0dc63c44cd05a6f5bd9a)