in reply to segmentation violations

One way that might shed some light on the source of the problem would be to profile it using Devel::DProf.

If you set the size of the output buffer (PERL_DPROF_BUFFER) to some thing fairly small, say 4K, then that ought to get you fairly close to where the failure occurs.

If, after failure eventually happens (your program will run very slowly), then examining (the quite probably huge output file (TMON.OUT by default) it should not only tell you where it was and what (roughly) it was doing when the failure occurred, but also the sequence of events that led up to it.

I've used this technique to get me much closer to the source of the failure, and give me hints on where to put tracing and/ or set break points. No guarentees that it won't change the point of failure to a completely different place, but even that can be a clue as to the cause.

HTH.

Ps. I am not kidding when I say your program will run slowly! Don;t sit and wait for it to fail. Start it running once you have you coat on and are leaving for the day (or going to bed or whatever). The output will be waiting for you in the morning:). Sitting and watching and waiting will drive you nuts.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
If I understand your problem, I can solve it! Of course, the same can be said for you.

Replies are listed 'Best First'.
Re: Re: segmentation violations
by Phomer (Novice) on Sep 11, 2003 at 21:25 UTC
    I profiled the code, and found that it was crashing in DB_File::DoTie_. I checked my version (1.72) and then upgraded to the latest on CPAN (1.802).

    When I ran the profile again, this time it crashed in one of my DEBUG routines. I ran it again, and it changed to one of my file locking routines. It seems to be jumping all over the place.

    So, I jumped to a FreeBSD machine running 5.6.1, checked out the code and re-ran the identical test and it worked without any problems. Besides the 5.6.1, the other machine also has a newer version of Berkeley DB, so I am rebuilding the DB version on my machine to see if that makes a difference.

    (Some time passes...) I changed from Berkeley DB 2.4.14 to 2.7.7 (to match one of the production machines), re-ran the script and sure enough, it moved the segmentation violation to yet another place in the code :-(

    At this point, I am have to go with the assumption that the problem is caused by Perl 5.6.0
      (Some time passes...)

      Sorry! I did warn you it slowed things down:)

      On the basis of what you have posted, I'd have to concur. It may well be that the 'fix' for 5.6.0 would be to downgrade your copy of DB_File rather than unpgrade, assuming the earlier version is still available, but if upgrading your build to 5.6.1 works, that is probably the easiest and safest route. There were lots of things fixed between 5.6.0, and 5.6.1, and your bug could well be another manifestation of one of those fixed bugs.

      You might try searching the changes file and bug lists for 5.6.0/5.6.1 and see if anything there looks like it might be your problem, but even if you found it, all you would know is that you had to upgrade to get the fix (or possibly where to obtain a patch so that you could re-build 5.6.0 to correct that one bug), but in the end, if the upgrade does the trick, knowing why it does is just icing.

      Good luck.


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
      If I understand your problem, I can solve it! Of course, the same can be said for you.