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-


Index: src/modules/perl/modperl_perl_includes.h
===================================================================
--- src/modules/perl/modperl_perl_includes.h    (revision 607444)
+++ src/modules/perl/modperl_perl_includes.h    (working copy)
@@ -68,11 +68,9 @@

 #if defined(WIN32) && defined(USE_LARGE_FILES)
 #   ifdef malloc
-#      define perl_malloc malloc
 #      undef malloc
 #   endif
 #   ifdef free
-#      define perl_free free
 #      undef free
 #   endif
 #endif



-------------8<---------- Start Bug Report ------------8<----------
1. Problem Description:

  Heap errors on Windows with mod_perl (trunk), Perl 5.10.0, and Apache 2.2 
(SVN 2.2.x branch)
  Also observed with mod_perl 2.0.3, ActiveState Perl 5.8.8,  and Apache 2.2.6 
(with patch)
  mod_perl incorrectly re-defines perl_free as free (which is defined as 
win32_free)
  This causes an attempt to use the Windows allocator to free data allocated by 
the Perl rtl

2. Used Components and their Configuration:

*** mod_perl version 2.000004

*** using C:\work\mod_perl-trunk\lib\Apache2\BuildConfig.pm

*** Makefile.PL options:
  MP_APR_LIB     => aprext
  MP_AP_PREFIX   => C:\Apache22x
  MP_COMPAT_1X   => 1
  MP_GENERATE_XS => 1
  MP_LIBNAME     => mod_perl
  MP_USE_DSO     => 1


*** httpd

    C:\Apache22x\bin>httpd -V
    Server version: Apache/2.2.7-dev (Win32)
    Server built:   Dec 23 2007 14:59:22
    Server's Module Magic Number: 20051115:10
    Server loaded:  APR 1.2.13-dev, APR-Util 1.2.13-dev
    Compiled using: APR 1.2.13-dev, APR-Util 1.2.13-dev
    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"


*** (apr|apu)-config linking info

   /libpath:"C:\Apache22x\lib" libaprutil-1.lib
   /libpath:"C:\Apache22x\lib" libapr-1.lib



*** c:\perl\bin\perl.exe -V
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
  Platform:
    osname=MSWin32, osvers=5.00, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags ='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE 
-DNO_STRICT
-DHAVE_DES_FCRYPT -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE  
-DPERL_IMPLICIT_CONTEXT
-DPERL_IMPLICIT_SYS -DUSE_PERLIO',
    optimize='-MD -Zi -DNDEBUG -O1',
    cppflags='-DWIN32'
    ccversion='14.00.50727.762', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', 
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf  
-libpath:"c:\perl\lib\CORE"
-machine:x86'
    libpth="C:\Program Files\Microsoft Visual Studio 8\VC\lib"
    libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  
comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib mpr.lib 
winmm.lib  version.lib
odbc32.lib odbccp32.lib msvcrt.lib
    perllibs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  
comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib 
ws2_32.lib mpr.lib winmm.lib
 version.lib odbc32.lib odbccp32.lib msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl510.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf
-libpath:"c:\perl\lib\CORE"  -machine:x86'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
                        PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS
                        PERL_MALLOC_WRAP PL_OP_SLAB_ALLOC USE_ITHREADS
                        USE_LARGE_FILES USE_PERLIO
  Built under MSWin32
  Compiled at Dec 29 2007 12:00:16
  %ENV:
    PERL_HOME="C:\Perl"
    PERL_LWP_USE_HTTP_10="1"
  @INC:
    c:/perl/lib
    c:/perl/site/lib
    .

*** Packages of interest status:

Apache2            : -
Apache2::Request   : -
CGI                : -
ExtUtils::MakeMaker: -
LWP                : -
mod_perl           : -
mod_perl2          : -


3. This is the core dump trace: (if you get a core dump):

  >  mod_perl.so!modperl_perl_destruct(interpreter * perl=0x00a2604c)  Line 186 
     C
        mod_perl.so!modperl_interp_destroy(modperl_interp_t * 
interp=0x009c72e8)  Line 148      C
        mod_perl.so!interp_pool_shrink(modperl_tipool_t * tipool=0x00995098, 
void * data=0x00995088, void
* item=0x009c72e8)  Line 218 + 0x9 bytes        C
        mod_perl.so!modperl_tipool_destroy(modperl_tipool_t * 
tipool=0x00995098)  Line 205 + 0xc bytes  C
        mod_perl.so!modperl_interp_pool_destroy(void * data=0x00995088)  Line 
192       C
        libapr-1.dll!run_cleanups(cleanup_t * * cref=0x00000000)  Line 2064     
C
        libapr-1.dll!apr_pool_destroy(apr_pool_t * pool=0x009c2960)  Line 759   
C
        libapr-1.dll!apr_pool_clear(apr_pool_t * pool=0x008ccc98)  Line 715 + 
0x9 bytes C
        httpd.exe!main(int argc=2, const char * const * argv=0x008c27e8)  Line 
682      C
        httpd.exe!__tmainCRTStartup()  Line 597 + 0x17 bytes    C
        [EMAIL PROTECTED]()  + 0x3d bytes       

This report was generated by C:\Perl\bin/mp2bug on Sat Dec 29 18:52:33 2007 GMT.

-------------8<---------- End Bug Report --------------8<----------

Note: Complete the rest of the details and post this bug report to
modperl <at> perl.apache.org. To subscribe to the list send an empty
email to [EMAIL PROTECTED]



Reply via email to