On Sat, 29 Dec 2007, Tom Donovan wrote:

mod_perl re-defines "perl_free" as "free" in modperl_perl_includes.h:69.

This causes an attempt to use the native Windows free() function to release memory
which should be released by the perl_free() function located in PerlXXX.dll.

The specific call is in modperl_perl.c:186, function modperl_perl_destruct()
which gets called during the Apache/APR config pool cleanup.

The symptoms are:
When Apache 2.2 with mod_perl is run in a debugger, the following exception is reported
   during pool cleanup:

        "Invalid Address specified to RtlFreeHeap"

Some indirect symptoms also observed are:
Apache graceful restarts do not always work on Windows when mod_perl is loaded.
   Apache shutdown takes longer on Windows when mod_perl is loaded.

The symptoms are the same whether Apache, mod_perl, and Perl are built
with Visual C++ 6.0 or Visual C++ 2005 (in any combination).

Note that Apache 2.2.6 or Apache from the SVN 2.2.x branch cannot run mod_perl
without an additional patch for file descriptors.
see Apache bug 43534 - http://issues.apache.org/bugzilla/show_bug.cgi?id=43534

If you wish to track down the preprocessor definitions, it may be helpful to know:

   USE_LARGE_FILES is defined in C:\perl\lib\CORE\config.h:4418
malloc is defined in C:\perl\lib\CORE\win32iop.h:291 as win32_malloc free is defined in C:\perl\lib\CORE\win32iop.h:294 as win32_free

The following mod_perl patch corrects the problem on Windows (Win2k sp4)
for mod_perl (trunk or v2.0.3) with Apache (SVN 2.2.x branch or 2.2.6)
built with Visual C++ (v6.0 or v2005).

Regards,
-tom-

Hi Tom,
    Thanks for the detailed report, and patch. I tried out
the patch with perl-5.8.8, compiled against Apache/2.2.4,
and all the tests passed. However, the restart problem
still remains; evidently,
  http://issues.apache.org/bugzilla/show_bug.cgi?id=43534
or something equivalent must still be applied. I'm
heistant though to apply this to fix a problem in
the svn httpd sources, which are subject to change;
also, I'd like to understand better the reasons behind the
original definitions of perl_malloc and perl_free in
modperl_perl_includes.h (I seem to recall this was
needed for older versions of Perl, but it may now
be unnecessary). Thus, unless others think otherwise,
I think it'd be better to wait for an http release
candidate that demonstrates the problem.

--
best regards,
Randy Kobes

Reply via email to