in reply to Segmentation fault: problem with perl threads

There are basically two reasons why your program segfaults (at least I can think of two).

The first is a bug in perl. You can try to run your script with perl-5.10.0 or perl-5.8-maint (the soon-to-be 5.8.9). Both contain many fixes for bugs in perl-5.8.

The second possible is a non-thread-safe XS module that you use, or a buggy XS module. Without knowing what modules you use this is impossible to diagnose remotely.

  • Comment on Re: Segmentation fault: problem with perl threads

Replies are listed 'Best First'.
Re^2: Segmentation fault: problem with perl threads
by katharnakh (Novice) on Sep 15, 2008 at 12:08 UTC
    Hi,

    Thanks for the quick reply. I am actually using following module.

    use Log::Log4perl qw(get_logger); use Log::Log4perl::Appender; use Log::Log4perl::Layout; use XML::Simple; use File::stat; use FileHandle; use threads; use Net::SFTP;

    For trying with upgraded version of perl, i have to look into it.

    Thanks very much,
    katharnakh.

      That is a large number of modules that you require to be "thread-safe". Threads get an exact copy of the parent thread at the time of creation, and if for some reason (and it usually happens) a thread dosn't clean itself up completely, it will hang around wasting memory, which then gets incorporated into the next thread. Since you are not sharing data between threads in realtime, and apparently logging to a file, you could easily switch to a forked solution and save all the hassles you are experiencing with threads.

      I would be particularly worried about the thread-safety of Net-SFTP, a quick google for "Net::SFTP thread safety" indicates it is not safe for thread usage.


      I'm not really a human, but I play one on earth Remember How Lucky You Are
        hi,

        Could you please direct me to read through forked way of doing parallel processing?

        Thanks,

        katharnakh.