On 7/19/05, Rich Salz <[EMAIL PROTECTED]> wrote:
> > Doing this now, but since my app is a server, it never really reaches
> > the end, and the leaks build up during its lifetime, which I'd rather
> > hoped could be more than a day or so. As it is now, the process'
> > virtual memory size quickly reaches 3.5 GB, and then malloc() starts
> > failing.
> 
> Something wrong is happening.  Lots of folks are running apache/openssl
> servers for days, weeks, etc., at a time.
> 
> If you're seeing memory leaks like you describe, then it is far more
> likely that the like is either in your code, or there's a bug in the way
> you're calling OpenSSL.  Do you get the same growth when openssl isn't
> used?  Make sure you "xxx_free" every object you "xxx_new".
> 
>         /r$
> 

Hi,

I was looking at the code ... could it be that the memory leak is in
the main server loop?
Sometimes, the ssl_accept may return 0, but with an error code like
SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE, which just means that
could not complete the handshake, but not really an error (just call
ssl_accept again ... ).
But in you main server thread, you just do a continue, thus looping
again ... and creating a brand new ssl structure and socket ... you
should
loop() {
  create the tcp socket
  loop () {
      ssl_accept from the tcp socket till non-zero
   }
}
      
Take a look at the examples that come with openssl.

Regards,

Cesc
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to