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

Hello Monks,

The forks module of my Perl installation is causing a segfault and I can't run any script that uses it. The problem appears to be serious, since even a one-line script containing the line use forks; causes a segfault!

Do you have any idea what might be wrong? Any ideas on how I can find out more about what's causing the segfault?

I'm using Perl 5.20.0 on Arch Linux (3.15.2-1-ARCH #1 SMP PREEMPT Fri Jun 27 07:41:19 CEST 2014 x86_64 GNU/Linux). On another computer running Perl 5.14.2 on Linux Mint (3.8.0-19-generic #30-Ubuntu SMP Wed May 1 16:35:23 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux) everything is fine!

Thanks in advance,

Panos

Replies are listed 'Best First'.
Re: forks.pm segfault
by zentara (Cardinal) on Jul 16, 2014 at 08:57 UTC
    Do you have any idea what might be wrong?

    I'm guessing from your post, that your Perl installs come from the distribution's package management system? If so, build Perl from scratch on your system, and I'll bet things fix themselves. I guess that the standard Perl they distribute got mis-aligned with their other libraries, so just build your own from the source code. It is very easy and illuminating to see how a Perl build goes. Maybe report it as a bug to the distros.


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
Re: forks.pm segfault
by Anonymous Monk on Jul 16, 2014 at 09:10 UTC
Re: forks.pm segfault
by zentara (Cardinal) on Jul 16, 2014 at 09:01 UTC
    Ooops, sorry for the double posting. How did that happen. ??? Curious.

    Do you have any idea what might be wrong?

    I'm guessing from your post, that your Perl installs come from the distribution's package management system? If so, build Perl from scratch on your system, and I'll bet things fix themselves. I guess that the standard Perl they distribute got mis-aligned with their other libraries, so just build your own from the source code. It is very easy and illuminating to see how a Perl build goes. Maybe report it as a bug to the distros.

    Use the Source, Luke, the Source.


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
Re: forks.pm segfault
by flexvault (Monsignor) on Jul 16, 2014 at 15:27 UTC

    panos80,

      Do you have any idea what might be wrong?

    I just checked every distribution I have from 5.8 to 5.16 on a Debian Linux box and I don't have a 'forks.pm'. So unless this is new for a release after 5.16, I think you just have to specify 'fork'. (Notice I didn't say 'use fork'.)

    UPDATE: Well I just installed 'forks' from CPAN, so my comments are all wrong!

    Regards...Ed

    "Well done is better than well said." - Benjamin Franklin

      So the system with the problem is a server to which I don't have root access. Which unfortunately means that I can't re-install Perl :( But I'll talk again with the admin and see if he can find a time window at which he can re-install Perl (quite a few other people are using this server).


      Also, while I could agree that the script's code isn't good enough, or that I should use threads instead of forks, the thing is that this same script runs fine on another machine!


      Many thanks for the help guys! Really appreciated!

Re: forks.pm segfault
by flexvault (Monsignor) on Jul 17, 2014 at 12:35 UTC

    panos80,

    You don't necessarily need to re-install Perl, but I would generate a local copy in an account on the server, and then issue:

    [YourLocalPerl] -MCPAN -e 'install "forks"'
    and look for errors. When I did the above, it compiled on AIX without any "tweeking", which is amazing.

    Good Luck...Ed

    "Well done is better than well said." - Benjamin Franklin