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] Created: (HARMONY-4094) [drlvm][thread][tc]Race condition at "thread_java_basic.c":519 and "thread_native_suspend.c":301 at hythread_resume and jthread_sleep functions
Date Thu, 07 Jun 2007 12:47:26 GMT
[drlvm][thread][tc]Race condition at "thread_java_basic.c":519 and "thread_native_suspend.c":301
at hythread_resume and jthread_sleep functions
-----------------------------------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-4094
                 URL: https://issues.apache.org/jira/browse/HARMONY-4094
             Project: Harmony
          Issue Type: Bug
          Components: DRLVM
            Reporter: Ilya Leviev


Race condition at "thread_java_basic.c":519 and "thread_native_suspend.c":301 at hythread_resume
and jthread_sleep functions

TC report on thread unsafe access to "state" field that result in race condition that occur
during concurrent execution of hythread_resume and jthread_sleep functions. 

Write -> Write data-race	
Memory write at "thread_java_basic.c":519 conflicts with a prior memory write at "thread_native_suspend.c":301


Stack Trace: 

Context
	Function __int64 Jitrino::Jet::rt_h_i64_a(__int64,__int64,enum JavaByteCodes) "arith_rt.cpp":218
	Function class VM_thread * get_thread_ptr_stub(void) "thread_manager.cpp":138
	Function m2n_free_local_handles "m2n_ia32.cpp":268
	Function class VM_thread * get_thread_ptr_stub(void) "thread_manager.cpp":138
	Function m2n_free_local_handles "m2n_ia32.cpp":268
	Function int Jitrino::Jet::rt_h_lcmp(__int64,__int64) "arith_rt.cpp":69
	Function class VM_thread * get_thread_ptr_stub(void) "thread_manager.cpp":138
	Function hythread_suspend_enable "hythread_ext.h":373
	Function Java_java_lang_VMThreadManager_sleep "java_lang_vmthreadmanager.cpp":140
	Function jthread_sleep "thread_java_basic.c":514


1st Access
	Function double Jitrino::Jet::rt_h_flt_2_dbl(float) "arith_rt.cpp":294
	Function double Jitrino::Jet::rt_h_neg_dbl64(double) "arith_rt.cpp":49
	Function int Jitrino::Jet::rt_h_dcmp_l(double,double) "arith_rt.cpp":110
	Function int Jitrino::Jet::rt_h_lcmp(__int64,__int64) "arith_rt.cpp":70
	Function class VM_thread * get_thread_ptr_stub(void) "thread_manager.cpp":138
	Function vm_get_gc_thread_local "c_interface.cpp":2414
	Function gc_alloc_fast "mutator_alloc.cpp":120
	Function hythread_thin_monitor_try_enter "thread_native_thin_monitor.c":343
	Function unreserve_lock "thread_native_thin_monitor.c":210
	Function hythread_resume "thread_native_suspend.c":301

	"299"	""	"     // change thread state"
	"300"	""	"     hymutex_lock(&thread->mutex);"
	"301"	"*"	"     thread->state &= ~TM_THREAD_STATE_SUSPENDED;"
	"302"	""	"     hymutex_unlock(&thread->mutex);"


2nd Access
	Function __int64 Jitrino::Jet::rt_h_i64_a(__int64,__int64,enum JavaByteCodes) "arith_rt.cpp":218
	Function class VM_thread * get_thread_ptr_stub(void) "thread_manager.cpp":138
	Function m2n_free_local_handles "m2n_ia32.cpp":268
	Function class VM_thread * get_thread_ptr_stub(void) "thread_manager.cpp":138
	Function m2n_free_local_handles "m2n_ia32.cpp":268
	Function int Jitrino::Jet::rt_h_lcmp(__int64,__int64) "arith_rt.cpp":69
	Function class VM_thread * get_thread_ptr_stub(void) "thread_manager.cpp":138
	Function hythread_suspend_enable "hythread_ext.h":373
	Function Java_java_lang_VMThreadManager_sleep "java_lang_vmthreadmanager.cpp":140
	Function jthread_sleep "thread_java_basic.c":519



	"514"	""	" IDATA jthread_sleep(jlong millis, jint nanos) {"
	"515"	""	" "
	"516"	""	"     hythread_t tm_native_thread = hythread_self();"
	"517"	""	"     IDATA status;"
	"518"	""	" "
	"519"	"*"	"     tm_native_thread->state &= ~TM_THREAD_STATE_RUNNABLE;"
	"520"	""	"     tm_native_thread->state |= TM_THREAD_STATE_WAITING | TM_THREAD_STATE_SLEEPING
|"
	"521"	""	"         TM_THREAD_STATE_WAITING_WITH_TIMEOUT;"



See also Source View screenshot 


If it not affect correctness of execution I will mark it by special API for prevention of
further alarms on this race. 


-- 
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