You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by John Banks <jo...@slink.net> on 2000/02/17 15:46:35 UTC

Segfaults with XML parser: how can I debug this?

Hi,
   I've got a script useing the XML::Grove modules which is
intermittently crashing with segmentation faults and I'm having trouble
tracking down the problem. I've built everything with debug, setup a
test environment where I can replicate the problem, and I'm running
Apache in -X mode under gdb. After handling around 70 requests OK it
crashes. How can I figure out what's going on here? I suspect it may be
a memory leak somewhere in the XML modules...

        Cheers,
          John


Program received signal SIGSEGV, Segmentation fault.
0x4011255c in chunk_free (ar_ptr=0x676b50, p=0x85eaaf8) at malloc.c:2960
malloc.c:2960: No such file or directory.
(gdb) bt
#0  0x4011255c in chunk_free (ar_ptr=0x676b50, p=0x85eaaf8) at
malloc.c:2960
#1  0x40112505 in __libc_free (mem=0x85eab00) at malloc.c:2932
#2  0x81075f3 in Perl_safefree (where=0x85eab00) at util.c:173
#3  0x8122f7d in Perl_sv_setsv (dstr=0x83fac44, sstr=0x85db150) at
sv.c:2261
#4  0x811638c in Perl_pp_sassign () at pp_hot.c:133
#5  0x8115bf4 in Perl_runops_debug () at run.c:66
#6  0x80d5782 in perl_call_sv (sv=0x81f939c, flags=4) at perl.c:1317
#7  0x807b51b in perl_call_handler (sv=0x81f939c, r=0x85735fc, args=0x0)
    at mod_perl.c:1510
#8  0x807ad4b in perl_run_stacked_handlers (hook=0x8170c79
"PerlHandler",
    r=0x85735fc, handlers=0x82314a8) at mod_perl.c:1239
#9  0x807951d in perl_handler (r=0x85735fc) at mod_perl.c:802
#10 0x80934d3 in ap_invoke_handler (r=0x85735fc) at http_config.c:508
#11 0x80a6779 in process_request_internal (r=0x85735fc) at
http_request.c:1214
#12 0x80a67dc in ap_process_request (r=0x85735fc) at http_request.c:1230
#13 0x809e1de in child_main (child_num_arg=0) at http_main.c:4035
#14 0x809e36c in make_child (s=0x81aa49c, slot=0, now=950797951)
    at http_main.c:4139
#15 0x809e4c9 in startup_children (number_to_start=4) at
http_main.c:4221
#16 0x809eaf6 in standalone_main (argc=2, argv=0xbffffd14) at
http_main.c:4509
#17 0x809f273 in main (argc=2, argv=0xbffffd14) at http_main.c:4830


-- 
===  John Banks                                      john@slink.net  ===
===  Sitelink Technology                       http://www.slink.net  ===

Re: Segfaults with XML parser: how can I debug this?

Posted by John Banks <jo...@slink.net>.
Matt Sergeant wrote:
> 
> On Fri, 18 Feb 2000, John Banks wrote:
> > Matt Sergeant wrote:
> > >
> > > On Thu, 17 Feb 2000, you wrote:
> > > > Hi,
> > > >    I've got a script useing the XML::Grove modules which is
> > > > intermittently crashing with segmentation faults and I'm having trouble
> > > > tracking down the problem. I've built everything with debug, setup a
> > > > test environment where I can replicate the problem, and I'm running
> > > > Apache in -X mode under gdb. After handling around 70 requests OK it
> > > > crashes. How can I figure out what's going on here? I suspect it may be
> > > > a memory leak somewhere in the XML modules...
> > >
> > > Does XML::Grove create circular references like XML::DOM? If so you have to
> > > explicitly dispose of the references using the API (I think it's
> > > $doc->dispose with XML::DOM).
> > >
> > > Also make sure you're on the latest version of XML::Parser - it's proved
> > > quite stable.
> > >
> >
> > Thanks for the comments. There doesn't appear to be an equivalent to the
> > dispose method for XML::Grove - if circular refences don't get cleaned
> > up I can see how the process size would grow, but it shouldn't make it
> > segfault(?) I've got XML::Parser 2.27 so I don't think that's the
> > problem.
> 
> I'd suggest dropping a line to Clark Cooper then with a core dump or
> something he can go on to debug the problem. Are you certain it's an
> XML::Parser problem?
> 

No, I'm not sure it's the XML modules which are the culprit, that's what
I'm trying to figure out - the traceback from the coredump is not very
helpful :-(  I'll see if I can put together a small self contained
script which replicates the problem...

       John

-- 
===  John Banks                                      john@slink.net  ===
===  Sitelink Technology                       http://www.slink.net  ===

Re: Segfaults with XML parser: how can I debug this?

Posted by Matt Sergeant <ma...@sergeant.org>.
On Fri, 18 Feb 2000, John Banks wrote:
> Matt Sergeant wrote:
> > 
> > On Thu, 17 Feb 2000, you wrote:
> > > Hi,
> > >    I've got a script useing the XML::Grove modules which is
> > > intermittently crashing with segmentation faults and I'm having trouble
> > > tracking down the problem. I've built everything with debug, setup a
> > > test environment where I can replicate the problem, and I'm running
> > > Apache in -X mode under gdb. After handling around 70 requests OK it
> > > crashes. How can I figure out what's going on here? I suspect it may be
> > > a memory leak somewhere in the XML modules...
> > 
> > Does XML::Grove create circular references like XML::DOM? If so you have to
> > explicitly dispose of the references using the API (I think it's
> > $doc->dispose with XML::DOM).
> > 
> > Also make sure you're on the latest version of XML::Parser - it's proved
> > quite stable.
> > 
> 
> Thanks for the comments. There doesn't appear to be an equivalent to the
> dispose method for XML::Grove - if circular refences don't get cleaned
> up I can see how the process size would grow, but it shouldn't make it
> segfault(?) I've got XML::Parser 2.27 so I don't think that's the
> problem.

I'd suggest dropping a line to Clark Cooper then with a core dump or
something he can go on to debug the problem. Are you certain it's an
XML::Parser problem?

-- 
<Matt/>

Details: FastNet Software Ltd - XML, Perl, Databases.
Tagline: High Performance Web Solutions
Web Sites: http://come.to/fastnet http://sergeant.org
Available for Consultancy, Contracts and Training.

Re: Segfaults with XML parser: how can I debug this?

Posted by John Banks <jo...@slink.net>.
Matt Sergeant wrote:
> 
> On Thu, 17 Feb 2000, you wrote:
> > Hi,
> >    I've got a script useing the XML::Grove modules which is
> > intermittently crashing with segmentation faults and I'm having trouble
> > tracking down the problem. I've built everything with debug, setup a
> > test environment where I can replicate the problem, and I'm running
> > Apache in -X mode under gdb. After handling around 70 requests OK it
> > crashes. How can I figure out what's going on here? I suspect it may be
> > a memory leak somewhere in the XML modules...
> 
> Does XML::Grove create circular references like XML::DOM? If so you have to
> explicitly dispose of the references using the API (I think it's
> $doc->dispose with XML::DOM).
> 
> Also make sure you're on the latest version of XML::Parser - it's proved
> quite stable.
> 

Thanks for the comments. There doesn't appear to be an equivalent to the
dispose method for XML::Grove - if circular refences don't get cleaned
up I can see how the process size would grow, but it shouldn't make it
segfault(?) I've got XML::Parser 2.27 so I don't think that's the
problem.

       John

-- 
===  John Banks                                      john@slink.net  ===
===  Sitelink Technology                       http://www.slink.net  ===

Re: Segfaults with XML parser: how can I debug this?

Posted by Matt Sergeant <ma...@sergeant.org>.
On Thu, 17 Feb 2000, you wrote:
> Hi,
>    I've got a script useing the XML::Grove modules which is
> intermittently crashing with segmentation faults and I'm having trouble
> tracking down the problem. I've built everything with debug, setup a
> test environment where I can replicate the problem, and I'm running
> Apache in -X mode under gdb. After handling around 70 requests OK it
> crashes. How can I figure out what's going on here? I suspect it may be
> a memory leak somewhere in the XML modules...

Does XML::Grove create circular references like XML::DOM? If so you have to
explicitly dispose of the references using the API (I think it's
$doc->dispose with XML::DOM).

Also make sure you're on the latest version of XML::Parser - it's proved
quite stable.

-- 
<Matt/>

Details: FastNet Software Ltd - XML, Perl, Databases.
Tagline: High Performance Web Solutions
Web Sites: http://come.to/fastnet http://sergeant.org
Available for Consultancy, Contracts and Training.