Brett Polivka <[EMAIL PROTECTED]>:

> I am having a very strange problem which I do not understand at all.
> 
> I am writing a forking server using OpenSSL.  If I set up an SSL_CTX in
> the parent process and then allow the fork to copy the context into the
> process space of the children which it spawns, the size of the children
> will grow as they service more requests.
[...]
> However, if I copy the contents of the SSL_CTX created by the parent
> into an SSL_CTX created by the child, the children remain constant size.
[...]
> I cannot begin to understand why this happens.  Does anyone have any
> ideas?

First of all, memcpying structures is not a good idea; it could lead
to incorrect pointers, because the library assumes that you use the
API.  It may not hurt in this case, but be careful.

The reason for memory growth of servers is that servers cache each new
session that a client starts.  If you make copies of an SSL_CTX that
is never used itself, then each copy starts with an empty cache; if
you make continued use of a single SSL_CTX, then its cache gets a new
entry for each connection, unless a client reconnects and resumes a
previous session.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to