[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openssl-users
Subject:    problem with closing file descriptors while loading certificate in
From:       stanislav kimov <stanislav.kimov () gmail ! com>
Date:       2010-04-28 18:03:58
Message-ID: u2t1be15a221004281103rcbdf1597n3cd50cadae7b42d9 () mail ! gmail ! com
[Download RAW message or body]

Hi, thanks for developing openssl. It's realy a lifesaver!
But sometimes it gets difficult for me to understand it. I have made my own
realisation of SIGN by using functions from smime.c and encountered a big
problem while testing it for memory leaks. My realisation works correctly,
but when I called it for 10,000 times in one cycle I got such a run-time
error:
Error opening signer certificate user.cert
3075159688:error:02001018:system library:fopen:Too many open
files:bss_file.c:355:fopen('user.cert','r')
3075159688:error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:357:
unable to load certificate

I'm using linux Ubuntu distribution and openssl-1.0.0-beta5 version.
Error occured on 1020 iteration, and each iteration number of opened file
descriptors and iteration number were equal.
It seems to me that file descriptor that load_cert() function opens for
reading certificate from file stays unclosed. I checked a link of function
calls by debugging "smime sign" called from openssl command line. I use same
functions in same order. And I clean everything in the end. I call
"X509_free(cert);" for certificate.
I load certificate like that:
cert = load_cert(bio_err, signerfile, FORMAT_PEM, NULL, e, "signer
certificate");

Thanks in advance for your help. I wait for reply very much, because I've
already broken my brains trying to solve it.

[Attachment #3 (text/html)]

Hi, thanks for developing openssl. It&#39;s realy a lifesaver!<br>But sometimes it \
gets difficult for me to understand it. I have made my own realisation of SIGN by \
using functions from smime.c and encountered a big problem while testing it for \
memory leaks. My realisation works correctly, but when I called it for 10,000 times \
in one cycle I got such a run-time error:<br> Error opening signer certificate \
user.cert<br>3075159688:error:02001018:system library:fopen:Too many open \
files:bss_file.c:355:fopen(&#39;user.cert&#39;,&#39;r&#39;)<br>3075159688:error:20074002:BIO \
routines:FILE_CTRL:system lib:bss_file.c:357:<br> unable to load \
certificate<br><br>I&#39;m using linux Ubuntu distribution and openssl-1.0.0-beta5 \
version.<br>Error occured on 1020 iteration, and each iteration number of opened file \
descriptors and iteration number were equal.<br> It seems to me that file descriptor \
that load_cert() function opens for reading certificate from file stays unclosed. I \
checked a link of function calls by debugging &quot;smime sign&quot; called from \
openssl command line. I use same functions in same order. And I clean everything in \
the end. I call &quot;X509_free(cert);&quot; for certificate.<br> I load certificate \
like that:<br>cert = load_cert(bio_err, signerfile, FORMAT_PEM, NULL, e, &quot;signer \
certificate&quot;);<br><br>Thanks in advance for your help. I wait for reply very \
much, because I&#39;ve already broken my brains trying to solve it.


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majordomo@openssl.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic