Hello,

We began to encounter some odd segfaults, and after poking through
mod_perl believed that we have found the problem. The DESTROY() function
in Table.xs is not honoring the read only flag in "self", which would seem
to be a bug.

For reasons we are still trying to discover (;>), it's being called and
asked to delete some sort of shared, read-only object (probably belonging
to Apache?). We only saw this happen intermittently, and under very high
load.

The attached patch was written by Erik Arneson ([EMAIL PROTECTED]).

So, is this an actual bug or is it more likely that we're in some way
horribly abusing mod_perl (or is it both ;>)?

Thank you all very much,

_Jesse Williamson ;-};
--- apache_1.3.26/mod_perl-1.27/src/modules/perl/Table.xs.table Tue Dec 10 11:55:24 
2002
+++ apache_1.3.26/mod_perl-1.27/src/modules/perl/Table.xs       Tue Dec 10 11:57:55 
+2002
@@ -112,13 +112,19 @@
 
     PREINIT:
     Apache__Table tab;
 
     CODE:
-    tab = (Apache__Table)hvrv2table(self);
-    if(SvROK(self) && SvTYPE(SvRV(self)) == SVt_PVHV) 
-        safefree(tab);
+    if (!SvREADONLY(self)) {
+        tab = (Apache__Table)hvrv2table(self);
+        if(SvROK(self) && SvTYPE(SvRV(self)) == SVt_PVHV) 
+            safefree(tab);
+    }
+    else {
+        fprintf(stderr, "Apache::Table is trying to free READONLY SV at %p\n", self);
+        fflush(stderr);
+    }
 
 void
 FETCH(self, key)
     Apache::Table self
     const char *key

Reply via email to