Flavio Curti wrote:
> Hello
> 
> I have a problem running mod_perl-2.0.0 (and the latest devel snapshot too):
> 
> Apache segfaults on startup as soon as I have the LoadModule directive
> in the httpd.conf. This also happens when running make test. I have
> compiled mod_perl with debugging enabled and found the problematic
> spot, however I have no idea on what exactly is wrong:
> 
> (gdb output after segfault):
> 
> [Mon May 23 17:10:32 2005] [info] 6 Apache2:: modules loaded
> [Mon May 23 17:10:32 2005] [info] 0 APR:: modules loaded
> [Mon May 23 17:10:32 2005] [info] base server + 27 vhosts ready to run tests
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread -1212529568 (LWP 11107)]
> 0xb75a86dc in ap_pcw_walk_files_config (pconf=0x80c20a8, s=0x80c8018, 
>     dconf=0x80fe4a8, modp=0xb75bb500, 
>     dir_cb=0xb75a82d0 <modperl_hash_handlers_dir>, data=0x0)
>     at modperl_pcw.c:67
> 67        ap_conf_vector_t **dirs = (ap_conf_vector_t 
> **)dconf->sec_file->elts;
> (gdb) bt
> #0  0xb75a86dc in ap_pcw_walk_files_config (pconf=0x80c20a8, s=0x80c8018, 
>     dconf=0x80fe4a8, modp=0xb75bb500, 
>     dir_cb=0xb75a82d0 <modperl_hash_handlers_dir>, data=0x0)
>     at modperl_pcw.c:67
[...]
> #5  0x08087d7e in main ()
> (gdb) 

It would be quite helpfull if you could just get me:

(gdb) print *dconf
(gdb) print *(dconf->sec_file)

Until I can figure out how to reproduce this.

> In order to isolate the problem further I changed line 118 of modperl_pcw.c 
> from
>   if (dir_cb) {
> to 
>   if (dir_cb && 0) {
> 
> and mod-perl2 started working! So there seems to be a problem with
> reading configuration files/directories somehow.

Do you mean that the test suite passed _all_ it's tests or that the server
simply started up ? Because that patch would disable quite a few important
things.

Can you also try this patch ?

Index: src/modules/perl/modperl_pcw.c
===================================================================
--- src/modules/perl/modperl_pcw.c      (revision 171298)
+++ src/modules/perl/modperl_pcw.c      (working copy)
@@ -26,8 +26,13 @@
                                  ap_pcw_dir_cb_t dir_cb, void *data)
 {
     int i;
-    ap_conf_vector_t **urls = (ap_conf_vector_t **)sconf->sec_url->elts;
+    ap_conf_vector_t **urls;

+    if (!sconf->sec_url) {
+        return;
+    }
+
+    urls = (ap_conf_vector_t **)sconf->sec_url->elts;
     for (i = 0; i < sconf->sec_url->nelts; i++) {
         core_dir_config *conf =
             ap_get_module_config(urls[i], &core_module);
@@ -45,8 +50,13 @@
                                   ap_pcw_dir_cb_t dir_cb, void *data)
 {
     int i;
-    ap_conf_vector_t **dirs = (ap_conf_vector_t **)sconf->sec_dir->elts;
+    ap_conf_vector_t **dirs;

+    if (!sconf->sec_dir) {
+        return;
+    }
+
+    dirs = (ap_conf_vector_t **)sconf->sec_dir->elts;
     for (i = 0; i < sconf->sec_dir->nelts; i++) {
         core_dir_config *conf =
             ap_get_module_config(dirs[i], &core_module);
@@ -64,9 +74,15 @@
                               ap_pcw_dir_cb_t dir_cb, void *data)
 {
     int i;
-    ap_conf_vector_t **dirs = (ap_conf_vector_t **)dconf->sec_file->elts;
+    ap_conf_vector_t **dirs;

-    for (i = 0; i < dconf->sec_file->nelts; i++) {
+    if (!dconf->sec_file) {
+        return;
+    }
+
+   dirs = (ap_conf_vector_t **)dconf->sec_file->elts;
+
+   for (i = 0; i < dconf->sec_file->nelts; i++) {
         core_dir_config *conf =
             ap_get_module_config(dirs[i], &core_module);
         void *dir_cfg = ap_get_module_config(dirs[i], modp);

--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to