[Help-gnutls] Problems with unclosed file descriptors

Stefan D stefan at damp.homeip.net
Fri Mar 18 02:48:58 CET 2005

Hi there

I'm having some problems with an app I'm developing using gnutls 1.1.22. 
It works like a charm, but I'm getting some problems after the app has 
been running for a while. Then I get the "Too many open files" error. 
I've commented out everything other than the code for the ssl-socket, so 
it can't be any other socket/file causing it. The weird thing is that an 
"lsof | grep <appname>" shows a huge list with lines like:

<appname> 22554    stefan  351u  sock     0,0             7419429 can't 
identify protocol

where "351u" goes from low values up to ~1000, and an "lsof | grep 
<appname> | wc -l" jumps around a bit and the settles at 2075 every time 
and gets stuck there only returning "Too many open files" (which is 
after, not 2000 connections, but a lot). I was wondering if I'm doing 
anything wrong when I close the sockets. I've tried lots of different 
stuff, but nothing has worked so far. This is what I do:
if(useSSL && sessionInited) {
	gnutls_bye(session, GNUTLS_SHUT_WR);
	sessionInited = false;

Is there anything I've forgotten? Any ideas? Really irritating problem 
because everything else works great, except that it stops working after 
a few hundred connections :)


More information about the Gnutls-help mailing list