Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 89435 invoked from network); 17 May 2007 15:04:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 May 2007 15:04:37 -0000 Received: (qmail 6341 invoked by uid 500); 17 May 2007 15:04:43 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 6325 invoked by uid 500); 17 May 2007 15:04:43 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 6316 invoked by uid 99); 17 May 2007 15:04:43 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 May 2007 08:04:43 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 May 2007 08:04:36 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 9FFE7714074 for ; Thu, 17 May 2007 08:04:16 -0700 (PDT) Message-ID: <4936806.1179414256652.JavaMail.jira@brutus> Date: Thu, 17 May 2007 08:04:16 -0700 (PDT) From: "Ilya Leviev (JIRA)" To: commits@harmony.apache.org Subject: [jira] Created: (HARMONY-3902) [drlvm][thread] Race condition at "thread_native_thin_monitor.c":78 and "thread_java_monitors.c":122 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [drlvm][thread] Race condition at "thread_native_thin_monitor.c":78 and "thread_java_monitors.c":122 ---------------------------------------------------------------------------------------------------- Key: HARMONY-3902 URL: https://issues.apache.org/jira/browse/HARMONY-3902 Project: Harmony Issue Type: Bug Components: DRLVM Reporter: Ilya Leviev TC report on thread unsafe access that result in race condition that occur during concurrent execution of set_fat_lock_id and jthread_monitor_enter functions. Write -> Read data-race Memory read at "thread_java_monitors.c":122 conflicts with a prior memory write at "thread_native_thin_monitor.c":78 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 hythread_thin_monitor_try_enter "thread_native_thin_monitor.c":341 Function class VM_thread * get_thread_ptr_stub(void) "thread_manager.cpp":138 Function jthread_monitor_enter "thread_java_monitors.c":68 1st Access Function m2n_free_local_handles "m2n_ia32.cpp":268 Function hythread_self "hythread.h":465 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 hythread_suspend_enable "hythread_ext.h":370 Function Java_java_lang_VMThreadManager_wait "java_lang_vmthreadmanager.cpp":202 Function jthread_monitor_timed_wait "thread_java_monitors.c":308 Function inflate_lock "thread_native_thin_monitor.c":600 Function set_fat_lock_id "thread_native_thin_monitor.c":78 "76" "" " lockword&=0x7FF;" "77" "" " lockword|=(monitor_id << 11) | 0x80000000;" "78" "*" " *lockword_ptr=lockword;" "79" "" " apr_memory_rw_barrier();" "80" "" " }" 2nd Access 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 hythread_thin_monitor_try_enter "thread_native_thin_monitor.c":341 Function class VM_thread * get_thread_ptr_stub(void) "thread_manager.cpp":138 Function jthread_monitor_enter "thread_java_monitors.c":122 "120" "" " lockword = vm_object_get_lockword_addr(monitor);" "121" "" " " "122" "*" " if (is_fat_lock(*lockword)) {" "123" "" " status = hythread_thin_monitor_enter(lockword);" "124" "" " if (status != TM_ERROR_NONE) {" See also Source View screenshot. 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.