maxhq has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

I am stuck in the following segfault problem for several days now and quite desperate...
Since some point (don't know if due to a CPAN upgrade or any other change to my Ubuntu 9.10), my Perl program keeps crashing with a core dump.

Trying to update some CPAN modules, a test script of Devel::Declare also caused a segfault: t/method-installer-runtime.t at this lines:
... method foo { $_[0]->method } ...

With gdb, I tracked down the problem to Sub::Name:

Core was generated by `/usr/bin/perl t/method-installer-runtime.t'. Program terminated with signal 11, Segmentation fault. #0 0x0057a561 in XS_Sub__Name_subname () from /usr/lib/perl5/auto/Sub +/Name/Name.so

Doing some research, in the Perl porters mailing list I found that Sub::Name is "known problematic"...
Besides that, there are two open bugs including patches for Sub::Name, but they are not about segmentation faults. In reply to one patch Sergey Aleynikov says: "this seems to solve problem with local()ized subref assigments to globs". Might that be relevant for me?

My Perl (compiled from Debian source) version is:

This is perl 5, version 12, subversion 0 (v5.12.0) built for i486-linu +x-gnu-thread-multi-64int-ld (with 27 registered patches, see perl -V for more detail)

Does anybody have some hints for me where the problem lies?

-maxhq

Replies are listed 'Best First'.
Re: Segfault in Sub::Name
by ig (Vicar) on May 04, 2010 at 18:15 UTC

    Are you mixing CPAN installs with Ubuntu/Debian package installs? This can sometimes lead to inconsistent states. How was perl installed? How were all your non-core modules installed? You say your perl is compiled from Debian source, but you provide a link to a directory of .deb packages. This suggests you are rebuilding and then installing the package, as opposed to building perl from the perl source code.

    You have traced the problem to Sub::Name. Have you tried removing and re-installing Sub::Name?

      You are absolutely right, by installing my compiled perl via dpkg instead of apt-get/synaptic I overlooked that there were some other perl libraries installed. These caused the trouble.
      Meanwhile I also know that the desribed crash wasn't the same as the original one (see my post below).

      Thank you for your hints!!

Re: Segfault in Sub::Name
by zwon (Abbot) on May 04, 2010 at 19:17 UTC

    How exactly have you installed perl 5.12.0 on Ubuntu 9.10? Because if you installed Debian packages they had to broke a lot of dependencies, particularly libsub-name-perl from Ubuntu 9.10 depends on perlapi-5.10.0, so you had to rebuild it too, and also a lot of other packages.

      Yes, I see, my approach was to naive ;-)

      Thank you for pointing that out!

Perl crash
by maxhq (Novice) on May 07, 2010 at 12:22 UTC

    Since I now know that the original crash had another cause as the one desribed above, now I did the following:

    • Replaced my Perl 5.12.0 with the original 5.10.0 .deb packages
    • Upgraded to Ubuntu 10.04, Perl 5.10.1
    • Emptied my (user) cpan directory and installed all necessary cpan modules again
    Now I have some similar crash to the original one with Perl 5.10.0 / Ubuntu 9.10 (then: crash in Perl_pad_swipe, now: crash in Perl_pad_free). The cause seems very complicated to me as it is a combination of serveral modules and code.

    I removed as much code as possible while making the script still crash.
    This is what remains, where the core dump / segfault disappears if I remove ANY of the parts marked by XXX.

    #!/usr/bin/perl -w use strict; use warnings; use POSIX; # XXX -- module use MooseX::Declare; use namespace::autoclean; # XXX -- module class Ida::Config with MooseX::Log::Log4perl is mutable { use strict; use warnings; use Moose::Util::TypeConstraints; # XXX -- some attribute has dummyAttribute => ( isa => 'Str', is => 'rw', default => sub { [] }, ); # XXX -- an unknown type method isAllowedIp(UnknownType $ip!) { return; } } 1;

    Result:

    tux@sm00123:~/Projects/infotool$ ./test2.pl 'UnknownType' could not be parsed to a type constraint - maybe you nee +d to pre-declare the type with class_type at /home/tux/CPAN/lib/perl5 +/MooseX/Declare/Syntax/MethodDeclaration.pm line 40 Segmentation fault (Speicherabzug geschrieben)

    The error code is ok, but why a segfault?

    Debugger gives me: