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] Updated: (HARMONY-3925) [drlvm][tc][thread] Race conditions at "port_atomic.h":117 and "thread_native_thin_monitor.c":276
Date Tue, 29 May 2007 07:22:15 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-3925?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Ilya Leviev updated HARMONY-3925:
---------------------------------

    Summary: [drlvm][tc][thread] Race conditions at "port_atomic.h":117 and "thread_native_thin_monitor.c":276
 (was: [drlvm][thread] Race conditions at "port_atomic.h":117 and "thread_native_thin_monitor.c":276)

> [drlvm][tc][thread] Race conditions at "port_atomic.h":117 and "thread_native_thin_monitor.c":276
> -------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3925
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3925
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: win2003
>            Reporter: Ilya Leviev
>         Attachments: SourceViewScreenshot-1.jpg, SourceViewScreenshot-2.jpg
>
>
> TC report on thread unsafe access that result in race condition that occur during concurrent
execution of port_atomic_cas16 and hythread_thin_monitor_try_enter functions.
> Write -> Read data-race	
> Memory read at "thread_native_thin_monitor.c":276 conflicts with a prior memory write
at "port_atomic.h":117
> Stack Trace: 
> Context
> 	Function void vm_execute_java_method_array(struct _jmethodID *,union jvalue *,union
jvalue *) "ini.cpp":60
> 	Function ExecuteMethod "em_intf.cpp":43
> 	Function void DrlEMImpl::executeMethod(struct _jmethodID *,union jvalue *,union jvalue
*) "drlemimpl.cpp":509
> 	Function void JIT_execute_method_default(void *,struct _jmethodID *,union jvalue *,union
jvalue *) "ini_ia32.cpp":199
> 	Function vm_invoke_native_array_stub "ini_ia32.cpp":76
> 	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 hythread_thin_monitor_try_enter "thread_native_thin_monitor.c":233
> 1st Access - Write 
> 	Function void DrlEMImpl::executeMethod(struct _jmethodID *,union jvalue *,union jvalue
*) "drlemimpl.cpp":509
> 	Function void JIT_execute_method_default(void *,struct _jmethodID *,union jvalue *,union
jvalue *) "ini_ia32.cpp":199
> 	Function vm_invoke_native_array_stub "ini_ia32.cpp":76
> 	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 hythread_thin_monitor_try_enter "thread_native_thin_monitor.c":333
> 	Function hythread_thin_monitor_try_enter "thread_native_thin_monitor.c":286
> 	"283"	""	"             assert(this_id > 0 && this_id < 0x8000); "
> 	"284"	""	"             // Acquire monitor"
> 	"285"	""	"             if (0 != port_atomic_cas16 (((volatile apr_uint16_t*) lockword_ptr)+1,
"
> 	"286"	""	"                     (apr_uint16_t) this_id, 0)) {"
> 	"287"	""	" "
> 	Function port_atomic_cas16 "port_atomic.h":117
> 	"112"	""	" INLINE uint16 port_atomic_cas16(volatile uint16 * data , uint16 value, uint16
comp) {"
> 	"113"	""	"     __asm {"
> 	"114"	""	"         mov ax,  comp"
> 	"115"	""	"         mov dx,  value"
> 	"116"	""	"         mov ecx, data"
> 	"117"	"*"	"         lock cmpxchg [ecx], dx"
> 	"118"	""	"         mov comp, ax"
> 	"119"	""	"     }"
> 	"120"	""	"     return comp;"
> 	"121"	""	" }"
> 2nd Access - Read
> 	Function void vm_execute_java_method_array(struct _jmethodID *,union jvalue *,union
jvalue *) "ini.cpp":60
> 	Function ExecuteMethod "em_intf.cpp":43
> 	Function void DrlEMImpl::executeMethod(struct _jmethodID *,union jvalue *,union jvalue
*) "drlemimpl.cpp":509
> 	Function void JIT_execute_method_default(void *,struct _jmethodID *,union jvalue *,union
jvalue *) "ini_ia32.cpp":199
> 	Function vm_invoke_native_array_stub "ini_ia32.cpp":76
> 	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 hythread_thin_monitor_try_enter "thread_native_thin_monitor.c":276
> 	"275"	""	" #ifdef SPIN_COUNT"
> 	"276"	"*"	"     for (i = SPIN_COUNT; i >=0; i--, lockword = *lockword_ptr, lock_id
= THREAD_ID(lockword)) { "
> 	"277"	""	" #endif"
> See also Source View screenshots.
> Notes on Write->Read race condition.
> ------------------------------------
> Write->Read data races occur when one thread writes a shared memory location (address)
while another thread concurrently reads the same memory location.  
> The shared memory location may be referred to by (variable) name, pointer, or even a
function such as memcpy().  
> The following example uses a variable name:
> 1st access by first thread
> S1: sharedX = privateA
> 2nd access by second thread
> S2: privateB = sharedX
> If sharedX is a variable visible to all threads and privateA and privateB are local variables
visible only to the thread where each was declared,
>  concurrent execution of the above statements by multiple threads results in a "race"
on the value to be read from sharedX.   
> Since the order of execution among threads is unpredictable, it is unknown which value
will be available in sharedX to be stored into privateB.  
> This results in non-deterministic software, or software prone to produce different results
each time it is executed. 
> _______________________________________________________________________________________________________________________
> 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