You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Paul Holcomb <ph...@cpoint.net> on 2000/09/22 21:45:51 UTC

AuthDBI Segmentation Fault (11) with mod_perl [SOLUTION]

 I had a LOT of trouble getting AuthDBI and modperl to work with
 apache without segfaulting.  I thought I would post how I got it to
 work. YMMV

 The solution came from someone's suggestion on the list to go back to
 mod_perl-1.21_03.  Unfortunately, this version would not compile with
 a thread-enabled perl, so I tried one of the CVS "bleeding edge
 versions".   This finally worked.

 Here is my final configuration:

+ Solaris 2.6
+ perl-5.6.0(with threads, with no large file support, with the cop.h
   patch people posted)
  [I'll include the patch at the end, but I don't think it was the
  reason that it started working.  Its something that I changed early
  on that didn't have any effect. I'll include it anyway]
+ mod_perl-1.24-dev(20000920161934), compiled with EVERYTHING=1
+ apache-1.3.12, 
  "--activate-module=src/modules/perl/libperl.a" \
  "--enable-module=so" \  in config.status
 [possibly a --with-layout= here as well]
+ mysql-3.22.32
+ DBI-1.14
+ ApacheDBI-0.87

 Basically the steps are to already have perl, mysql, DBI, ApacheDBI,
 compiled and installed, including whatever else each package requires.

 Then I untarred a new copy of apache, and copied and ran a
 config.status (that I saved earlier) into the tree with the above
 parameters, although you could just as well run ./configure with
 those options.  Then I untarred mod_perl, and edited the Makefile.PL
 so that it ran config.status instead of its using its (broken) method
 of configuring apache that allows for very little customization.
 I'll include a diff at the end -- its just a small hack and might break
 something else for you.

 Then I ran perl Makefile.PL EVERYTHING=1 DO_HTTPD=1 in a newly
 untarred copy of modperl from CVS (version above), Note that in my
 experience mod_perl won't build correctly with apache unless you do
 everything from mod_perl.  So I ran a make there, and after doing
 some tests, finally a make install in both the mod_perl and apache
 directories.

 And those are the exact steps I followed.

 As a bonus I was able to get php-4.0.2 to run concurrently with
 mod_perl and DBI as long as I built it as a module and made certain
 that the perl sutff was loaded before the LoadModule and AddModule
 lines for php.

 So far apache hasn't died with a segfault and one of my tests was a
 php script that did a mysql_connect() and pulled a list of tables,
 running from an AuthDBI protected directory.


--- Makefile.PL.dist    Wed Sep 13 17:16:29 2000
+++ Makefile.PL Wed Sep 20 20:22:36 2000
@@ -946,8 +946,8 @@
          $cmd .= qq(LDFLAGS_SHLIB_EXPORT="$Config{ccdlflags}" );
        }
 
-       $cmd .= "./configure " .
-                 "--activate-module=src/modules/perl/libperl.a";
+       #$cmd .= "./configure " .
+#                "--activate-module=src/modules/perl/libperl.a";
    
         # Do not disable the rule EXPAT for Stronghold, since this
         # rule is not implementated yet and breaks the configure process.
@@ -977,6 +977,7 @@
                }
            }
        }
+       $cmd = "sh config.layout";
        print "(cd $APACHE_ROOT && $cmd)\n";
        system "(cd $APACHE_ROOT && $cmd)";
     }
 
--
--- perl/cop.h.~1~      Thu Jun  8 06:58:03 2000
+++ perl/cop.h  Thu Jun  8 06:58:03 2000
@@ -106,13 +106,9 @@
     } STMT_END
 #endif /* USE_THREADS */
 
-#ifdef USE_ITHREADS
-   /* junk in @_ spells trouble when cloning CVs, so don't leave any */
-#  define CLEAR_ARGARRAY()     av_clear(cx-&gt;blk_sub.argarray)
-#else
-#  define CLEAR_ARGARRAY()     NOOP
-#endif /* USE_ITHREADS */
-
+/* junk in @_ spells trouble when cloning CVs and in pp_caller(), so don't
+ * leave any */
+#define CLEAR_ARGARRAY()       av_clear(cx-&gt;blk_sub.argarray)
 
 #define POPSUB(cx,sv)                                                  \
     STMT_START {                                                       \

--- perl/t/op/runlevel.t.~1~    Thu Jun  8 06:58:03 2000
+++ perl/t/op/runlevel.t        Thu Jun  8 06:58:03 2000
@@ -349,3 +349,18 @@
 bar
 B 2
 bar
+########
+sub n { 0 }
+sub f { my $x = shift; d(); }
+f(n());
+f();
+
+sub d {
+    my $i = 0; my @a;
+    while (do { { package DB; @a = caller($i++) } } ) {
+        @a = @DB::args;
+        for (@a) { print "$_\n"; $_ = '' }
+    }
+}
+EXPECT
+0


-- 
Paul Holcomb <ph...@cpoint.net>	    Phone: 888-6CPOINT Fax: 888-3220001
Sr. Network Engineer			      Counterpoint Networking, Inc.