httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Croteau, Beau" <Beau.Crot...@ca.com>
Subject RE: Thread Creation/Destruction Problems
Date Sun, 17 Jun 2007 23:56:31 GMT
Unfortunately, I have tried that route and the same thing occurs.  APR uses CreateThread and
ExitThread as the underlying calls and the same 'leak' occurs.


-----Original Message-----
From: William A. Rowe, Jr. [mailto:wrowe@rowe-clan.net]
Sent: Sun 6/17/2007 2:50 PM
To: dev@httpd.apache.org
Subject: Re: Thread Creation/Destruction Problems
 
Croteau, Beau wrote:
> I've investigated further and the problem appears to have something to do with the mod_ssl
module or a part of it's thread hooks.
> 
> In my test server I create a thread using _beginthread(...) which means when the thread
returns it should clean up after itself.
> 
> If I comment out the line:
> LoadModule ssl_module modules/mod_ssl.so
> 
> Then the server application functions as expected, when I don't it leaks a thread handle
every call.

Please don't read Win32 API logic as gospel when you are trying to plug
into another application's framework.  In this case, httpd used APR's
threading API so everything cooperates; we then initialize openssl lib
to trust APR for the threading information it requires.  APR is implemented
on top of the Win32 API when running on windows, but it doesn't stop there.

You are better off using apr_thread_create, etc.  First, it makes your
code more portable.  More importantly, it lets your code interoperate
within httpd :)  See apr_thread_proc.h for details, or test/testthread.c
in the apr sources for an example.



Mime
View raw message