in reply to Re: Vague "bus error" question
in thread Vague "bus error" question

All of what Fletch said is good advice.

Don't try to make the problem "go away" with changes like adding log4perl.

If you manage to make it "go away" temporarily, you may never be able to recreate it under your control in order to diagnose the issue.

This is a symptom of a real problem somewhere either in your code, in perl, or in a module you're using, and think of this as your only chance to track it down before it breaks at 2am someday and you get paged :)

Take a look at the contents of %INC and @INC before your code dies. Any chance you're picking up a module built for a different perl version or slightly different platform?


Mike

Replies are listed 'Best First'.
Re^3: Vague "bus error" question
by loris (Hermit) on Oct 26, 2004 at 07:52 UTC
    Thanks to everyone for the help so far.

    I wasn't actually trying to make the problem go away by adding the call to log4perl. I was hoping to work out what was going on.

    I'm using version 5.8.3 and don't think it is a problem with incorrect modules or the like. However, I don't know how I would look at %ENV and @INC immediately before the seg fault or bus error.

    I suspect it is the recursion - the function being called uses LibXML version 1.58 to check some attributes of an XML tree. Although, even just putting a print in the loop over the children where the function calls itself also "removes" the problem, so this assumption may also be incorrect. As I now have another bug to correct, I shall return to the last working version, fix the second problem and try to implement and test the correction for the first problem more incrementally.

    I would post some code but:

    1. The program is written like C and peolple would laugh.
    2. It is rather convoluted (see 1) and it would probably take more more time to produce a simple example than to solve the problem in the first place (although maybe that would be a good approach to solving the problem anyway).

    Thanks again for the advice.

    loris

    Update

    OK, now I know what is causing the problem. It is something to do with LibXML (V 1.58). If I do:

    $parent->replaceChild($newNode,$oldNode);
    I get a segmentation fault. If I do:

    $parent->removeChild($oldNode); $parent->addChild($newNode);
    everything works OK. I would rather replace the node so that I don't have to worry keeping the ordering the same. Has anyone seen behaviour like that before? Thanks again for the help.

    loris