# New Ticket Created by  Jarkko Hietaniemi 
# Please include the string:  [perl #31018]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=31018 >


tru64/alpha gets a core dump at roughly every tenth run of threads6_pasm.

I suspect some sort of race condition / lack of locking/synchronization
since if I add a short sleep to the main thread, I get no core dumps
after a few hundred test runs.

The core dump in the child thread is caused by interpreter being
filled with complete garbage in src/thread.c:thread_func() runops()
call, line 47.

At the bottom is the test with the magic sleep added after the first
invoke.  Even a tiny sleep helps, like 0.001 seconds.

In general the sign of using sleep in multithreaded tests is suspect:
it indicates some sort of expectation of thread scheduling order.
Either threads synchronize or not, either they are joined with their
parent thread or they run detached.  There is no "let's just sleep for
a while and hope".

    find_global P5, "_foo"
    new P2, .ParrotThread
    find_method P0, P2, "thread3"
    set I3, 1
    invoke      # start the thread

    sleep 0.1   # the magic sleep that seems to help
    set I5, P2
    getinterp P2
    find_method P0, P2, "detach"
    invoke
    print "done\n"
    sleep 0.1
    end

.pcc_sub _foo:
    print "thread\n"
    invoke P1

P.S. What are "thread1", "thread2", and "thread3"?  parrotthread.c
documents them as "threads of type 1..3", but never explains what those
are.

-- 
Jarkko Hietaniemi <[EMAIL PROTECTED]> http://www.iki.fi/jhi/ "There is this special
biologist word we use for 'stable'.  It is 'dead'." -- Jack Cohen

Reply via email to