in reply to Re^10: "Thread already joined at..." and "A thread exited while x threads were running" errors
in thread "Thread already joined at..." and "A thread exited while x threads were running" errors

I'm not aware of any particular problems with threads under W2k. Mostly, the various win32 platforms seem to suffer the same problems (or not). That's why I suggested trying a different machine--another w2k would be fine--to see if the problem is peculiar to your machine alone.

Reducing it to bare minimum makes sense, though what you have is not that complex. Nothing your doing looks in anyway wrong. Somewhat verbose, but most of that is tracing, probably added to try and track down the problem.

If you can get a small testcase that displays the problem you could raise a perlbug and post it to perlbug@perl.org. Be sure to mention that *only win2k* is affected. You could also post it back here.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
  • Comment on Re^11: "Thread already joined at..." and "A thread exited while x threads were running" errors

Replies are listed 'Best First'.
Re^12: "Thread already joined at..." and "A thread exited while x threads were running" errors
by nickos (Initiate) on Sep 07, 2004 at 14:59 UTC
    Hmm, castaway just ran your version of my script on the same setup (This is perl, v5.8.4 built for MSWin32-x86-multi-thread (Win2k)) as me and had the same problem. Time to start whittling down the code then I spose...
Re^12: "Thread already joined at..." and "A thread exited while x threads were running" errors
by nickos (Initiate) on Sep 07, 2004 at 15:42 UTC
    Okay, can this testcase be made any smaller (apart from by removing the print statements)?
    #! perl -slw use threads; use strict; use warnings; #my $command = q[printA.exe]; my $command = q[perl -wle"sleep int rand 3; print 'step1'"]; my $numCompleteTestRuns = 100; runTests(); sub runTests { my @threadList = (); for my $i (0 .. $numCompleteTestRuns) { print("About to create thread $i:"); my $thread = threads->new(\&stepThread); push (@threadList, $thread); } my $numThreads = @threadList; print("There are $numThreads threads"); # wait for each running thread to end foreach my $thread (@threadList) { $thread->join; print("A thread joined"); } print("Processes ended - Goodbye"); } # thread runs a type of users steps once only sub stepThread { print("Starting thread and about to run: $command"); my $output = `$command`; print("$output"); print("Ending thread"); }

      That looks fine. I just ran it a dozen or so times on my setup and it completes perfectly every time.

      Perhaps the only other thing I would try is to reduce the command that you run to a simple `dir > nul`; and see what, if any, difference that makes.


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
      "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon

        Okay, I'm now using:

        my $command = q[dir > nul];

        and it still doesn't work. I guess I'll email perlbug@perl.org tomorrow like you suggested...

        I'm supposed to get this working by Friday. Can you think of any workarounds?