I have a simple server under WinXP that creates a thread for a 'listener' and
spins off a new thread for each incoming client. Im limiting access to one
client at a time at this point so it blocks on the listener until the client
is closed. 

Im using a self-signed certificate for the server. The client is (for now)
on the same machine and connects via Perl using IO::Socket::SSL.

Im watching the memory of the server using 'perfmon.exe' using the 'private
bytes' for the process. Im also watching via 'TaskMgr'.

The Perl code opens a connection, sends and then receives 3 different blocks
of data. The size ranges from 10 bytes to 10000 bytes. The 'test' loops this
perl file with a second perl file that runs it, sleeps for 3 seconds and
then repeats. The data is the same each time.

What Im seeing: For the first three 'passes' the server memory grows by
about 10% each time and then stabilizes. From there it remains stable for
from 1-10 (~) passes and then grows by ~10%. Sometimes it will remain at
this new level sometimes it will return to the previous. If it remains at
either level it will do so for 1-10(~) passes and then jump up again. Ive
tested this for > 3000 passes and have seen the same behavior repeating. 

It looks like some sort of buffer or cache is being filled and so more
memory is allocated. Nothing shows up as a memory leak though so someone is
freeing the space when the app exits. Unf this code will end up in a service
so there isn't a guarantee as to when the space will get freed. I will also
be sending vastly more information so the buffer problem will be a large
problem.

If I run the same code sans SSL it doesn't have this problem.

What I have tried:

(at SSL_ctx creation)
SSL_CTX_set_session_cache_mode(m_ctx, SSL_SESS_CACHE_OFF); 
SSL_CTX_sess_set_cache_size(m_ctx, 1);

(between each thread creation)
SSL_CTX_flush_sessions(ctx, 0); 

using:
OpenSSL 0.9.8g.
Visual Studio 7
Win XP
Perl 5.8.8

What am I missing? What am I doing wrong?


-- 
View this message in context: 
http://www.nabble.com/Memory-growth-in-OpenSSL-socket-server-tp15280493p15280493.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.

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

Reply via email to