Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Re: segmentation faults

by Anonymous Monk
on Aug 21, 2002 at 14:12 UTC ( #191740=note: print w/replies, xml ) Need Help??


in reply to Re: segmentation faults
in thread segmentation faults

ain't got no password to login still, sorry ;) well, this exerpt of code isn't supposed to segfault, it is perfectly valid, but it did a certain number of times .... ( according to sigtrap ). The hash was a perfectly normal hash, no tying or whatsoever. What about XML::Parser ? Is it likely to segfault ?

Replies are listed 'Best First'.
Re: Re: Re: segmentation faults
by Anonymous Monk on Aug 21, 2002 at 14:15 UTC
    here is a portion of the stacktrace
    Caught a SIGSEGV at /usr/lib/perl5/site_perl/5.6.1/i386-linux/XML/Pars +er/Expat.pm line 469 $ = XML::Parser::Expat::parse('XML::Parser::Expat=HASH(0x81cc7bc)', *Q +MM_MOD::emi::DATA) called from file `/usr/lib/perl5/site_perl/5.6.1/i +386-linux/XML/Parser.pm' line 185 $ = eval {...} called from file `/usr/lib/perl5/site_perl/5.6.1/i386-l +inux/XML/Parser.pm' line 184 $ = XML::Parser::parse('XML::Parser=HASH(0x4040b97c)', *QMM_MOD::emi:: +DATA) called from file `/usr/lib/perl5/site_perl/5.6.1/i386-linux/QMM +_MOD/emi.pm' line 33
      yeah finally got my passwd ( had mistyped email :( )
      Anybody knows if XML::Parser actually uses a C library ?
Re: Re: Re: segmentation faults
by arturo (Vicar) on Aug 21, 2002 at 14:59 UTC

    It's not clear why XML::Parser is segfaulting if no calls are being made to it by that code. Segfaults usually indicate serious problems with external libraries, and aren't usually thrown by (stable) versions of perl unless it invokes them. I'm afraid diagnosis of this problem requires looking at more than just the code.

    One possiblity that pops to my mind is that your version of XML::Parser was compiled with a particular version of the expat C libraries, and that the version of expat installed on your system is a different one.

    HTH

    If not P, what? Q maybe?
    "Sidney Morgenbesser"

      Well not very sure about it actually. the thing is that it will parse my doc correctly 1000 times, then segfault. one thing that strikes me now, is that when I use it with no signalling in my script, it parses 100 000 times without a glitch. could be that signalling stuff that makes it segfault, i'm gonna try... Another thought about it : if it segfaults, then I can trap this signal. if I do, will my script go back to normal or die cause its buggy ? I'm gonna try...
        Signals and perl don't mix very well.

        In perls < 5.8 (?), your signal could get caught in the middle of an opcode execution, so your signal handler could wind up "reentering" a non-reentrant part of the perl core, like the regex engine.

        In perls after 5.8, your signal will be deferred until the current op completes, but it could still interrupt system calls, and not restart them, I believe.
        --
        Mike

      well I didn't know that it was also dangerous with the regexp engine. I'll be more cautious. Anyways Thanks to everybody, and if somebody that has the same problem reads this: one solution (without rewriting your script with a better logic) would be to ignore signals in subs containning dangerous code .

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://191740]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2023-09-22 07:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?