harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Evgueni Brevnov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-2648) [drlvm][threading] Potential race condition in safe-point callback implementation
Date Tue, 12 Dec 2006 14:40:22 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-2648?page=comments#action_12457737 ] 
Evgueni Brevnov commented on HARMONY-2648:

I fogot to point you to the thread to read. Here it is http://mail-archives.apache.org/mod_mbox/harmony-dev/200612.mbox/%3ce29119980612110726q1d2040b5r462f33343427e3cd@mail.gmail.com%3e

List of problems:

1) hythread_suspend & hythread_resume are used asynchronously what may
lead to a deadlock. Here is the scenario:
   a) T1 wants to set a safe-point callback to T2. So it calls
hythread_set_safe_point_callback(T2, the_callback).
   b) T1 sets T2->safepoint_callback to the_callback;
   c) T2 executes hythread_resume(self) which is under if
(thread->safepoint_callback) statement.
   d) T1 calls send_suspend_request(T2). So T2 will never be resumed
because it already invoked corresponding hythread_resume(self)
statement on the previous step.

2) Current implementation sets suspend_disable_count to 1
(thread_native_suspend.c:162) and allows execution of unsafe code
(which must be executed under suspend disabled state) while GC may be

3) In stop_callback (thread_java_basic.c:413) suspend_request for the
current thread is set to zero. So the thread just ignores
suspend_requests and continue to do its dirty things.

> [drlvm][threading] Potential race condition in safe-point callback implementation
> ---------------------------------------------------------------------------------
>                 Key: HARMONY-2648
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2648
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: All
>            Reporter: Evgueni Brevnov
>         Attachments: safe_point_callback.patch
> Please read the following thread to understand the problem. Attached patch fixes possible
race conditions but one classlib's test starts to fail org.apache.harmony.luni.tests.java.lang.ThreadGroupTest.test_suspend.
So the patch should be improved to handle this test case correctly.
> Thanks
> Evgueni

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message