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

Hi Monks,

Seek your help on threads. Here is the problem description

We are working on threads to connect to remote systems parallelly using Net::SSH2 module and get some details and display them on a CGI page.

We had no problem when we deployed this script on Solaris9 (sparc) system. But when we ran the same script on linux system (RH ES3) the threads are not returning.

We are using Active perl in both Solaris and Linux. The Perl Version on linux ES3 system is '5.8.8 built for i689-linux-thread-multi'. Its binary build is 820 The Perl Version on Solaris system is '5.8.8 built for sun4-solaris-thread-multi'.Its binary build is 820 Code that I have used for threads is

foreach $key (@files) { push @threads, threads->new(\&Distribute, $ip, $host,$key) ; sleep(1); } while ( my $thread = shift @threads ) { $thread->join ; }

Can you suggest me how to proceed further with Linux system. Please tell me a better solution for this.

Thanks in advance,

Srinivas

Replies are listed 'Best First'.
Re: Problem with threads on Linux ES3
by weismat (Friar) on Feb 19, 2008 at 16:03 UTC
    I would try first to run the script either without threads by modifying the code or with the debugger with the option -dt instead of -d.
    I had a similar issue recently and it was related to different return codes in a network module. the script even ran under Solaris and Windows
      so you mean to say that there is a problem with Linux ES3 system it self?

      Can you suggest any work around for it?

        You should try to minimze the problem.
        How did you install the ssh modules?
        I am working with threads on Linux on an ES4 system and Perl 5.10 wo problems.
        I doubt that the problem comes from the threads. I had problems with the threading as the runtime behaviour changed when moving from a slower Solaris machine to a faster Linux Opteron.