[perl #35305] [PATCH] skip threads 'detatch' test on win32

5 views
Skip to first unread message

Jerry Gay

unread,
May 6, 2005, 4:33:00 PM5/6/05
to bugs-bi...@rt.perl.org
# New Ticket Created by jerry gay
# Please include the string: [perl #35305]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=35305 >


the 'detatch' threads test hangs on win32. this small patch skips one
test, so others may fail :)

~jerry


Index: t/pmc/threads.t

===================================================================

--- t/pmc/threads.t (revision 7994)

+++ t/pmc/threads.t (working copy)

@@ -263,6 +263,8 @@

500500
OUTPUT

+SKIP: {
+ skip("detach broken on $^O", 1) if ($^O =~ /MSWin32/);
output_like(<<'CODE', <<'OUTPUT', "detach");
find_global P5, "_foo"
new P2, .ParrotThread
@@ -290,6 +292,7 @@

CODE
/(done\nthread\n)|(thread\ndone\n)/
OUTPUT
+}

output_is(<<'CODE', <<'OUTPUT', "share a PMC");
find_global P5, "_foo"

Leopold Toetsch

unread,
May 7, 2005, 7:14:07 AM5/7/05
to perl6-i...@perl.org
Jerry Gay <parrotbug...@parrotcode.org> wrote:

> the 'detatch' threads test hangs on win32. this small patch skips one
> test, so others may fail :)

Thanks, applied.
leo

Vladimir Lipsky

unread,
May 15, 2005, 10:02:51 PM5/15/05
to perl6-i...@perl.org
> the 'detatch' threads test hangs on win32. this small patch skips one

Could you try the following code('the detatch' threads test with one tweak)
and tell me if it hangs either and what output you get?

find_global P5, "_foo"
new P2, .ParrotThread

find_method P0, P2, "thread3"
new P6, .TQueue # need a flag that thread is done
set I3, 2
invoke # start the thread
set I5, P2
getinterp P2
find_method P0, P2, "detach"
invoke
wait:
defined I0, P6
unless I0, wait
print "done\n"
sleep 5 # Maybe a race condition?
end
.pcc_sub _foo:
print "thread\n"
new P2, .Integer
push P6, P2 # push item on queue
returncc

Jerry Gay

unread,
May 16, 2005, 9:28:03 AM5/16/05
to Vladimir Lipsky, perl6-i...@perl.org
parrot (r8016): no change. hangs w/98% cpu. here's the -t output:

>parrot -t test_b.pasm
0 find_global P5, "_foo" - P5=SArray=PMC(0x7d5a50),
3 new P2, 18 - P2=PMCNULL,
6 find_method P0, P2, "thread3" - P0=PMCNULL,
P2=ParrotThread=PMC(0x7d5a08),
10 new P6, 54 - P6=PMCNULL,
13 set I3, 2 - I3=1,
16 invoke
17 set I5, P2 - I5=0, P2=ParrotThread=PMC(0x7d5a08)
20 getinterp P2 - P2=ParrotThread=PMC(0x7d5a08)
22 find_method P0, P2, "detach" - P0=NCI=PMC(0x638620), P2=ParrotInterpr
eter=PMC(0x637dc8),
26 invoke
27 defined I0, P6 - I0=1, P6=TQueue=PMC(0x7d59f0)
30 unless I0, -3 - I0=0,
27 defined I0, P6 - I0=0, P6=TQueue=PMC(0x7d59f0)
30 unless I0, -3 - I0=0,
27 defined I0, P6 - I0=0, P6=TQueue=PMC(0x7d59f0)
30 unless I0, -3 - I0=0,
27 defined I0, P6 - I0=0, P6=TQueue=PMC(0x7d59f0)
30 unless I0, -3 - I0=0,
27 defined I0, P6 - I0=0, P6=TQueue=PMC(0x7d59f0)
30 unless I0, -3 - I0=0,
27 defined I0, P6 - I0=0, P6=TQueue=PMC(0x7d59f0)
30 unless I0, -3 - I0=0,
etc

Vladimir Lipsky

unread,
May 17, 2005, 5:57:43 PM5/17/05
to jerry gay, perl6-i...@perl.org
parrot (r8016): no change. hangs w/98% cpu. here's the -t output:

>parrot -t test_b.pasm
0 find_global P5, "_foo" - P5=SArray=PMC(0x7d5a50),
3 new P2, 18 - P2=PMCNULL,
6 find_method P0, P2, "thread3" - P0=PMCNULL,
P2=ParrotThread=PMC(0x7d5a08),
10 new P6, 54 - P6=PMCNULL,
13 set I3, 2 - I3=1,
16 invoke
17 set I5, P2 - I5=0, P2=ParrotThread=PMC(0x7d5a08)
20 getinterp P2 - P2=ParrotThread=PMC(0x7d5a08)
22 find_method P0, P2, "detach" - P0=NCI=PMC(0x638620),
P2=ParrotInterpreter=PMC(0x637dc8),

The last two pmc's are allocated from a place which is clearly not the pmc
pool arena from which other pmc's are allocated. What's that? Out of pmc's?
So another arena are allocated. Or something else?. Please run the test with
the -d option set either (and send me personally other threads tests
outputs).

For some unknown reason the second thread crashes somewhere at the begining,
I presume. Hope -d option would reveal the reason.

Leopold Toetsch

unread,
May 18, 2005, 1:57:32 AM5/18/05
to Vladimir Lipsky, jerry gay, perl6-i...@perl.org
Vladimir Lipsky wrote:
> parrot (r8016): no change. hangs w/98% cpu. here's the -t output:

As stated already, this (and possibly other thread) test(s) can't
succeed as long as Win32 has no event loop that passes the terminate
event on to the running interpreter.

> The last two pmc's are allocated from a place which is clearly not the pmc
> pool arena from which other pmc's are allocated.

Run is_pmc_ptr(interp, pmc) or check the involved pmc arenas to verify
this assumption.

leo

Vladimir Lipsky

unread,
May 18, 2005, 5:30:04 AM5/18/05
to Leopold Toetsch, perl6-i...@perl.org
> As stated already, this (and possibly other thread) test(s) can't
>succeed as long as Win32 has no event loop that passes the terminate
>event on to the running interpreter.

If you read the output that Jerry sent earlier, you would have seen
that the thread doesn't ever reach to the print"thread\n" opcode, not
to tell about push P6, P2

> Run is_pmc_ptr(interp, pmc) or check the involved pmc arenas to verify this assumption.

This doesn't happen on my PC; all the first thread's pmc's are
allocted whithin [arena_start;arena_end], the active pmc's number is
equal to 457. This is why I asked him to sent me output with the -d
option on. I want to see how many pmc pool arenas are allocated by the
first thread.

0x7d5a08 - 0x637dc8 == ~1.6 Mb Does Parrot have that huge arenas?

>parrot (r8016): no change. hangs w/98% cpu. here's the -t output:

>parrot -t test_b.pasm


0 find_global P5, "_foo" - P5=SArray=PMC(0x7d5a50),
3 new P2, 18 - P2=PMCNULL,
6 find_method P0, P2, "thread3" - P0=PMCNULL,
P2=ParrotThread=PMC(0x7d5a08),
10 new P6, 54 - P6=PMCNULL,
13 set I3, 2 - I3=1,
16 invoke

17 set I5, P2 - I5=3, P2=ParrotThread=3DPMC(0x7d5a08)


20 getinterp P2 - P2=ParrotThread=PMC(0x7d5a08)
22 find_method P0, P2, "detach" - P0=NCI=PMC(0x638620),

P2=ParrotInterpr=PMC(0x637dc8)

Vladimir Lipsky

unread,
May 18, 2005, 9:06:27 PM5/18/05
to Leopold Toetsch, perl6-i...@perl.org
> As stated already, this (and possibly other thread) test(s) can't succeed
> as long as Win32 has no event loop that passes the terminate event on to
> the running interpreter.

1) Why the heck

--- parrot/config/gen/platform/win32/threads.h Mon May 2 14:40:59 2005
+++ parrot-devel/config/gen/platform/win32/threads.h Mon May 2 14:42:58 2005
@@ -0,0 +1,3 @@
+
+#include "parrot/thr_windows.h"
+

isn't in the repository?

2) To test both cases(MS compiler and not), I played with the macro #ifdef
_MCS_VER in thr_windows.h and forgot 1 at the and of it. The patch applied
removes it. Though it couldn't affect the test results as long as
thr_windows.h wasn't included at all.

mcs_ver.patch

Leopold Toetsch

unread,
May 19, 2005, 4:44:14 AM5/19/05
to Vladimir Lipsky, perl6-i...@perl.org
Vladimir Lipsky <searc...@rambler.ru> wrote:

> 1) Why the heck

Easy: it's not in the MANIFEST. Why: patches scattered between inline
and attached and the MANIFEST part missing ... it's easy to overlook.

> -# ifdef _MCS_VER1
> +# ifdef _MCS_VER

Thanks, applied - hope that's really the whole thing now ;-)

leo

Jerry Gay

unread,
May 19, 2005, 10:05:06 AM5/19/05
to l...@toetsch.at, Vladimir Lipsky, perl6-i...@perl.org
much better! one failing test now... with my inline patch to remove
the skip block around test 6.

almost! :)
> leo
>

test output below:


D:\usr\local\parrot-HEAD\trunk>perl t/harness t/pmc/threads.t
t/pmc/threads....ok 3/11# Failed test (t/pmc/threads.t at line 163)
# got: 'start 1
# in thread
# done
# Can't spawn ".\parrot.exe
"D:\usr\local\parrot-HEAD\trunk\t\pmc\threads_4.pasm"": Bad file
descriptor at lib/Parrot/Test.pm line 231.
# '
# expected: 'start 1
t/pmc/threads....NOK 4# in thread
# done
# '
# '.\parrot.exe
"D:\usr\local\parrot-HEAD\trunk\t\pmc\threads_4.pasm"' failed with
exit code 255
t/pmc/threads....ok 9/11# Looks like you failed 1 tests of 11.
t/pmc/threads....dubious
Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 4
Failed 1/11 tests, 90.91% okay (less 2 skipped tests: 8 okay, 72.73%)
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
t/pmc/threads.t 1 256 11 1 9.09% 4
2 subtests skipped.
Failed 1/1 test scripts, 0.00% okay. 1/11 subtests failed, 90.91% okay.

here's the patch to unskip test 6:

D:\usr\local\parrot-HEAD\trunk>svn diff t/pmc/threads.t
Index: t/pmc/threads.t
===================================================================
--- t/pmc/threads.t (revision 8119)
+++ t/pmc/threads.t (working copy)
@@ -263,8 +263,6 @@
500500
OUTPUT

-SKIP: {
- skip("detach broken on $^O", 1) if ($^O =~ /MSWin32/);


output_like(<<'CODE', <<'OUTPUT', "detach");

find_global P5, "_foo"
new P2, .ParrotThread

@@ -292,7 +290,6 @@


CODE
/(done\nthread\n)|(thread\ndone\n)/
OUTPUT

-}

output_is(<<'CODE', <<'OUTPUT', "share a PMC");
find_global P5, "_foo"


~jerry

Vladimir Lipsky

unread,
May 19, 2005, 11:26:09 AM5/19/05
to jerry gay, perl6-i...@perl.org
jerry gay <jerr...@gmail.com> wrote:
> much better! one failing test now...
>
> D:\usr\local\parrot-HEAD\trunk>perl t/harness t/pmc/threads.t
> t/pmc/threads....ok 3/11# Failed test (t/pmc/threads.t at line
>163)
> # got: 'start 1
> # in thread
> # done
> # Can't spawn ".\parrot.exe
> "D:\usr\local\parrot-HEAD\trunk\t\pmc\threads_4.pasm"": Bad file
> descriptor at lib/Parrot/Test.pm line 231.
> # '
> # expected: 'start 1
> t/pmc/threads....NOK 4# in thread
> # done
> # '
> # '.\parrot.exe
> "D:\usr\local\parrot-HEAD\trunk\t\pmc\threads_4.pasm"' failed with
> exit code 255

Parrot_really_destroy needs to be fixed

Leopold Toetsch

unread,
May 19, 2005, 11:43:24 AM5/19/05
to jerry gay, perl6-i...@perl.org
Jerry Gay <jerr...@gmail.com> wrote:

> here's the patch to unskip test 6:

Thanks, applied.
leo

Leopold Toetsch

unread,
May 19, 2005, 4:29:07 PM5/19/05
to Vladimir Lipsky, perl6-i...@perl.org
Vladimir Lipsky <searc...@rambler.ru> wrote:

>> "D:\usr\local\parrot-HEAD\trunk\t\pmc\threads_4.pasm"' failed with
>> exit code 255

> Parrot_really_destroy needs to be fixed

$verbose++ please, thanks

leo

Jerry Gay

unread,
May 25, 2005, 12:45:05 PM5/25/05
to Vladimir Lipsky, l...@toetsch.at, perl6-i...@perl.org
On 5/9/05, jerry gay <jerr...@gmail.com> wrote:
> much better! one failing test now...

my initial exuberance was unfounded. one test fails in
t/pmc/threads.t, but hundreds fail in the rest of the test suite. it
seems this line (from above) is the culprit:

> -# ifdef _MCS_VER1
> +# ifdef _MCS_VER

so it seems the definition of THREAD_CREATE_JOINABLE() (which follows
this directive in include/parrot/thr_windows.h) is incorrect.

On 5/19/05, Leopold Toetsch <l...@toetsch.at> wrote:
> Vladimir Lipsky <searc...@rambler.ru> wrote:
>

> > Parrot_really_destroy needs to be fixed
>
> $verbose++ please, thanks
>

yes, please. until this issue is fixed, i'm rolling back these patches
so the threads test 6 is again skipped on windows, and the 200-odd
failing tests will work again. feel free to send more patches, i'll
happily test them (more carefully next time) and work out the bugs
before applying.

patch applied as r8165.
~jerry

Vladimir Lipsky

unread,
Jun 2, 2005, 3:28:48 PM6/2/05
to jerry gay, perl6-i...@perl.org
> On 5/19/05, Leopold Toetsch <l...@toetsch.at> wrote:
> > Vladimir Lipsky <searc...@rambler.ru> wrote:
> >
> > > Parrot_really_destroy needs to be fixed
> >
> > $verbose++ please, thanks
> >
> yes, please. until this issue is fixed, i'm rolling back these patches
> so the threads test 6 is again skipped on windows, and the 200-odd

Mr. Gay, let me know if you wait for a special request to uncomment the line

/*#include "parrot/thr_windows.h"*/

in config/gen/platform/win32/threads.h

Jerry Gay

unread,
Jun 3, 2005, 11:49:13 AM6/3/05
to parrotbug...@parrotcode.org
> Mr. Gay, let me know if you wait for a special request to uncomment the line
>
> /*#include "parrot/thr_windows.h"*/
>
> in config/gen/platform/win32/threads.h
>
whatever was broken, has now been fixed. patch applied, and ticket closed.

~jerry

Reply all
Reply to author
Forward
0 new messages