socket leak in FreeBSD 4.7
Scot Loach
sloach at sandvine.com
Thu Jun 19 05:20:46 PDT 2003
If I execute the following program on a FreeBSD 4.7 system:
int main()
{
for (int i = 0; i < 70000; i++)
{
socket(PF_INET, SOCK_STREAM, 0);
}
return 0;
}
the sockets never seem to be freed.
vmstat tells me the memory is still in use:
bash-2.05a$ vmstat -z
ITEM SIZE LIMIT USED FREE REQUESTS
tcpcb: 544, 106000, 65557, 4474, 70029
udpcb: 192, 106000, 7, 35, 481
unpcb: 160, 0, 7, 43, 78
socket: 192, 106000, 65571, 4487, 70639
However, fstat and sockstat do not show a large number of sockets.
netstat shows them, and they look like this:
tcp4 0 0 *.* *.* CLOSED
If I explicitly close the sockets before the program exits, this does not
occur. However I'm worried about the case where a high-volume server exits
unexpectedly and leaks sockets.
Any ideas of what might be wrong?
More information about the freebsd-net
mailing list