New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cond_wait hang ups under MSWin32 #8793
Comments
From @jdheddenCreated by @jdheddenThere have been previous reports of this phenomenon on p5p. The script starts a bunch of threads that do different I tracked down the problem to the COND_WAIT macro in Win 2K Perl Info
|
From @jdheddenAttached is a slightly better version of the Note: The script doesn't hang every time, but ____________________________________________________________________________________ |
From @steve-m-hayJerry D. Hedden wrote:
I've run the script about 20 times or more and haven't seen it hang at 4 FAILED - timed out - cond_broadcast not received but the program still exited without hanging. My overnight smokes still hang every night, though (maint as well as -- Radan Computational Ltd. The information contained in this message and any files transmitted with it are confidential and intended for the addressee(s) only. If you have received this message in error or there are any problems, please notify the sender immediately. The unauthorized use, disclosure, copying or alteration of this message is strictly forbidden. Note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Radan Computational Ltd. The recipient(s) of this message should check it and any attached files for viruses: Radan Computational will accept no liability for any damage caused by any virus transmitted by this email. |
The RT System itself - Status changed from 'new' to 'open' |
From @jdheddenJerry D. Hedden wrote:
Steve Hay wrote:
Oh, stupid me! I should have changed my terminology. The
Yes, this bug report directly relates to this. ____________________________________________________________________________________ |
From @demerphqOn 2/22/07, Jerry D. Hedden <jdhedden@yahoo.com> wrote:
Can we not at least change the cond.t test so it uses something more At least then smoke wouldnt hang. Which would be a good thing in of itself.
Im trying to investigate this. I had a look at the MSDN documentation When i attach the VC debugger to the hung process i see "The process appears to deadlocked (or is not running any user-mode With the following stack for the main thread: NTDLL.DLL!77f88f13()
The relevent code is: Code from pp_hot.c Line 2832: The micosoft article is here: http://support.microsoft.com/kb/175332 Cheers, -- |
From @demerphqOn 4/9/07, Jerry D. Hedden <jdhedden@cpan.org> wrote:
To me it doesnt make sense to do so. It is testing functionality specific to threads::shared isnt it?
Personally I dont think so. We should just make it not hang the smokes. Yves -- |
From @jdheddenYves wrote:
Jerry D. Hedden wrote:
The troublesome code is labeled 'Stress test' in Say in a new file called perl-current/t/op/shared.t? Also, should the test be skipped/TODOed under Win32 until |
From @jdhedden
Good idea. I'll work on it. |
From @janduboisOn Mon, 09 Apr 2007, demerphq wrote:
I've tried the revised bug.pl with the latest bleadperl, both on Is there something special I need to do to get it to hang? Cheers, |
From @steve-m-hayJan Dubois wrote:
I also didn't see it hang, but as Jerry pointed out it isn't supposed to http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2007-02/msg00847.html -- |
From @janduboisOn Tue, 10 Apr 2007, Steve Hay wrote:
Well, I didn't see it fail on those systems (2000, 2003) either. But I can now reproduce the failure on a Windows XP system. I'll try Cheers, |
From @janduboisOn Tue, 10 Apr 2007, Steve Hay wrote:
I did add a bit of logging to all the COND_xxx() calls, but I'm too tired line-no timestamp [process-id] [thread-id] message The big number at the end is the address of the semaphore. Let me know if it would help to log anything else. Cheers, |
From @jandubois |
From @demerphqOn 4/9/07, demerphq <demerphq@gmail.com> wrote:
[snip]
Mea-culpa, im wrong. We /should/ todo it, although maybe only under -- |
From @jdheddenJerry D. Hedden wrote:
Yves wrote:
Yves reconsidered:
How do you distinguish when smoke testing is going on? |
From @demerphqOn 4/14/07, Jerry D. Hedden <jdhedden@cpan.org> wrote:
Well, I dont see any. I guess it doesnt matter. Use an environment cheers -- |
From @jdheddenJan Dubois wrote:
I traced out the following: line other threads go into timed wait 465 thr 3 times out This shows that the OS failed to wake up either thr 3 or 6 when thr 2 |
From @jdheddenJerry D. Hedden wrote:
Yves wrote:
How about the following? # Gather thread results $Base += $cnt; So if WIN32_SMOKE is true in the environment, the tests get flagged as TODO. |
From @jdheddenJerry D. Hedden wrote:
Yves wrote::
Patch attached. If $ENV{'WIN32_SMOKE'} is true, then the |
From @jdheddenshared.patchdiff -ruN perl-current/ext/threads/shared/Changes perl-patch/ext/threads/shared/Changes
--- perl-current/ext/threads/shared/Changes 2007-04-10 05:43:12.000000000 -0400
+++ perl-patch/ext/threads/shared/Changes 2007-04-17 11:36:22.000000000 -0400
@@ -1,5 +1,8 @@
Revision history for Perl extension threads::shared.
+-
+ - Modify stress test to be TODO if $ENV{'WIN32_SMOKE'} is true
+
1.09 Mon Apr 9 16:49:30 EDT 2007
- Modify stress test to not hang under MSWin32
- Fix casting issue under MSWin32
diff -ruN perl-current/ext/threads/shared/shared.pm perl-patch/ext/threads/shared/shared.pm
--- perl-current/ext/threads/shared/shared.pm 2007-04-10 05:43:12.000000000 -0400
+++ perl-patch/ext/threads/shared/shared.pm 2007-04-17 11:36:22.000000000 -0400
@@ -5,7 +5,7 @@
use strict;
use warnings;
-our $VERSION = '1.09';
+our $VERSION = '1.09_01';
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -85,7 +85,7 @@
$var = $shared_ref_value;
$var = share($simple_unshared_ref_value);
- my($scalar, @array, %hash);
+ my ($scalar, @array, %hash);
share($scalar);
share(@array);
share(%hash);
diff -ruN perl-current/ext/threads/shared/t/stress.t perl-patch/ext/threads/shared/t/stress.t
--- perl-current/ext/threads/shared/t/stress.t 2007-04-10 05:49:32.000000000 -0400
+++ perl-patch/ext/threads/shared/t/stress.t 2007-04-17 11:36:22.000000000 -0400
@@ -96,7 +96,7 @@
# Gather thread results
for (1..$cnt) {
my $rc = $threads[$_]->join() || 'Thread failed';
- ok($_, ($rc eq 'okay'), $rc);
+ ok($_, ($rc eq 'okay'), (($ENV{'WIN32_SMOKE'}) ? '# TODO ' : '') . $rc);
}
$Base += $cnt;
|
From @steve-m-hayJerry D. Hedden wrote:
I'm not sure that it makes sense to only mark a test as TODO when run Surely any test that is known to fail should be marked as TODO -- |
From @jdheddenJerry D. Hedden wrote:
Yves wrote::
Jerry D. Hedden wrote:
Steve Hay wrote:
Okay. Then is the concensus that it should just be based on |
From @jdheddenJerry D. Hedden wrote:
Yves wrote::
Jerry D. Hedden wrote:
Steve Hay wrote:
Jerry D. Hedden wrote:
Attached patch does this. |
From @jdheddenshared.patchdiff -ruN perl-current/ext/threads/shared/Changes perl-patch/ext/threads/shared/Changes
--- perl-current/ext/threads/shared/Changes 2007-04-10 05:43:12.000000000 -0400
+++ perl-patch/ext/threads/shared/Changes 2007-04-17 12:29:10.000000000 -0400
@@ -1,5 +1,8 @@
Revision history for Perl extension threads::shared.
+-
+ - Modify stress test to be TODO under MSWin32
+
1.09 Mon Apr 9 16:49:30 EDT 2007
- Modify stress test to not hang under MSWin32
- Fix casting issue under MSWin32
diff -ruN perl-current/ext/threads/shared/shared.pm perl-patch/ext/threads/shared/shared.pm
--- perl-current/ext/threads/shared/shared.pm 2007-04-10 05:43:12.000000000 -0400
+++ perl-patch/ext/threads/shared/shared.pm 2007-04-17 12:29:10.000000000 -0400
@@ -5,7 +5,7 @@
use strict;
use warnings;
-our $VERSION = '1.09';
+our $VERSION = '1.09_01';
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -85,7 +85,7 @@
$var = $shared_ref_value;
$var = share($simple_unshared_ref_value);
- my($scalar, @array, %hash);
+ my ($scalar, @array, %hash);
share($scalar);
share(@array);
share(%hash);
diff -ruN perl-current/ext/threads/shared/t/stress.t perl-patch/ext/threads/shared/t/stress.t
--- perl-current/ext/threads/shared/t/stress.t 2007-04-10 05:49:32.000000000 -0400
+++ perl-patch/ext/threads/shared/t/stress.t 2007-04-17 12:29:10.000000000 -0400
@@ -96,7 +96,7 @@
# Gather thread results
for (1..$cnt) {
my $rc = $threads[$_]->join() || 'Thread failed';
- ok($_, ($rc eq 'okay'), $rc);
+ ok($_, ($rc eq 'okay'), (($^O eq 'MSWin32') ? '# TODO ' : '') . $rc);
}
$Base += $cnt;
|
From @demerphqOn 4/17/07, Steve Hay <steve.hay@uk.radan.com> wrote:
My feeling is that we should assertively test as much as we can, and If it starts failing then its not a matter of "same-old, same-old" but OTOH, sending in FAIL every time for smoking because of a well known Maybe smoke itself should have some facilities to handle this. Maybe a Anyway, if the ENV var being checked is less smoke specific in name Yves -- |
From @steve-m-haydemerphq wrote:
I agree with your comments about handling tests that fail under Failed 29-50 With this level of failure, even interactively, I think the test should Are you saying that you don't see any failures if you repeatedly run the -- |
From @demerphqOn 4/18/07, Steve Hay <steve.hay@uk.radan.com> wrote:
I have never seen the stress test fail from a command line. Never. BUT, I havent tried running it over and over either. Yves -- |
From @steve-m-haydemerphq wrote:
Weird. I only ran it over and over to see with what sort of frequency it So we're agreed that we don't want FAIL reports from Test-Smoke over I would say that an unexpected pass is less worrying that an unexpected -- |
From @demerphqOn 4/18/07, Steve Hay <steve.hay@uk.radan.com> wrote:
That you see errors on the command line invalidates my original Yves -- |
From @jdheddenYves wrote:
So we have a consensus. The attached patch makes the test TODO under MSWin32. |
From @jdheddenshared.patchdiff -ruN perl-current/ext/threads/shared/Changes perl-patch/ext/threads/shared/Changes
--- perl-current/ext/threads/shared/Changes 2007-04-10 05:43:12.000000000 -0400
+++ perl-patch/ext/threads/shared/Changes 2007-04-17 12:29:10.000000000 -0400
@@ -1,5 +1,8 @@
Revision history for Perl extension threads::shared.
+-
+ - Modify stress test to be TODO under MSWin32
+
1.09 Mon Apr 9 16:49:30 EDT 2007
- Modify stress test to not hang under MSWin32
- Fix casting issue under MSWin32
diff -ruN perl-current/ext/threads/shared/shared.pm perl-patch/ext/threads/shared/shared.pm
--- perl-current/ext/threads/shared/shared.pm 2007-04-10 05:43:12.000000000 -0400
+++ perl-patch/ext/threads/shared/shared.pm 2007-04-17 12:29:10.000000000 -0400
@@ -5,7 +5,7 @@
use strict;
use warnings;
-our $VERSION = '1.09';
+our $VERSION = '1.09_01';
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -85,7 +85,7 @@
$var = $shared_ref_value;
$var = share($simple_unshared_ref_value);
- my($scalar, @array, %hash);
+ my ($scalar, @array, %hash);
share($scalar);
share(@array);
share(%hash);
diff -ruN perl-current/ext/threads/shared/t/stress.t perl-patch/ext/threads/shared/t/stress.t
--- perl-current/ext/threads/shared/t/stress.t 2007-04-10 05:49:32.000000000 -0400
+++ perl-patch/ext/threads/shared/t/stress.t 2007-04-17 12:29:10.000000000 -0400
@@ -96,7 +96,7 @@
# Gather thread results
for (1..$cnt) {
my $rc = $threads[$_]->join() || 'Thread failed';
- ok($_, ($rc eq 'okay'), $rc);
+ ok($_, ($rc eq 'okay'), (($^O eq 'MSWin32') ? '# TODO ' : '') . $rc);
}
$Base += $cnt;
|
From @steve-m-hayJerry D. Hedden wrote:
Is the patch correct? I'm a bit rusty on the mechanics of TODO tests at C:\p5p\bleadperl\t>..\perl harness -v ..\ext\threads\shared\t\stress.t ../ext/threads/shared/t/stress.t 50 27 24-50 C:\p5p\bleadperl\t>..\perl harness -v ..\ext\threads\shared\t\stress.t -- |
From @rgsOn 18/04/07, Steve Hay <steve.hay@uk.radan.com> wrote:
"# TODO" should appear on the same line than "not ok". |
From @jdhedden
Ugh. My fault. I forgot that the test suite uses its own 'ok' |
From @jdheddenshared.patchdiff -ruN perl-current/ext/threads/shared/Changes perl-patch/ext/threads/shared/Changes
--- perl-current/ext/threads/shared/Changes 2007-04-10 05:43:12.000000000 -0400
+++ perl-patch/ext/threads/shared/Changes 2007-04-18 08:02:26.000000000 -0400
@@ -1,5 +1,8 @@
Revision history for Perl extension threads::shared.
+-
+ - Modify stress test to be TODO under MSWin32
+
1.09 Mon Apr 9 16:49:30 EDT 2007
- Modify stress test to not hang under MSWin32
- Fix casting issue under MSWin32
diff -ruN perl-current/ext/threads/shared/shared.pm perl-patch/ext/threads/shared/shared.pm
--- perl-current/ext/threads/shared/shared.pm 2007-04-10 05:43:12.000000000 -0400
+++ perl-patch/ext/threads/shared/shared.pm 2007-04-18 08:02:26.000000000 -0400
@@ -5,7 +5,7 @@
use strict;
use warnings;
-our $VERSION = '1.09';
+our $VERSION = '1.09_01';
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -85,7 +85,7 @@
$var = $shared_ref_value;
$var = share($simple_unshared_ref_value);
- my($scalar, @array, %hash);
+ my ($scalar, @array, %hash);
share($scalar);
share(@array);
share(%hash);
diff -ruN perl-current/ext/threads/shared/t/stress.t perl-patch/ext/threads/shared/t/stress.t
--- perl-current/ext/threads/shared/t/stress.t 2007-04-10 05:49:32.000000000 -0400
+++ perl-patch/ext/threads/shared/t/stress.t 2007-04-18 08:02:26.000000000 -0400
@@ -23,6 +23,8 @@
# You have to do it this way or VMS will get confused.
if ($ok) {
print("ok $id\n");
+ } elsif ($why =~ /TODO/) {
+ print ("not ok $id $why\n");
} else {
print ("not ok $id\n");
printf("# Failed test at line %d\n", (caller)[2]);
@@ -96,7 +98,7 @@
# Gather thread results
for (1..$cnt) {
my $rc = $threads[$_]->join() || 'Thread failed';
- ok($_, ($rc eq 'okay'), $rc);
+ ok($_, ($rc eq 'okay'), (($^O eq 'MSWin32') ? '# TODO ' : '') . $rc);
}
$Base += $cnt;
|
From @steve-m-hayJerry D. Hedden wrote:
That's better in that failures are now seen as "TODO" and hence not a ... but on the occasions that things happen to succeed I get the same as I guess this is because of the way that stress.t has rolled its own test Yves might see this as a Good Thing since it means that he won't see any Do you feel inclined to rework the script to use Test::More or whatever -- |
From @jdheddenSteve Hay wrote:
There are interactions with Test::More and threads which may have been BTW, I've updated the patch once more to include a comment referencing |
From @jdheddenshared.patchdiff -ruN perl-current/ext/threads/shared/Changes perl-patch/ext/threads/shared/Changes
--- perl-current/ext/threads/shared/Changes 2007-04-10 05:43:12.000000000 -0400
+++ perl-patch/ext/threads/shared/Changes 2007-04-18 09:33:28.000000000 -0400
@@ -1,5 +1,8 @@
Revision history for Perl extension threads::shared.
+-
+ - Modify stress test to be TODO under MSWin32
+
1.09 Mon Apr 9 16:49:30 EDT 2007
- Modify stress test to not hang under MSWin32
- Fix casting issue under MSWin32
diff -ruN perl-current/ext/threads/shared/shared.pm perl-patch/ext/threads/shared/shared.pm
--- perl-current/ext/threads/shared/shared.pm 2007-04-10 05:43:12.000000000 -0400
+++ perl-patch/ext/threads/shared/shared.pm 2007-04-18 09:33:28.000000000 -0400
@@ -5,7 +5,7 @@
use strict;
use warnings;
-our $VERSION = '1.09';
+our $VERSION = '1.09_01';
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -85,7 +85,7 @@
$var = $shared_ref_value;
$var = share($simple_unshared_ref_value);
- my($scalar, @array, %hash);
+ my ($scalar, @array, %hash);
share($scalar);
share(@array);
share(%hash);
diff -ruN perl-current/ext/threads/shared/t/stress.t perl-patch/ext/threads/shared/t/stress.t
--- perl-current/ext/threads/shared/t/stress.t 2007-04-10 05:49:32.000000000 -0400
+++ perl-patch/ext/threads/shared/t/stress.t 2007-04-18 09:33:28.000000000 -0400
@@ -23,6 +23,8 @@
# You have to do it this way or VMS will get confused.
if ($ok) {
print("ok $id\n");
+ } elsif ($why =~ /TODO/) {
+ print ("not ok $id $why\n");
} else {
print ("not ok $id\n");
printf("# Failed test at line %d\n", (caller)[2]);
@@ -96,7 +98,9 @@
# Gather thread results
for (1..$cnt) {
my $rc = $threads[$_]->join() || 'Thread failed';
- ok($_, ($rc eq 'okay'), $rc);
+ # Test is TODO under MSWin32 due to bug #41574
+ # http://rt.perl.org/rt3/Public/Bug/Display.html?id=41574
+ ok($_, ($rc eq 'okay'), (($^O eq 'MSWin32') ? '# TODO ' : '') . $rc);
}
$Base += $cnt;
|
From @steve-m-hayRafael Garcia-Suarez wrote:
I'm using t/harness, but how can that possibly know to output the C:\p5p\bleadperl\t>..\perl harness -v ..\ext\threads\shared\t\stress.t
I don't see what's unlikely about that. -- |
From @rgsOn 18/04/07, Steve Hay <steve.hay@uk.radan.com> wrote:
This "unexpectedly succeeded" message comes from Test::Harness, so you
|
From @rgsOn 18/04/07, Steve Hay <steve.hay@uk.radan.com> wrote:
Ah, yes, I now see what you mean, sorry. Yes, the output for passing |
From @steve-m-hayRafael Garcia-Suarez wrote:
So is the attached OK with you, Jerry? This gives me output like this when all is well: ok 1 # TODO - Unreliable on MSWin32 or like this when things go wrong: ... -- |
From @steve-m-hayshared.patch==== //depot/perl/ext/threads/shared/Changes#6 - c:\p5p\bleadperl\ext\threads\shared\Changes ====
@@ -1,5 +1,8 @@
Revision history for Perl extension threads::shared.
+-
+ - Modify stress test to be TODO under MSWin32
+
1.09 Mon Apr 9 16:49:30 EDT 2007
- Modify stress test to not hang under MSWin32
- Fix casting issue under MSWin32
==== //depot/perl/ext/threads/shared/shared.pm#48 - c:\p5p\bleadperl\ext\threads\shared\shared.pm ====
@@ -5,7 +5,7 @@
use strict;
use warnings;
-our $VERSION = '1.09';
+our $VERSION = '1.09_01';
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -85,7 +85,7 @@
$var = $shared_ref_value;
$var = share($simple_unshared_ref_value);
- my($scalar, @array, %hash);
+ my ($scalar, @array, %hash);
share($scalar);
share(@array);
share(%hash);
==== //depot/perl/ext/threads/shared/t/stress.t#2 - c:\p5p\bleadperl\ext\threads\shared\t\stress.t ====
@@ -17,8 +17,9 @@
my $Base = 0;
sub ok {
- my ($id, $ok, $why) = @_;
+ my ($id, $ok, $why, $todo) = @_;
$id += $Base;
+ $id .= ' # TODO - Unreliable on MSWin32' if $todo;
# You have to do it this way or VMS will get confused.
if ($ok) {
@@ -47,10 +48,6 @@
# Launches a bunch of threads which are then
# restricted to finishing in numerical order
#
-# Frequently fails under MSWin32 due to deadlocking bug in Windows
-# http://rt.perl.org/rt3/Public/Bug/Display.html?id=41574
-# http://support.microsoft.com/kb/175332
-#
#####
{
my $cnt = 50;
@@ -96,7 +93,11 @@
# Gather thread results
for (1..$cnt) {
my $rc = $threads[$_]->join() || 'Thread failed';
- ok($_, ($rc eq 'okay'), $rc);
+ # Frequently fails under MSWin32 due to deadlocking bug in Windows
+ # hence test is TODO under MSWin32
+ # http://rt.perl.org/rt3/Public/Bug/Display.html?id=41574
+ # http://support.microsoft.com/kb/175332
+ ok($_, ($rc eq 'okay'), $rc, ($^O eq 'MSWin32'));
}
$Base += $cnt;
|
From @jdhedden
|
From @demerphqOn 4/18/07, Steve Hay <steve.hay@uk.radan.com> wrote:
IMO that will just mask /other/ unexpectedly passing tests behind line Yves -- |
From @steve-m-haydemerphq wrote:
I'm not sure I understand your question. The output is now just standard Test-Harness output and behaves like any What output are you suggesting you'd like to see? -- |
From @demerphqOn 4/18/07, Steve Hay <steve.hay@uk.radan.com> wrote:
Currently we have 50 events (for a lack of a better term) that must # Gather thread results Instead it should say something like # Gather thread results That way we dont see 13 unexpected passes one day, and 15 the next, I realize that this means we are doing part of harness'ess job, but Yves -- |
From @jdheddenYves wrote:
Let me work on this. You have a point, but it also needs to handle |
From @jdheddenWith the attached patch, there is only 1 test. If something 'funky' happens (e.g., a thread fails to run), then the test fails. Under MSWin32... If there are no timeouts, the result is: If not under MSWin32, if there are timeouts, the test fails. Otherwise, okay. That may be overkill, but I hope it covers all the bases. |
From @jdheddenshared.patchdiff -ruN perl-current/ext/threads/shared/Changes perl-patch/ext/threads/shared/Changes
--- perl-current/ext/threads/shared/Changes 2007-04-10 05:43:12.000000000 -0400
+++ perl-patch/ext/threads/shared/Changes 2007-04-18 14:23:14.000000000 -0400
@@ -1,5 +1,8 @@
Revision history for Perl extension threads::shared.
+-
+ - Modify stress test to be TODO under MSWin32
+
1.09 Mon Apr 9 16:49:30 EDT 2007
- Modify stress test to not hang under MSWin32
- Fix casting issue under MSWin32
diff -ruN perl-current/ext/threads/shared/shared.pm perl-patch/ext/threads/shared/shared.pm
--- perl-current/ext/threads/shared/shared.pm 2007-04-10 05:43:12.000000000 -0400
+++ perl-patch/ext/threads/shared/shared.pm 2007-04-18 14:23:14.000000000 -0400
@@ -5,7 +5,7 @@
use strict;
use warnings;
-our $VERSION = '1.09';
+our $VERSION = '1.09_01';
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -85,7 +85,7 @@
$var = $shared_ref_value;
$var = share($simple_unshared_ref_value);
- my($scalar, @array, %hash);
+ my ($scalar, @array, %hash);
share($scalar);
share(@array);
share(%hash);
diff -ruN perl-current/ext/threads/shared/t/stress.t perl-patch/ext/threads/shared/t/stress.t
--- perl-current/ext/threads/shared/t/stress.t 2007-04-10 05:49:32.000000000 -0400
+++ perl-patch/ext/threads/shared/t/stress.t 2007-04-18 14:23:14.000000000 -0400
@@ -15,26 +15,9 @@
use ExtUtils::testlib;
-my $Base = 0;
-sub ok {
- my ($id, $ok, $why) = @_;
- $id += $Base;
-
- # You have to do it this way or VMS will get confused.
- if ($ok) {
- print("ok $id\n");
- } else {
- print ("not ok $id\n");
- printf("# Failed test at line %d\n", (caller)[2]);
- print ("# Reason: $why\n");
- }
-
- return ($ok);
-}
-
BEGIN {
$| = 1;
- print("1..50\n"); ### Number of tests that will be run ###
+ print("1..1\n"); ### Number of tests that will be run ###
};
use threads;
@@ -47,10 +30,6 @@
# Launches a bunch of threads which are then
# restricted to finishing in numerical order
#
-# Frequently fails under MSWin32 due to deadlocking bug in Windows
-# http://rt.perl.org/rt3/Public/Bug/Display.html?id=41574
-# http://support.microsoft.com/kb/175332
-#
#####
{
my $cnt = 50;
@@ -94,12 +73,44 @@
}
# Gather thread results
+ my ($okay, $failures, $timeouts, $unknown) = (0, 0, 0, 0);
for (1..$cnt) {
- my $rc = $threads[$_]->join() || 'Thread failed';
- ok($_, ($rc eq 'okay'), $rc);
+ my $rc = $threads[$_]->join();
+ if (! $rc) {
+ $failures++;
+ } elsif ($rc =~ /^timed out/) {
+ $timeouts++;
+ } elsif ($rc eq 'okay') {
+ $okay++;
+ } else {
+ $unknown++;
+ print("# Unknown error: $rc\n");
+ }
}
- $Base += $cnt;
+ if ($failures || $unknown || (($okay + $timeouts) != $cnt)) {
+ print('not ok 1');
+ my $too_few = $cnt - ($okay + $failures + $timeouts + $unknown);
+ print(" - $too_few too few threads reported") if $too_few;
+ print(" - $failures threads failed") if $failures;
+ print(" - $unknown unknown errors") if $unknown;
+ print(" - $timeouts threads timed out") if $timeouts;
+ print("\n");
+
+ } elsif ($timeouts) {
+ # Frequently fails under MSWin32 due to deadlocking bug in Windows
+ # hence test is TODO under MSWin32
+ # http://rt.perl.org/rt3/Public/Bug/Display.html?id=41574
+ # http://support.microsoft.com/kb/175332
+ print('not ok 1');
+ print(' # TODO - not reliable under MSWin32') if ($^O eq 'MSWin32');
+ print(" - $timeouts threads timed out\n");
+
+ } else {
+ print('ok 1');
+ print(' # TODO - not reliable under MSWin32') if ($^O eq 'MSWin32');
+ print("\n");
+ }
}
# EOF
|
From @steve-m-haydemerphq wrote:
Ah yes, good point! I understand now. -- |
From @steve-m-hayJerry D. Hedden wrote:
Thanks, applied as #30978. -- |
@smpeters - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#41574 (status was 'resolved')
Searchable as RT41574$
The text was updated successfully, but these errors were encountered: