RE: Thread handle leak in APR

2010-08-20 Thread Bert Huijben
> -Original Message-
> From: Erik Huelsmann [mailto:ehu...@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.
>  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



Fwd: %lld/%llu not handled by apr_vformatter

2010-08-20 Thread Igor Galić

Back to the list (I didn't realize it was just in CC)

i

- Forwarded Message -
From: "Chris Knight" 
To: "Igor Galić" 
Sent: Saturday, 21 August, 2010 12:22:23 AM
Subject: Re: %lld/%llu not handled by apr_vformatter

That's fine with me.

On Aug 20, 2010, at 3:21 PM, Igor Galić wrote:

> 
> - "Chris Knight"  wrote:
> 
>> That's solving a different problem (a problem nonetheless, but not the
>> problem I'm referring to), the definition of APR_INT64_T_FMT. The
>> problem is, no matter what the definition of APR_INT64_T_FMT is,
>> apr_vformatter should support %lld whereas now it doesn't support %lld
>> if APR_INT64_T_FMT is defined as %ld. (Whereas the OS does support
>> %lld even though it's functionally equivalent as %ld on a 64-bit OS.)
> 
> duh.
> I just realized I sent the mail to you, not to the list.
> It wasn't really my intention - can we take it back to the list?
> 
> i
> 
>> On Aug 20, 2010, at 2:19 PM, Igor Galić wrote:
>> 
>>> 
>>> - "Chris Knight"  wrote:
>>> 
 I am on 64-bit, %lu works just fine. My problem is that %llu on my
 64-bit OS causes apr_vformatter to not identify %llu as a "%"
>> string,
 so that in my example below it skips the %llu and sends the
>> u_int64_t
 to the %s, causing a seg fault. Whereas printf does not have this
 behavior on a 64-bit OS.
 
 Anyways, I've submitted a patch on an existing bug, who knows if
>> it'll
 take. :)
 
 https://issues.apache.org/bugzilla/show_bug.cgi?id=48476
>>> 
>>> Hi folks,
>>> 
>>> I've had the same kind of trouble on Solaris, getting APR to
>> compile
>>> for 32 and 64 bit - my naive solution (in pseudo code)
>>> can be found here:
>>> 
>>> http://www.mail-archive.com/dev%40apr.apache.org/msg23153.html
>>> 
>>> In short: When we find a (usable) inttypes.h/stdint.h we use it.
>>> 
>>> The only real issue left  (I believe) is the size of the void
>> pointer.
>>> 
>>> so long,
>>> i
>>> -- 
>>> Igor Galić
>>> 
>>> Tel: +43 (0) 664 886 22 883
>>> Mail: i.ga...@brainsware.org
>>> URL: http://brainsware.org/
> 
> -- 
> Igor Galić
> 
> Tel: +43 (0) 664 886 22 883
> Mail: i.ga...@brainsware.org
> URL: http://brainsware.org/


-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.ga...@brainsware.org
URL: http://brainsware.org/


Re: Thread handle leak in APR

2010-08-20 Thread Erik Huelsmann
On Fri, Aug 20, 2010 at 8:30 PM, William A. Rowe Jr.
 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

2010-08-20 Thread William A. Rowe Jr.
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

2010-08-20 Thread Guenter Knauf

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: %lld/%llu not handled by apr_vformatter

2010-08-20 Thread Chris Knight
I am on 64-bit, %lu works just fine. My problem is that %llu on my 64-bit OS 
causes apr_vformatter to not identify %llu as a "%" string, so that in my 
example below it skips the %llu and sends the u_int64_t to the %s, causing a 
seg fault. Whereas printf does not have this behavior on a 64-bit OS.

Anyways, I've submitted a patch on an existing bug, who knows if it'll take. :)

https://issues.apache.org/bugzilla/show_bug.cgi?id=48476

On Aug 17, 2010, at 4:28 PM, Philip Prindeville wrote:

>  Hey Chris,
> 
> I'm assuming this is only happening on a 32-bit native machine, right?
> 
> Because on an x86_64 machine '%lu' would be 64-bit and behave correctly, yes?
> 
> -Philip
> 
> 
> On 8/11/10 8:51 AM, Chris Knight wrote:
>> I spent half-a-day yesterday trying to figure out why I was crashing in 
>> apr_psprintf on a strlen until I realized that my "%llu%s" format string was 
>> causing it to use my long long int as a char *.
>> 
>> Needless to say, no harm in adding support for %ll[du] yes?
>> 
>> Ah, 64-bit fun for everyone
>> 
>> Example code:
>> 
>> #include
>> #include
>> #include
>> #include
>> 
>> int main(int argc, char **argv) {
>> apr_pool_t *pool = NULL;
>> char *s = "hello world"; u_int64_t v = 12345678;
>> 
>> apr_pool_initialize(); apr_pool_create(&(pool), NULL);
>> printf("%llu%s", v, s); // works
>> char *f = apr_psprintf(pool, "%llu%s", v, s); // segfault on strlen
>> printf("%s\n", f);
>> }
> 



RE: Thread handle leak in APR

2010-08-20 Thread Prathima Dandapani -X (pdandapa - HCL at Cisco)
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:jay...@gmail.com] 
Sent: Thursday, August 19, 2010 6:35 PM
To: pdand...@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)  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