in reply to Debugging perl crash

This may be a compiler issue. Clang/LLVM is the future but it's not been as heavily tested with perl as GCC has. Just maybe something is off. Try building perl with gcc and see if the problem goes away.

cd /usr/ports/lang/gcc make install clean export CC=gcc .. Rebuild perl. Sounds like you are not using a port version..

I do have some heavy stuff running under perl v5.14.4 compiled by default clang on FreeBSD 10/x86_64. I've never seen crashes like you describe.

Replies are listed 'Best First'.
Re^2: Debugging perl crash
by vsespb (Chaplain) on Jun 29, 2014 at 16:53 UTC
    Yes, cannot reproduce under gcc. Clang only.

      Compile it with reduced optimization under clang and see if that makes the problem go away? At least that's a starting point to track down the real problem.

      Can you come up with a simple perl program that shows the issue?

      EDIT: Maybe this is more a thing for bugs.perl.org than perlmonks? It's certainly an interpreter and/or compiler bug.

        > Compile it with reduced optimization under clang and see if that makes the problem go away? At least that's a starting point to track down the real problem.
        ok thank you. i'll try.
        > Can you come up with a simple perl program that shows the issue? > EDIT: Maybe this is more a thing for bugs.perl.org than perlmonks? It's certainly an interpreter and/or compiler bug.

        I don't have proof of concept code. I don't have proof, except this thread where me and another user reproduced segfaults in two different scripts.

        I tried, but cannot reduce to proof-of-concept. Things that if code looks like:

        part1; part2; part3; part4;

        (partN - is a chunk of code or chunk of 'use' modules etc).

        problem goes aways if if remove part1 OR part2 OR part3.
        So I cannot reduce code.

        More important. Here is the script which reproduce problem for me (don't try to run it or understand how it works - it's undocummented internal script).
        problem is that _it_ does almost _nothing_. it:

        1. reads a line from stdin 2. fork() 3. wait() 4. that's it
        10 lines of code, maybe.
        But all heavy processing happening in child process. Child process cannot modify state of parent. But if I remove processings in child (or reduce data size), issue gone. It just does not make sense.
        Maybe overall heavy load of system (swapping, etc) or big delay between fork and wait causes the issue... But I was unable to reproduce it with script which simulates similar conditions, yet

        I think I reproduced it. It's as simple as:
        $ perl 4.pl Segmentation fault (core dumped) $ cat 4.pl #!/usr/bin/env perl use strict; use warnings; use Data::Dumper; unless (fork()) { my $sz = 2048*1024*1024; my $sc = "x" x $sz; exit(0); } wait(); print Dumper { a => 42}; exit();

        (note that $sz should be adjusted to take almost all free memory)
        Now I need verify again which versions are affected and report to either FreeBSD team or Perl Porters. I'll update my post.