You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Flavio Curti <fc...@gmail.com> on 2005/05/23 17:19:27 UTC

[mp2] segfaulting apache in ap_pcw_walk_files_config

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
#1  0xb75a889e in ap_pcw_walk_config (pconf=0x80c20a8, s=0x80c8018, 
    modp=0xb75bb500, data=0x0, dir_cb=0xb75a82d0 <modperl_hash_handlers_dir>, 
    srv_cb=0xb75a8390 <modperl_hash_handlers_srv>) at modperl_pcw.c:121
#2  0xb75a851a in modperl_mgv_hash_handlers (p=0x0, s=0x0) at modperl_mgv.c:520
#3  0xb759ac52 in modperl_hook_post_config_last (pconf=0x80c20a8, 
    plog=0x80f8180, ptemp=0x80fa188, s=0x80c8018) at mod_perl.c:701
#4  0x080824ca in ap_run_post_config ()
#5  0x08087d7e in main ()
(gdb) 

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.

Thank you for your help and regards

Flavio Curti

t/REPORT follows here:

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

  [DESCRIBE THE PROBLEM HERE]

2. Used Components and their Configuration:

*** mod_perl version 2.000000

*** using /usr/src/debian-packages/cyb-mod-perl2/mod_perl-2.0.0/lib/Apache2/BuildConfig.pm

*** Makefile.PL options:
  MP_APR_LIB     => aprext
  MP_APXS        => /usr/sbin/apxs
  MP_CCOPTS      => -g -Wall
  MP_COMPAT_1X   => 1
  MP_DEBUG       => 0
  MP_GENERATE_XS => 1
  MP_LIBNAME     => mod_perl
  MP_TRACE       => 0
  MP_USE_DSO     => 1
  MP_USE_GTOP    => 1


*** /usr/sbin/httpd2 -V
Server version: Apache/2.0.54
Server built:   May 17 2005 21:47:54
Server's Module Magic Number: 20020903:9
Architecture:   32-bit
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D HTTPD_ROOT=""
 -D SUEXEC_BIN="yes"
 -D DEFAULT_PIDLOG="/var/run/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="/var/run/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="/etc/httpd2/mime.types"
 -D SERVER_CONFIG_FILE="/etc/httpd2/httpd2.conf"


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

 -L/usr/lib -laprutil-0 -lgdbm -ldb-4.2 -lexpat
 -L/usr/lib -lapr-0 -lrt -lm -lnsl  -lpthread



*** /usr/bin/perl -V
Summary of my perl5 (revision 5 version 8 subversion 4) configuration:
  Platform:
    osname=linux, osvers=2.4.27-ti1211, archname=i386-linux-thread-multi
    uname='linux kosh 2.4.27-ti1211 #1 sun sep 19 18:17:45 est 2004
i686 gnulinux '
    config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN
-Dcccdlflags=-fPIC -Darchname=i386-linux -Dprefix=/usr
-Dprivlib=/usr/share/perl/5.8 -Darchlib=/usr/lib/perl/5.8
-Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5
-Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local
-Dsitelib=/usr/local/share/perl/5.8.4
-Dsitearch=/usr/local/lib/perl/5.8.4 -Dman1dir=/usr/share/man/man1
-Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1
-Dsiteman3dir=/usr/local/man/man3 -Dman1ext=1 -Dman3ext=3perl
-Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Uusesfio -Uusenm
-Duseshrplib -Dlibperl=libperl.so.5.8.4 -Dd_dosuid -des'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=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='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
-DDEBIAN -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN
-fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='3.3.5 (Debian 1:3.3.5-9)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lgdbm -lgdbm_compat -ldb -ldl -lm -lpthread -lc -lcrypt
    perllibs=-ldl -lm -lpthread -lc -lcrypt
    libc=/lib/libc-2.3.2.so, so=so, useshrplib=true, libperl=libperl.so.5.8.4
    gnulibc_version='2.3.2'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES
PERL_IMPLICIT_CONTEXT
  Built under linux
  Compiled at Mar  8 2005 19:51:48
  %ENV:
    PERL_LWP_USE_HTTP_10="1"
  @INC:
    /etc/perl
    /usr/local/lib/perl/5.8.4
    /usr/local/share/perl/5.8.4
    /usr/lib/perl5
    /usr/share/perl5
    /usr/lib/perl/5.8
    /usr/share/perl/5.8
    /usr/local/lib/site_perl
    /usr/local/lib/perl/5.8.3
    /usr/local/share/perl/5.8.3
    /usr/local/lib/perl/5.8.1
    /usr/local/share/perl/5.8.1
    .

*** Packages of interest status:

Apache2            : -
Apache2::Request   : -
CGI                : 3.04
ExtUtils::MakeMaker: 6.17
LWP                : 5.803
mod_perl           : -
CONTEXT
  Built under linux
  Compiled at Mar  8 2005 19:51:48
  %ENV:
    PERL_LWP_USE_HTTP_10="1"
  @INC:
    /etc/perl
    /usr/local/lib/perl/5.8.4
    /usr/local/share/perl/5.8.4
    /usr/lib/perl5
    /usr/share/perl5
    /usr/lib/perl/5.8
    /usr/share/perl/5.8
    /usr/local/lib/site_perl
    /usr/local/lib/perl/5.8.3
    /usr/local/share/perl/5.8.3
    /usr/local/lib/perl/5.8.1
    /usr/local/share/perl/5.8.1
    .

*** Packages of interest status:

Apache2            : -
Apache2::Request   : -
CGI                : 3.04
ExtUtils::MakeMaker: 6.17
LWP                : 5.803
mod_perl           : -
mod_perl2          : -

-- 
http://no-way.org/~fcu/

Re: [mp2] segfaulting apache in ap_pcw_walk_files_config

Posted by Flavio Curti <fc...@gmail.com>.
Hi List

(Sorry for sending it private instead of to the list first...)

On 5/25/05, Philippe M. Chiasson <go...@ectoplasm.org> wrote:
> > If you need anything else just tell me. If a verbose test-report is
> > needed just tell me which test.
> Actually, I'd like to have a look at your httpd.conf (the whole thing)
> and any other conf files it might Include. This set of circumstances is
> triggered by a specific configuration case I believe, and I need to
> figure out what it is.

Okay, I have put up the config files to a website[1] as they are
rather huge for posting in an email. They are the ones that are
generated by make test. Could it be something with how apache is
compiled? I run apache with a custom-built debian package, would it
help if I post you something from that build?


Hope that helps and kind regards

Flavio

[1] https://no-way.org/~fcu/mod_perl2_segfault_config/

-- 
http://no-way.org/~fcu/

Re: [mp2] segfaulting apache in ap_pcw_walk_files_config

Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
Flavio Curti wrote:
> Hi Philippe & List
> 
> (Sorry for not looking in the archives good enough!)
> 
> On 5/24/05, Philippe M. Chiasson <go...@ectoplasm.org> wrote:
> 
>>Flavio Curti wrote:
>>
>>>I have a problem running mod_perl-2.0.0 (and the latest devel snapshot too):
>>
>>It would be quite helpfull if you could just get me:
>>(gdb) print *dconf
>>(gdb) print *(dconf->sec_file)
> 
> [...]

Thanks for the dumps.

>>>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.
> 
> Well, yeah it simply didn't segfault anymore. From running make test
> it seemed that many
> tests failed so I didn't bother running it through.

Okay, makes sense.

>>Can you also try this patch ?
> 
> Okay, I applied this patch to the 2.0 Version. Apache no longer
> segfaults but 201 out of 229 test scripts fail:
> Failed 201/229 test scripts, 12.23% okay. 377/684 subtests failed, 44.88% okay.
> Judging from the error_log it's because the apache-childs segfault. I
> have attached with gdb to the running test apache, and when accessing
> http://localhost:8531/TestUser__rewrite_real the child segfaults:
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread -1212529568 (LWP 23182)]
> 0xb759acbf in modperl_hook_create_request (r=0x959e028) at mod_perl.c:718
> 718	    MP_dRCFG;
> (gdb) bt
> #0  0xb759acbf in modperl_hook_create_request (r=0x959e028) at mod_perl.c:718
> #1  0x0809ad55 in ap_run_create_request ()
> #2  0x08092491 in ap_read_request ()
> #3  0x0806cb58 in _start ()
> #4  0x095980e8 in ?? ()
> #5  0x00000003 in ?? ()
> #6  0x00000000 in ?? ()
> #7  0xb75b3ec0 in modperl_process_connection_handler (c=0x0)
>     at modperl_hooks.c:17
> #8  0x0808da55 in ap_run_process_connection ()
> #9  0x08080e94 in ap_graceful_stop_signalled ()
> #10 0x08080fe7 in ap_graceful_stop_signalled ()
> #11 0x08081279 in ap_graceful_stop_signalled ()
> #12 0x08081965 in ap_mpm_run ()
> #13 0x08087efd in main ()
> 
> If you need anything else just tell me. If a verbose test-report is
> needed just tell me which test.

Actually, I'd like to have a look at your httpd.conf (the whole thing)
and any other conf files it might Include. This set of circumstances is
triggered by a specific configuration case I believe, and I need to
figure out what it is.

> Thank you very much for your help and kind regards

No problem, that's why were here ! Keep the high quality bug reports coming in!

--------------------------------------------------------------------------------
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

Re: [mp2] SOLVED? segfaulting apache in ap_pcw_walk_files_config

Posted by Flavio Curti <fc...@gmail.com>.
Hi John

On 5/26/05, John D Groenveld <jd...@elvis.arl.psu.edu> wrote:
> In message <25...@mail.gmail.com>, Flavio Curti writes:
> >> Apache:
> >>         CFLAGS="-Wall -g -O2 -pipe -I/usr/include/xmltok
> >> -I/usr/include/openssl  -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 "
> >> LDFLAGS="-ldl -lexpat -lcrypt -ldb-4.2" \
> >> ./configure \
> >> --with-program-name=httpd2 --with-dbm=db42 \
> >statement below and the segfaults are gone. Maybe you have an idea
> >what is wrong with the way I'm configuring apache...
> Under Solaris when I configured Apache2 with largefile support, I
> needed to edit apr_rules.mk and config_vars.mk in /opt/apache2/build
> and add -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 to EXTRA_CPPFLAGS
> so that modperl would also be build largefile aware.

Thank you John that really was it. As soon as I add those two to
EXTRA_CPPFLAGS in config_vars.mk the segfaulting is gone. I wonder
where the mistake lies. In apache for not filling EXTRA_CPPFLAGS? Me
not setting it at all for CPPFLAGS? mod_perl not detecting it? (btw
setting CPPFLAGS when compiling apache doesn't help, it has to be in
EXTRA_CPPFLAGS) (also setting CPPFLAGS on compiling mod_perl does not
work, it has to come from the config_vars.mk file)...

Thank you all for you help and kind regards

Flavio Curti

-- 
http://no-way.org/~fcu/

Re: [mp2] segfaulting apache in ap_pcw_walk_files_config

Posted by Flavio Curti <fc...@gmail.com>.
Hi

On 5/26/05, Flavio Curti <fc...@gmail.com> wrote:
> Anyway, I will send you the configure commands from my custom debian Packages:
> > Can you send me the _exact_ commands you use to configure apache and mod_perl ?
> (I noticed that I set CFLAGS for the apache build but none for
> mod_perl and tried setting the sames for mod_perl, didn't help)
> mod-perl:
>   perl Makefile.PL MP_APXS=/usr/sbin/apxs MP_DEBUG=1
> 
> Apache:
>         CFLAGS="-Wall -g -O2 -pipe -I/usr/include/xmltok
> -I/usr/include/openssl  -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 "
> LDFLAGS="-ldl -lexpat -lcrypt -ldb-4.2" \
> ./configure \
> --with-program-name=httpd2 --with-dbm=db42 \

I played around some more and have it running now, although not very
satisfying for me. I compiled apache using the very simple configure
statement below and the segfaults are gone. Maybe you have an idea
what is wrong with the way I'm configuring apache...

./configure --prefix=/usr/local/apache2/ --enable-shared=max


Thank you and kind regards

Flavio

-- 
http://no-way.org/~fcu/

Re: [mp2] segfaulting apache in ap_pcw_walk_files_config

Posted by Flavio Curti <fc...@gmail.com>.
On 5/26/05, Philippe M. Chiasson <go...@ectoplasm.org> wrote:
> Oupss, my bad, that should have been
> (gdb) print *s
> (gdb) print *dconf
(gdb) print *s
$1 = {process = 0x80c0120, next = 0x935a270, defn_name = 0x0, 
  defn_line_number = 0, server_admin = 0x81e8678 "you@example.com", 
  server_hostname = 0x81e84d8 "localhost", port = 8529, 
  error_fname = 0x81e85d0
"/usr/src/debian-packages/cyb-mod-perl2/mod_perl-2.0.0/t/logs/error_log",
error_log = 0x80f8240, loglevel = 7, is_virtual = 0,
  module_config = 0x80fc240, lookup_defaults = 0x80fd590, addrs = 0x80fc1d8, 
  timeout = 300000000, keep_alive_timeout = 15000000, keep_alive_max = 100, 
  keep_alive = 1, path = 0x0, pathlen = 0, names = 0x0, wild_names = 0x0, 
  limit_req_line = 8190, limit_req_fieldsize = 8190, limit_req_fields = 100}
(gdb) print *dconf
$2 = {d = 0x0, d_components = 0, opts = 31 '\037', opts_add = 0 '\0', 
  opts_remove = 0 '\0', override = 63 '?', ap_default_type = 0x0, 
  satisfy = 0x80fe528, ap_auth_type = 0x0, ap_auth_name = 0x0, 
  ap_requires = 0x0, response_code_strings = 0x0, hostname_lookups = 0, 
  do_rfc1413 = -2, content_md5 = -2, use_canonical_name = 3, d_is_fnmatch = 0, 
  add_default_charset = 2, add_default_charset_name = 0x80a76f7 "iso-8859-1", 
  limit_cpu = 0x0, limit_mem = 0x0, limit_nproc = 0x0, limit_req_body = -1, 
  limit_xml_body = -1, server_signature = 4294967295, loglevel = 2, 
  sec_file = 0x0, r = 0x80fe628, mime_type = 0x0, handler = 0x0, 
  output_filters = 0x0, input_filters = 0x0, accept_path_info = 0, 
  ct_output_filters = 0x3, etag_bits = 0, etag_add = 0, etag_remove = 0, 
  enable_mmap = 0, enable_sendfile = 0, allow_encoded_slashes = 0}
(gdb) 
> Okay, so you've got a slightly strange build situation ;-)

Yes I realized this as well and tried different thing for normalising
it. I compiled Apache the standard way and it didn't help out. Except
from the httpd2 packages this is a stock debian sarge and sid
system...

Anyway, I will send you the configure commands from my custom debian Packages:

> Can you send me the _exact_ commands you use to configure apache and mod_perl ?
(I noticed that I set CFLAGS for the apache build but none for
mod_perl and tried setting the sames for mod_perl, didn't help)
mod-perl:
  perl Makefile.PL MP_APXS=/usr/sbin/apxs MP_DEBUG=1

Apache:
        CFLAGS="-Wall -g -O2 -pipe -I/usr/include/xmltok
-I/usr/include/openssl  -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 "
LDFLAGS="-ldl -lexpat -lcrypt -ldb-4.2" \
./configure \
--with-program-name=httpd2 --with-dbm=db42 \
        --enable-logio \
--localstatedir=/var/log/apache \
--with-mpm=prefork \
--enable-so \
--enable-charset-lite \
--enable-deflate=shared \
--enable-mime-magic=shared \
--enable-cern-meta \
--enable-expires=shared \
--enable-headers \
--enable-ssl=shared \
--enable-proxy=shared \
--enable-proxy-connect=shared \
--enable-proxy-ftp=shared \
--enable-proxy-http=shared \
--enable-http \
--enable-info=shared \
--enable-cgi=shared \
--enable-cache=shared \
--enable-mem-cache=shared \
--enable-disk-cache=shared \
--enable-usertrack=shared \
--enable-unique-id=shared \
--enable-dav=shared \
--enable-dav-fs=shared \
--enable-vhost-alias=shared \
--enable-auth=shared \
--enable-auth-anon=shared \
--enable-auth-dbm=shared \
--enable-auth-digest=shared \
--enable-file-cache=shared \
--enable-speling=shared \
--enable-rewrite=shared \
--with-suexec-bin \
--enable-layout=Cyberlink

Hope that helps and thank you

Flavio Curti
-- 
http://no-way.org/~fcu/

Re: [mp2] segfaulting apache in ap_pcw_walk_files_config

Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
Flavio Curti wrote:
> Hi Philippe
> 
> On 5/25/05, Philippe M. Chiasson <go...@ectoplasm.org> wrote:
> 
>>Hrm, so far, I've looked at the configuration files you've sent me and they
>>look kosher. I was thinking something bogus inherited from your debian's
>>configuration...Guess not.
>>
>>One more gdb peek for me please to try and pin this problem down some more.
>>(gdb) print *s
>>(gdb) print *pconf
> 
> Gives:
> (gdb) print *s
> $1 = {process = 0x80c0120, next = 0x934b6b8, defn_name = 0x0, 
>   defn_line_number = 0, server_admin = 0x81f1238 "webmaster@schalch-it.ch", 
>   server_hostname = 0x81f1120 "localhost", port = 8529, 
>   error_fname = 0x81f11c8 "/usr/local/src/modperl-2.0/t/logs/error_log", 
>   error_log = 0x80f8208, loglevel = 7, is_virtual = 0, 
>   module_config = 0x80fc240, lookup_defaults = 0x80fd590, addrs = 0x80fc1d8, 
>   timeout = 300000000, keep_alive_timeout = 15000000, keep_alive_max = 100, 
>   keep_alive = 1, path = 0x0, pathlen = 0, names = 0x0, wild_names = 0x0, 
>   limit_req_line = 8190, limit_req_fieldsize = 8190, limit_req_fields = 100}
> (gdb) print *pconf

Oupss, my bad, that should have been
(gdb) print *s
(gdb) print *dconf

> $2 = <incomplete type>
> 
>>the server_rec should at least show which vhost in your config creates this
>>bogus state...
> 
> This looks like the main server (localhost:8529). I also tried it with
> my default httpd.conf with all vhosts removed and it segfaults too,
> and the gdb output looks the same...

Yeah, I was wondering about this and hoping it would point to a simple 3 line
vhost. Guess not.

>>So, how can sec_file ever be NULL ? From looking at this dconf dump, it's clear

> I don't know. One thing I remember now seeing during one of the first
> mod_perl build was a warning that apxs -q PREFIX doesn't return a
> valid value. I fixed it then by setting it to / in the apxs script.
> Maybe I managed to screw up apaches build, setting prefix to NULL?
> 
> And indeed I found that the custom layout for apache has prefix set to
> NULL there. So I have rebuilded everything (apache, mod_perl) with
> prefix set to / in the layout and the warnings are gone now.
> Unfortunately this didn't help at all for the segfaulting :(

Okay, so you've got a slightly strange build situation ;-)

Can you send me the _exact_ commands you use to configure apache and mod_perl ?

./configure [...]
perl Makefile.PL [...]

--------------------------------------------------------------------------------
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

Re: [mp2] segfaulting apache in ap_pcw_walk_files_config

Posted by Flavio Curti <fc...@gmail.com>.
Hi Philippe

On 5/25/05, Philippe M. Chiasson <go...@ectoplasm.org> wrote:
> Hrm, so far, I've looked at the configuration files you've sent me and they
> look kosher. I was thinking something bogus inherited from your debian's
> configuration...Guess not.
> 
> One more gdb peek for me please to try and pin this problem down some more.
> (gdb) print *s
> (gdb) print *pconf

Gives:
(gdb) print *s
$1 = {process = 0x80c0120, next = 0x934b6b8, defn_name = 0x0, 
  defn_line_number = 0, server_admin = 0x81f1238 "webmaster@schalch-it.ch", 
  server_hostname = 0x81f1120 "localhost", port = 8529, 
  error_fname = 0x81f11c8 "/usr/local/src/modperl-2.0/t/logs/error_log", 
  error_log = 0x80f8208, loglevel = 7, is_virtual = 0, 
  module_config = 0x80fc240, lookup_defaults = 0x80fd590, addrs = 0x80fc1d8, 
  timeout = 300000000, keep_alive_timeout = 15000000, keep_alive_max = 100, 
  keep_alive = 1, path = 0x0, pathlen = 0, names = 0x0, wild_names = 0x0, 
  limit_req_line = 8190, limit_req_fieldsize = 8190, limit_req_fields = 100}
(gdb) print *pconf
$2 = <incomplete type>

> the server_rec should at least show which vhost in your config creates this
> bogus state...

This looks like the main server (localhost:8529). I also tried it with
my default httpd.conf with all vhosts removed and it segfaults too,
and the gdb output looks the same...

> So, how can sec_file ever be NULL ? From looking at this dconf dump, it's clear

I don't know. One thing I remember now seeing during one of the first
mod_perl build was a warning that apxs -q PREFIX doesn't return a
valid value. I fixed it then by setting it to / in the apxs script.
Maybe I managed to screw up apaches build, setting prefix to NULL?

And indeed I found that the custom layout for apache has prefix set to
NULL there. So I have rebuilded everything (apache, mod_perl) with
prefix set to / in the layout and the warnings are gone now.
Unfortunately this didn't help at all for the segfaulting :(

> that this core_dir_config is at least partially initialized,
> add_default_charset_name being set to the right thing for instance.

Hope that helps and kind regards

Flavio Curti

-- 
http://no-way.org/~fcu/

Re: [mp2] segfaulting apache in ap_pcw_walk_files_config

Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
Flavio Curti wrote:
> Hi Philippe & List
> On 5/24/05, Philippe M. Chiasson <go...@ectoplasm.org> wrote:
>>Flavio Curti wrote:
>>
>>>I have a problem running mod_perl-2.0.0 (and the latest devel snapshot too):
>>
>>It would be quite helpfull if you could just get me:
>>(gdb) print *dconf
>>(gdb) print *(dconf->sec_file)

Hrm, so far, I've looked at the configuration files you've sent me and they
look kosher. I was thinking something bogus inherited from your debian's
configuration...Guess not.

One more gdb peek for me please to try and pin this problem down some more.
(gdb) print *s
(gdb) print *pconf

the server_rec should at least show which vhost in your config creates this
bogus state...

> [Switching to Thread -1212529568 (LWP 16147)]
> 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) print *dconf
> $1 = {d = 0x0, d_components = 0, opts = 31 '\037', opts_add = 0 '\0', 
>   opts_remove = 0 '\0', override = 63 '?', ap_default_type = 0x0, 
>   satisfy = 0x80fe528, ap_auth_type = 0x0, ap_auth_name = 0x0, 
>   ap_requires = 0x0, response_code_strings = 0x0, hostname_lookups = 0, 
>   do_rfc1413 = -2, content_md5 = -2, use_canonical_name = 3, d_is_fnmatch = 0, 
>   add_default_charset = 2, add_default_charset_name = 0x80a76d7 "iso-8859-1", 
>   limit_cpu = 0x0, limit_mem = 0x0, limit_nproc = 0x0, limit_req_body = -1, 
>   limit_xml_body = -1, server_signature = 4294967295, loglevel = 2, 
>   sec_file = 0x0, r = 0x80fe628, mime_type = 0x0, handler = 0x0, 
>   output_filters = 0x0, input_filters = 0x0, accept_path_info = 0, 
>   ct_output_filters = 0x3, etag_bits = 0, etag_add = 0, etag_remove = 0, 
>   enable_mmap = 0, enable_sendfile = 0, allow_encoded_slashes = 0}

Looks like a busted/uninitialized core_dir_config, but that doesn't make
much sense to me. Looking at server/core.c:

static void *create_core_dir_config(apr_pool_t *a, char *dir)
{
    core_dir_config *conf;
    [...]
    conf->sec_file = apr_array_make(a, 2, sizeof(ap_conf_vector_t *));
    [...]

So, how can sec_file ever be NULL ? From looking at this dconf dump, it's clear
that this core_dir_config is at least partially initialized,
add_default_charset_name being set to the right thing for instance.

Very strange...

--------------------------------------------------------------------------------
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

Re: [mp2] segfaulting apache in ap_pcw_walk_files_config

Posted by Flavio Curti <fc...@gmail.com>.
Hi Philippe & List

(Sorry for not looking in the archives good enough!)

On 5/24/05, Philippe M. Chiasson <go...@ectoplasm.org> wrote:
> Flavio Curti wrote:
> > I have a problem running mod_perl-2.0.0 (and the latest devel snapshot too):
> It would be quite helpfull if you could just get me:
> (gdb) print *dconf
> (gdb) print *(dconf->sec_file)
[Switching to Thread -1212529568 (LWP 16147)]
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) print *dconf
$1 = {d = 0x0, d_components = 0, opts = 31 '\037', opts_add = 0 '\0', 
  opts_remove = 0 '\0', override = 63 '?', ap_default_type = 0x0, 
  satisfy = 0x80fe528, ap_auth_type = 0x0, ap_auth_name = 0x0, 
  ap_requires = 0x0, response_code_strings = 0x0, hostname_lookups = 0, 
  do_rfc1413 = -2, content_md5 = -2, use_canonical_name = 3, d_is_fnmatch = 0, 
  add_default_charset = 2, add_default_charset_name = 0x80a76d7 "iso-8859-1", 
  limit_cpu = 0x0, limit_mem = 0x0, limit_nproc = 0x0, limit_req_body = -1, 
  limit_xml_body = -1, server_signature = 4294967295, loglevel = 2, 
  sec_file = 0x0, r = 0x80fe628, mime_type = 0x0, handler = 0x0, 
  output_filters = 0x0, input_filters = 0x0, accept_path_info = 0, 
  ct_output_filters = 0x3, etag_bits = 0, etag_add = 0, etag_remove = 0, 
  enable_mmap = 0, enable_sendfile = 0, allow_encoded_slashes = 0}
(gdb) print *(dconf->sec_file)
Cannot access memory at address 0x0
(gdb) 

> > 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.

Well, yeah it simply didn't segfault anymore. From running make test
it seemed that many
tests failed so I didn't bother running it through.
 
> Can you also try this patch ?
Okay, I applied this patch to the 2.0 Version. Apache no longer
segfaults but 201 out of 229 test scripts fail:
Failed 201/229 test scripts, 12.23% okay. 377/684 subtests failed, 44.88% okay.
Judging from the error_log it's because the apache-childs segfault. I
have attached with gdb to the running test apache, and when accessing
http://localhost:8531/TestUser__rewrite_real the child segfaults:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1212529568 (LWP 23182)]
0xb759acbf in modperl_hook_create_request (r=0x959e028) at mod_perl.c:718
718	    MP_dRCFG;
(gdb) bt
#0  0xb759acbf in modperl_hook_create_request (r=0x959e028) at mod_perl.c:718
#1  0x0809ad55 in ap_run_create_request ()
#2  0x08092491 in ap_read_request ()
#3  0x0806cb58 in _start ()
#4  0x095980e8 in ?? ()
#5  0x00000003 in ?? ()
#6  0x00000000 in ?? ()
#7  0xb75b3ec0 in modperl_process_connection_handler (c=0x0)
    at modperl_hooks.c:17
#8  0x0808da55 in ap_run_process_connection ()
#9  0x08080e94 in ap_graceful_stop_signalled ()
#10 0x08080fe7 in ap_graceful_stop_signalled ()
#11 0x08081279 in ap_graceful_stop_signalled ()
#12 0x08081965 in ap_mpm_run ()
#13 0x08087efd in main ()

If you need anything else just tell me. If a verbose test-report is
needed just tell me which test.

Thank you very much for your help and kind regards

Flavio

-- 
http://no-way.org/~fcu/

Re: [mp2] segfaulting apache in ap_pcw_walk_files_config

Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
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

Re: [mp2] segfaulting apache in ap_pcw_walk_files_config

Posted by Stas Bekman <st...@stason.org>.
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
> #1  0xb75a889e in ap_pcw_walk_config (pconf=0x80c20a8, s=0x80c8018, 
>     modp=0xb75bb500, data=0x0, dir_cb=0xb75a82d0 <modperl_hash_handlers_dir>, 
>     srv_cb=0xb75a8390 <modperl_hash_handlers_srv>) at modperl_pcw.c:121
> #2  0xb75a851a in modperl_mgv_hash_handlers (p=0x0, s=0x0) at modperl_mgv.c:520
> #3  0xb759ac52 in modperl_hook_post_config_last (pconf=0x80c20a8, 
>     plog=0x80f8180, ptemp=0x80fa188, s=0x80c8018) at mod_perl.c:701
> #4  0x080824ca in ap_run_post_config ()
> #5  0x08087d7e in main ()
> (gdb) 

Thanks for the complete report, Flavio. We had this problem reported 
before and Philippe was working on it as you can see from this thread
http://www.gossamer-threads.com/lists/modperl/dev/7190#7190
which is a great example how things suck when people don't trim their 
followups to the list :(

gozer, mind to take a look at this one, as you've been already working on 
this? Thanks!

> 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.



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