httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Hay" <Steve...@planit.com>
Subject VS2010 release builds of Apache/mod_perl crash on Vista/2008/Win7
Date Fri, 04 Feb 2011 10:51:59 GMT
I have found that VS2010 release mode builds of Apache/mod_perl crash on
Windows Vista, Windows Server 2008 and Windows 7, and I believe that the
problem may be something to do with the environment manipulation done by
Apache (although Apache itself runs fine when not loading mod_perl).

The same build runs on Windows XP and Windows Server 2003, and also runs
(on all OSes) if I make a debug mode build or use VS2008 so it's quite a
strange problem, maybe even a bug in msvcr100.dll?

I'm using Apache 2.2.17, mod_perl 2.0.4 and Perl 5.12.2 (patched as per
5.13.9 to allow building with VS2010). Apache/mod_perl crashes during
start-up, downstream from ap_run_open_logs():

>	msvcr100.dll!free(void * pBlock)  Line 51	C
 	msvcr100.dll!__crtsetenv(char * * poption, const int primary)
Line 211 + 0xa bytes	C
 	msvcr100.dll!_putenv_helper(const char * name, const char *
value)  Line 265 + 0xb bytes	C
 	msvcr100.dll!_putenv(const char * option)  Line 77 + 0xa bytes
C
 	perl512.dll!ansify_path()  Line 4798	C
 	perl512.dll!Perl_win32_init(int * argcp, char * * * argvp)  Line
4862	C
 	perl512.dll!Perl_sys_init3(int * argc, char * * * argv, char * *
* env)  Line 150 + 0x3b bytes	C
 	mod_perl.so!modperl_sys_init()  Line 561 + 0x11 bytes	C
 	mod_perl.so!modperl_hook_init(apr_pool_t * pconf, apr_pool_t *
plog, apr_pool_t * ptemp, server_rec * s)  Line 629	C
 	libhttpd.dll!ap_run_open_logs(apr_pool_t * pconf, apr_pool_t *
plog, apr_pool_t * ptemp, server_rec * s)  Line 151 + 0x5b bytes
C
 	httpd.exe!main(int argc, const char * const * argv)  Line 673 +
0x16 bytes	C
 	httpd.exe!__tmainCRTStartup()  Line 555 + 0x19 bytes	C
 	httpd.exe!mainCRTStartup()  Line 371	C

It all goes wrong doing a putenv() call in ansify_path(). If I comment
out the call to ansify_path() (which is only required for perl's -S
option processing) then Apache/mod_perl starts up, but then crashes
later on in our own proprietary software when that does a putenv()
call...

I've managed to reproduce the problem in a small standalone program
(attached) by copying the environment manipulation (conversion from
UTF-16 to UTF-8) done by httpd-2.2.17\srclib\apr\misc\win32\start.c and
then following that with a putenv() call.

This program runs (and prints "Ok") in a VS2010 release build on XP, but
the same binary crashes on Server 2008. In a VS2008 release build it
runs on Server 2008 too.

The crash comes here (which is exactly where the Apache/mod_perl setup
was crashing):

>	msvcr100.dll!free(void * pBlock)  Line 51	C
 	msvcr100.dll!__crtsetenv(char * * poption, const int primary)
Line 211 + 0xa bytes	C
 	msvcr100.dll!_putenv_helper(const char * name, const char *
value)  Line 265 + 0xb bytes	C
 	msvcr100.dll!_putenv(const char * option)  Line 77 + 0xa bytes
C
 	test.exe!main(int argc, char * * argv, char * * env)  Line 97 +
0xb bytes	C++
 	test.exe!__tmainCRTStartup()  Line 555 + 0x17 bytes	C

Can anyone shed any light on what the problem is? In particular, can it
be fixed (or at least worked around) in the Apache code, or is this a
problem with msvcr100.dll?

Steve

Mime
View raw message