I'm getting occasional segfaults when calling the $r->pnotes()
method.

There are no errors in the error log, until I get a line like this:

[Sat Feb  5 19:36:58 2000] [notice] child pid 19989 exit signal
Segmentation fault (11), possible coredump in /backend/scratch

(I ran the mod_perl server on a high port as an unprivileged user so
that
it doesn't have to suid and is allowed to dump core.)

I've got a braindead apache proxy running on port 80 which proxies back
to 
the mod_perl server for dynamic content.

I've got a PerlTransHandler which runs for each request and sticks a
bunch
of data (acquired from cookies or munged urls) into a session object (of
my
own devising, not Apache::Session) which gets passed from handler to
handler
as a request pnote.bvg

The segfault behavior didn't come up in testing in our lab, but under
the 
heavy loads of the production systems it comes up every 1000-2000 hits
or so,
manifesting as a cluster of segfaulting child processes.

My knowledge of Perl internals is sketchy at best, but from the
backtrace below,
it looks like the segfaults are happening when Perl tries to allocate a
new
Hash struct for an undefined pnote.

Doug? Anyone? Does anyone have a clue as to what's going on here?

Code Snippet:
----------

sub handler{
  my $r = shift;
.
. # a bunch of code that determines what types of requests to decline
.
  my $emusic_param;
  my $Session = Emusic::Session->new;
  (undef,$emusic_param,@rest) = split '/', $r->uri;
  $Session->parse_emusic_params($emusic_param);  # gets useful info out
of the munged uri and puts it in the Session object
  $r->pnotes('session' => Session);
.
.# then we rebuild the URI from the leftovers...
.
  return DECLINED;
}


----------
Configuration:
----------
Apache 1.3.6, mod_per 1.21 (statically linked)
Linux 2.2.5
Makefile.pl options: EVERYTHING=1 PERL_DEBUG=1
ADD_MODULE=so,rewrite,proxy 
Linked against libperld.a.
----------

Here's a backtrace from gdb:
------
#0  XS_Apache_pnotes (cv=0x8230500) at Apache.xs:1636
1636        if(!cfg->pnotes) cfg->pnotes = newHV();
(gdb) bt
#0  XS_Apache_pnotes (cv=0x8230500) at Apache.xs:1636
#1  0x811a7f7 in Perl_pp_entersub () at pp_hot.c:2255
#2  0x8113504 in Perl_runops_debug () at run.c:66
#3  0x80d3092 in perl_call_sv (sv=0x895af10, flags=4) at perl.c:1317
#4  0x809114b in perl_call_handler (sv=0x895af10, r=0x89b289c, args=0x0)
at mod_perl.c:1510
#5  0x809097b in perl_run_stacked_handlers (hook=0x817282a
"PerlTransHandler", r=0x89b289c,
    handlers=0x895af40) at mod_perl.c:1239
#6  0x808f6fd in perl_translate (r=0x89b289c) at mod_perl.c:884
#7  0x80a8e14 in run_method (r=0x89b289c, offset=0, run_all=0) at
http_config.c:360
#8  0x80a8e70 in ap_translate_name (r=0x89b289c) at http_config.c:372
#9  0x80bc00c in process_request_internal (r=0x89b289c) at
http_request.c:1112
#10 0x80bc4ec in ap_process_request (r=0x89b289c) at http_request.c:1236
#11 0x80b41ee in child_main (child_num_arg=14) at http_main.c:3906
#12 0x80b444c in make_child (s=0x81a570c, slot=14, now=949779152) at
http_main.c:4034
#13 0x80b44f9 in startup_children (number_to_start=36) at
http_main.c:4061
#14 0x80b4b16 in standalone_main (argc=1, argv=0xbffffd34) at
http_main.c:4348
#15 0x80b5283 in main (argc=1, argv=0xbffffd34) at http_main.c:4649
#16 0x400a4cb3 in __libc_start_main (main=0x80b4f5c <main>, argc=1,
argv=0xbffffd34,
    init=0x80607f0 <_init>, fini=0x816903c <_fini>, rtld_fini=0x4000a350
<_dl_fini>,
    stack_end=0xbffffd2c) at ../sysdeps/generic/libc-start.c:78
------

'perl -V' sez:
------
Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=linux, osvers=2.2.5-15smp, archname=i686-linux
    uname='linux zebra.zoo.emusic.com 2.2.5-15smp #1 smp mon apr 19
22:43:28 edt 1999 i686 unknown '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O2', gccversion=egcs-2.91.66 19990314/Linux
(egcs-1.1.2 release)
    cppflags='-Dbool=char -DHAS_BOOL'
    ccflags ='-Dbool=char -DHAS_BOOL'
    stdchar='char', d_stdstdio=undef, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Built under linux
  Compiled at Jul 15 1999 02:15:18
  @INC:
    /usr/lib/perl5/5.00503/i686-linux
    /usr/lib/perl5/5.00503
    /usr/lib/perl5/site_perl/5.005/i686-linux
    /usr/lib/perl5/site_perl/5.005
    . 
------                                                                       

-- 
Kevin  | "Though there are ... few restrictions on the vote nowadays ... 
Murphy | some standards are still upheld ... at last report, the votes 
       | from the entire God-forsaken state of Texas are still thrown, 
       | uncounted and burning, into the River Charles." - T.H. Zweibel

Reply via email to