Steve Hay wrote:
[...]
After further investigation, I've realised that actually Philippe's patch DOES fix the problem.

The reason that I didn't see it before was that in my original PERL_SYS_INIT() patch I was looking around for a place to put a corresponding PERL_SYS_TERM(), and had tried placing one in modperl_perl_destruct(). I'd forgotten that I'd done that, and it was causing Philippe's patch to not work because modperl_perl_destruct() is called more than once and was destroying the (global) perl malloc mutex which PERL_SYS_INIT had created! (Hence the crash on a subsequent call to MALLOC_LOCK.)

So could somebody please apply the attached patch. (This version updates PERL_SYS_INIT() to PERL_SYS_INIT3() as per perlembed, and fixes an "Illegal indirection" error which simply calling PERL_SYS_INIT3(0, NULL, NULL) produces.)

The use of PERL_SYS_INIT() is essential to running mp2 with Perl's malloc(), at least on Win32. (PERL_SYS_INIT() calls Perl_win32_init(), which calls MALLOC_INIT, without which the MALLOC_LOCK/MALLO_UNLOCK's done by Perl's malloc() don't work.)

Index: src/modules/perl/mod_perl.c
===================================================================
--- src/modules/perl/mod_perl.c (revision 149511)
+++ src/modules/perl/mod_perl.c (working copy)
@@ -542,11 +542,14 @@
*/
static apr_status_t modperl_sys_init(void)
{
+ int argc = 0;
+ char **argv = NULL, env = NULL;
+
MP_TRACE_i(MP_FUNC, "mod_perl sys init\n");
+ PERL_SYS_INIT3(&argc, &argv, &env);

As on unix the above macro expands to something that doesn't use either of these 3 arguments we get:


mod_perl.c: In function `modperl_sys_init':
mod_perl.c:545: warning: unused variable `argc'
mod_perl.c:546: warning: unused variable `argv'
mod_perl.c:546: warning: unused variable `env'

Please try this patch instead:

Index: src/modules/perl/mod_perl.c
===================================================================
--- src/modules/perl/mod_perl.c (revision 151089)
+++ src/modules/perl/mod_perl.c (working copy)
@@ -544,9 +544,9 @@
 {
     MP_TRACE_i(MP_FUNC, "mod_perl sys init\n");

-#if 0 /*XXX*/
-    PERL_SYS_INIT(0, NULL);
+    PERL_SYS_INIT3(0, NULL, NULL);

+#if 0 /*XXX*/
 #ifdef PTHREAD_ATFORK
     if (!ap_exists_config_define("PERL_PTHREAD_ATFORK_DONE")) {
         PTHREAD_ATFORK(Perl_atfork_lock,
@@ -581,9 +581,8 @@

     modperl_perl_pp_unset_all();

-#if 0 /*XXX*/
     PERL_SYS_TERM();
-#endif
+
     return APR_SUCCESS;
 }


-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to