You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by "Prathima Dandapani -X (pdandapa - HCL at Cisco)" <pd...@cisco.com> on 2010/08/17 13:11:17 UTC

Thread handle leak in APR

 Hello APR team,

We are observing Apache thread handle leak in windows.Apache's non paged
pool memory blows up because of this and eventually none of other
applications gets an handle.
TaskManager shows Apache has 503 threads and 328,817 handles. Handles are
very huge.
Using process explorer when I checked the handles almost all of them are
Apache threads.
Kindly find the attachment for the same.
Is this a bug?
Let us know your views on this issue.

Thanks and Regards,
Prathima.

Re: Thread handle leak in APR

Posted by "William A. Rowe Jr." <wr...@rowe-clan.net>.
On 8/20/2010 10:01 PM, Bert Huijben wrote:
>> -----Original Message-----
>> From: Erik Huelsmann [mailto:ehuels@gmail.com]
>> Sent: vrijdag 20 augustus 2010 13:20
>> To: William A. Rowe Jr.
>> Cc: dev@apr.apache.org
>> Subject: Re: Thread handle leak in APR
>>
>> On Fri, Aug 20, 2010 at 8:30 PM, William A. Rowe Jr.
>> <wr...@rowe-clan.net> wrote:
>>> On 8/20/2010 1:08 PM, Guenter Knauf wrote:
>>>> Hi Prathima,
>>>> Am 20.08.2010 09:04, schrieb Prathima Dandapani -X (pdandapa - HCL at
>>>> Cisco):
>>>>> Steps used to compile Apache is as follows.
>>>>> Run Setenv.cmd  from the Windows-Server-2003-R2-Platform-SDK
>> installed
>>>>> directory
>>>>> Run vcvars32.bat  from VC++ installed directory.
>>>> AFAICT this is the wrong order; first you need to call vcvars32.bat,
>>>> then Setenv.cmd so that the PSDK paths are prepended.
>>>
>>> Precisely :)
>>
>> Will reversing the order make his leak disappear?
> 
> Changing the order might give you older or newer .lib and .h files depending on the exact VS and SDK versions, so it might add or hide some functions that are otherwise unavailable. But it should never change the behavior.

Thread handles are reaped when apr_thread_join() is called, which is how you
'harvest' now-dead (or soon-to-be-dead) threads.

It looks like you have a non-ASF module creating threads frequently, from the
users@ list post; I didn't see a ton of dups in that list.  Don't forget you
have to free them, if you are the author of the module.

If you are using third party modules, you keep forgetting to mention which one(s).

RE: Thread handle leak in APR

Posted by "Prathima Dandapani -X (pdandapa - HCL at Cisco)" <pd...@cisco.com>.
All,

 I see the following bug.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45291
The bug has proposed updates\fix in apr thread.c file.
Is the fix safe and correct to try?

Thanks and Regards,
Prathima.

-----Original Message-----
From: Bert Huijben [mailto:bert@qqmail.nl] On Behalf Of Bert Huijben
Sent: Saturday, August 21, 2010 8:31 AM
To: 'Erik Huelsmann'; 'William A. Rowe Jr.'
Cc: dev@apr.apache.org
Subject: RE: Thread handle leak in APR

> -----Original Message-----
> From: Erik Huelsmann [mailto:ehuels@gmail.com]
> Sent: vrijdag 20 augustus 2010 13:20
> To: William A. Rowe Jr.
> Cc: dev@apr.apache.org
> Subject: Re: Thread handle leak in APR
> 
> On Fri, Aug 20, 2010 at 8:30 PM, William A. Rowe Jr.
> <wr...@rowe-clan.net> wrote:
> > On 8/20/2010 1:08 PM, Guenter Knauf wrote:
> >> Hi Prathima,
> >> Am 20.08.2010 09:04, schrieb Prathima Dandapani -X (pdandapa - HCL 
> >> at
> >> Cisco):
> >>> Steps used to compile Apache is as follows.
> >>> Run Setenv.cmd  from the Windows-Server-2003-R2-Platform-SDK
> installed
> >>> directory
> >>> Run vcvars32.bat  from VC++ installed directory.
> >> AFAICT this is the wrong order; first you need to call 
> >> vcvars32.bat, then Setenv.cmd so that the PSDK paths are prepended.
> >
> > Precisely :)
> 
> Will reversing the order make his leak disappear?

Changing the order might give you older or newer .lib and .h files depending
on the exact VS and SDK versions, so it might add or hide some functions
that are otherwise unavailable. But it should never change the behavior.

	Bert


RE: Thread handle leak in APR

Posted by Bert Huijben <be...@vmoo.com>.
> -----Original Message-----
> From: Erik Huelsmann [mailto:ehuels@gmail.com]
> Sent: vrijdag 20 augustus 2010 13:20
> To: William A. Rowe Jr.
> Cc: dev@apr.apache.org
> Subject: Re: Thread handle leak in APR
> 
> On Fri, Aug 20, 2010 at 8:30 PM, William A. Rowe Jr.
> <wr...@rowe-clan.net> wrote:
> > On 8/20/2010 1:08 PM, Guenter Knauf wrote:
> >> Hi Prathima,
> >> Am 20.08.2010 09:04, schrieb Prathima Dandapani -X (pdandapa - HCL at
> >> Cisco):
> >>> Steps used to compile Apache is as follows.
> >>> Run Setenv.cmd  from the Windows-Server-2003-R2-Platform-SDK
> installed
> >>> directory
> >>> Run vcvars32.bat  from VC++ installed directory.
> >> AFAICT this is the wrong order; first you need to call vcvars32.bat,
> >> then Setenv.cmd so that the PSDK paths are prepended.
> >
> > Precisely :)
> 
> Will reversing the order make his leak disappear?

Changing the order might give you older or newer .lib and .h files depending on the exact VS and SDK versions, so it might add or hide some functions that are otherwise unavailable. But it should never change the behavior.

	Bert


Re: Thread handle leak in APR

Posted by Erik Huelsmann <eh...@gmail.com>.
On Fri, Aug 20, 2010 at 8:30 PM, William A. Rowe Jr.
<wr...@rowe-clan.net> wrote:
> On 8/20/2010 1:08 PM, Guenter Knauf wrote:
>> Hi Prathima,
>> Am 20.08.2010 09:04, schrieb Prathima Dandapani -X (pdandapa - HCL at
>> Cisco):
>>> Steps used to compile Apache is as follows.
>>> Run Setenv.cmd  from the Windows-Server-2003-R2-Platform-SDK installed
>>> directory
>>> Run vcvars32.bat  from VC++ installed directory.
>> AFAICT this is the wrong order; first you need to call vcvars32.bat,
>> then Setenv.cmd so that the PSDK paths are prepended.
>
> Precisely :)

Will reversing the order make his leak disappear?

Regards,

Erik.

Re: Thread handle leak in APR

Posted by "William A. Rowe Jr." <wr...@rowe-clan.net>.
On 8/20/2010 1:08 PM, Guenter Knauf wrote:
> Hi Prathima,
> Am 20.08.2010 09:04, schrieb Prathima Dandapani -X (pdandapa - HCL at
> Cisco):
>> Steps used to compile Apache is as follows.
>> Run Setenv.cmd  from the Windows-Server-2003-R2-Platform-SDK installed
>> directory
>> Run vcvars32.bat  from VC++ installed directory.
> AFAICT this is the wrong order; first you need to call vcvars32.bat,
> then Setenv.cmd so that the PSDK paths are prepended.

Precisely :)

Re: Thread handle leak in APR

Posted by Guenter Knauf <fu...@apache.org>.
Hi Prathima,
Am 20.08.2010 09:04, schrieb Prathima Dandapani -X (pdandapa - HCL at 
Cisco):
> Steps used to compile Apache is as follows.
> Run Setenv.cmd  from the Windows-Server-2003-R2-Platform-SDK installed
> directory
> Run vcvars32.bat  from VC++ installed directory.
AFAICT this is the wrong order; first you need to call vcvars32.bat, 
then Setenv.cmd so that the PSDK paths are prepended.

Gün.



RE: Thread handle leak in APR

Posted by "Prathima Dandapani -X (pdandapa - HCL at Cisco)" <pd...@cisco.com>.
John,

Thanks for your response.
The server where we observed this is a performance machine. There will be
frequent access to the server. You can see the issue of thread handle leak
on running the server for more than three days. When we cross check the
count of Threads and  thread handles count in total handles, it never shows
the same count.
ThreadsPerChild is set to 500 in our httpd.conf. We are using APR that is
shipped with Apache 2.2.10.We generally download Apache source code, compile
and then make use.

Steps used to compile Apache is as follows.
Run Setenv.cmd  from the Windows-Server-2003-R2-Platform-SDK installed
directory 
Run vcvars32.bat  from VC++ installed directory.
nmake /f makefile.win _apacher   

Apache.exe -V
Server version: Apache/2.2.10 (Win32)
Server built:   Oct 17 2008 14:06:17
Server's Module Magic Number: 20051115:18
Server loaded:  APR 1.3.3, APR-Util 1.3.4
Compiled using: APR 1.3.3, APR-Util 1.3.4
Architecture:   32-bit
Server MPM:     WinNT
  threaded:     yes (fixed thread count)
    forked:     no
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/winnt"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/apache"
 -D SUEXEC_BIN="/apache/bin/suexec"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error.log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

I see the following bug.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45291
Is this we are hitting?

Let us know if you need more information.

Thanks and Regards,
Prathima.

-----Original Message-----
From: John Vandenberg [mailto:jayvdb@gmail.com] 
Sent: Thursday, August 19, 2010 6:35 PM
To: pdandapa@cisco.com
Cc: dev@apr.apache.org
Subject: Re: Thread handle leak in APR

On Tue, Aug 17, 2010 at 9:11 PM, Prathima Dandapani -X (pdandapa - HCL at
Cisco) <pd...@cisco.com> wrote:
>  Hello APR team,
>
> We are observing Apache thread handle leak in windows.Apache's non 
> paged pool memory blows up because of this and eventually none of 
> other applications gets an handle.
> TaskManager shows Apache has 503 threads and 328,817 handles. Handles 
> are very huge.
> Using process explorer when I checked the handles almost all of them 
> are Apache threads.
> Kindly find the attachment for the same.
> Is this a bug?
> Let us know your views on this issue.

Was there any significant load on the Apache server?  Can you reproduce it?
If so, how?

Are you using the Apache 2.2.10 binary distributed by Apache?

If you have rolled your own apr, could you let us know how you built it
(MSVC, msys, other) and any configure options, etc. that might be relevant.

--
John Vandenberg


Re: Thread handle leak in APR

Posted by John Vandenberg <ja...@gmail.com>.
On Tue, Aug 17, 2010 at 9:11 PM, Prathima Dandapani -X (pdandapa - HCL
at Cisco) <pd...@cisco.com> wrote:
>  Hello APR team,
>
> We are observing Apache thread handle leak in windows.Apache's non paged
> pool memory blows up because of this and eventually none of other
> applications gets an handle.
> TaskManager shows Apache has 503 threads and 328,817 handles. Handles are
> very huge.
> Using process explorer when I checked the handles almost all of them are
> Apache threads.
> Kindly find the attachment for the same.
> Is this a bug?
> Let us know your views on this issue.

Was there any significant load on the Apache server?  Can you
reproduce it?  If so, how?

Are you using the Apache 2.2.10 binary distributed by Apache?

If you have rolled your own apr, could you let us know how you built
it (MSVC, msys, other) and any configure options, etc. that might be
relevant.

--
John Vandenberg