harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ilya Leviev (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-3641) [drlvm][netbeans] Thread.interrupt() throws InterruptException in wrong thread
Date Tue, 24 Apr 2007 10:12:15 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-3641?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12491220
] 

Ilya Leviev commented on HARMONY-3641:
--------------------------------------

I have run test scenario from the JIRA with TC and have located points of code where the problems
related to thread interrupt issues have occurred. There are following race conditions were
detected.


Here is stack traces of first issue.

Write -> Write data-race	Memory write at "thread_native_interrupt.c":42 conflicts with
a prior memory write at "thread_java_monitors.c":101


thread_java_monitors.c:101
"98"	""	" #endif //LOCK_RESERVATION"
"99"	""	"     tm_native_thread = hythread_self();"
"100"	""	"     tm_native_thread->state &= ~TM_THREAD_STATE_RUNNABLE;"
"101"	"*"	"     tm_native_thread->state |= TM_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER;"

thread_native_interrupt.c:42
"38"	""	" void VMCALL hythread_interrupt(hythread_t thread) {"
"39"	""	"     IDATA status;"
"40"	""	"     hythread_t thr = NULL;"
"41"	""	"     hymutex_lock(&thread->mutex);"
"42"	"*"	"     thread->state |= TM_THREAD_STATE_INTERRUPTED;"



Stack traces:
1st Access
	Function struct M2nFrame * m2n_get_last_frame(void) "m2n_ia32.cpp":49
	Function class VM_Statistics & VM_Statistics::get_vm_stats(void) "vm_stats.cpp":338
	Function hythread_self "hythread.h":451
	Function class VM_thread * get_vm_thread(struct HyThread *) "vm_threads.h":191
	Function struct M2nFrame * m2n_get_last_frame(void) "m2n_ia32.cpp":49
	Function class VM_Statistics & VM_Statistics::get_vm_stats(void) "vm_stats.cpp":338
	Function hythread_thin_monitor_try_enter "thread_native_thin_monitor.c":345
	Function hythread_self "hythread.h":451
	Function class VM_thread * get_vm_thread(struct HyThread *) "vm_threads.h":191
	Function jthread_monitor_enter "thread_java_monitors.c":101

2nd Access
	Function struct VTable * ManagedObject::vt(void) "object_layout.h":117
	Function class VM_Statistics & VM_Statistics::get_vm_stats(void) "vm_stats.cpp":338
	Function struct VTable * ManagedObject::vt(void) "object_layout.h":117
	Function class VM_Statistics & VM_Statistics::get_vm_stats(void) "vm_stats.cpp":338
	Function hythread_thin_monitor_try_enter "thread_native_thin_monitor.c":345
	Function hythread_self "hythread.h":451
	Function class VM_thread * get_vm_thread(struct HyThread *) "vm_threads.h":191
	Function Java_java_lang_VMThreadManager_interrupt "java_lang_vmthreadmanager.cpp":63
	Function jthread_interrupt "thread_java_interrupt.c":39
	Function hythread_interrupt "thread_native_interrupt.c":42


Here is stack traces of second issue.

Write -> Read data-race	Memory read at "thread_native_interrupt.c":121 conflicts with a
prior memory write at "thread_java_monitors.c":101

thread_java_monitors.c":101
"98"	"     #endif //LOCK_RESERVATION"
"99"	"     tm_native_thread = hythread_self();"
"100"	"     tm_native_thread->state &= ~TM_THREAD_STATE_RUNNABLE;"
"101"	"     tm_native_thread->state |= TM_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER;"

"thread_native_interrupt.c":121
120	" UDATA VMCALL hythread_interrupted(hythread_t thread) {"
121	"     int interrupted = thread->state & TM_THREAD_STATE_INTERRUPTED;"
122	"     return interrupted?TM_ERROR_INTERRUPT:TM_ERROR_NONE;"
123	" }"

Stack traces

1st Access
	Function struct M2nFrame * m2n_get_last_frame(void) "m2n_ia32.cpp":49
	Function class VM_Statistics & VM_Statistics::get_vm_stats(void) "vm_stats.cpp":338
	Function hythread_self "hythread.h":451
	Function class VM_thread * get_vm_thread(struct HyThread *) "vm_threads.h":191
	Function struct M2nFrame * m2n_get_last_frame(void) "m2n_ia32.cpp":49
	Function class VM_Statistics & VM_Statistics::get_vm_stats(void) "vm_stats.cpp":338
	Function hythread_thin_monitor_try_enter "thread_native_thin_monitor.c":345
	Function hythread_self "hythread.h":451
	Function class VM_thread * get_vm_thread(struct HyThread *) "vm_threads.h":191
	Function jthread_monitor_enter "thread_java_monitors.c":101

2nd Access
	Function hythread_thin_monitor_try_enter "thread_native_thin_monitor.c":345
	Function struct VTable * ManagedObject::vt(void) "object_layout.h":117
	Function class VM_Statistics & VM_Statistics::get_vm_stats(void) "vm_stats.cpp":338
	Function struct VTable * ManagedObject::vt(void) "object_layout.h":117
	Function class VM_Statistics & VM_Statistics::get_vm_stats(void) "vm_stats.cpp":338
	Function hythread_self "hythread.h":451
	Function class VM_thread * get_vm_thread(struct HyThread *) "vm_threads.h":191
	Function Java_java_lang_VMThreadManager_isInterrupted__Ljava_lang_Thread_2 "java_lang_vmthreadmanager.cpp":85
	Function jthread_is_interrupted "thread_java_interrupt.c":55
	Function hythread_interrupted "thread_native_interrupt.c":121




> [drlvm][netbeans] Thread.interrupt() throws InterruptException in wrong thread
> ------------------------------------------------------------------------------
>
>                 Key: HARMONY-3641
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3641
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>            Reporter: Vasily Zakharov
>         Attachments: Test.java
>
>
> Consider the attached test. It implements a simple manual synchronization mechanism using
Object.wait() and Thread.interrupt(), similar to the one used by org.apache.harmony.awt.wtk.Synchronizer
(see HARMONY-3601).
> On DRL VM this mechanism works incorrectly - it seems like Thread.interrupt() causes
InterruptException in wrong thread or in more than one thread at once. Here's the output:
> RI:
> SUCCESS
> Harmony/IBM VM:
> SUCCESS
> Harmony/DRL VM:
> ERROR at Thread[Thread-13,5,main]: Not owner can't unlock resource
> ERROR at Thread[Thread-12,5,main]: Not owner can't unlock resource
> ERROR at Thread[Thread-11,5,main]: Not owner can't unlock resource
> ERROR at Thread[Thread-10,5,main]: Not owner can't unlock resource
> Thread[Thread-9,5,main] interrupted while working!
> Thread[Thread-8,5,main] interrupted while working!
> ERROR at Thread[Thread-8,5,main]: Not owner can't unlock resource
> Thread[Thread-7,5,main] interrupted while working!
> ERROR at Thread[Thread-7,5,main]: Not owner can't unlock resource
> Thread[Thread-6,5,main] interrupted while working!
> ERROR at Thread[Thread-6,5,main]: Not owner can't unlock resource
> ERROR at Thread[Thread-5,5,main]: Not owner can't unlock resource
> FAIL
> This issue was filed as a result of investigating the HARMONY-3601 issue with NetBeans.
> Great thanks to Andrey Pavlenko for extracting this problem out of AWT.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message