Date: Thu, 19 Jun 2003 08:20:34 -0400 From: Scot Loach <sloach@sandvine.com> To: "'freebsd-net@freebsd.org'" <freebsd-net@freebsd.org> Subject: socket leak in FreeBSD 4.7 Message-ID: <FE045D4D9F7AED4CBFF1B3B813C8533701AE842A@mail.sandvine.com>
next in thread | raw e-mail | index | archive | help
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?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?FE045D4D9F7AED4CBFF1B3B813C8533701AE842A>