harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Salikh Zakirov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-1789) [DRLVM] Race condition between Thread.interrupt and Object.wait, Thread.sleep or join
Date Wed, 15 Nov 2006 17:05:39 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-1789?page=comments#action_12450113 ] 
Salikh Zakirov commented on HARMONY-1789:

1) The following change (on top of H-1789.patch) fixes unit test hang:
--- vm/thread/src/thread_native_park.c
+++ vm/thread/src/thread_native_park.c
@@ -59,7 +59,9 @@ IDATA VMCALL hythread_park(I_64 millis,
+     t->state |= TM_THREAD_STATE_PARKED;
      status = hycond_wait_interruptable(t->condition, t->mutex, millis, nanos);
+     t->state &= ~TM_THREAD_STATE_PARKED;
      //status = hysem_wait_interruptable(t->park_event, millis, nanos);
      //the status should be restored for j.u.c.LockSupport

2) The patch is fixing the stated problem directly, however, the attached test case is not
a reproducer for the problem. That's why it passes even without the patch.

It looks like H-1789.patch has several unrelated changes. I am going now to split it into
series of independent changes. I'll include the above fix as well.
Generally, the approach looks correct and makes sleep(), park() and unpark() code easier to
understand and reason about.

> [DRLVM] Race condition between Thread.interrupt and Object.wait, Thread.sleep or join
> -------------------------------------------------------------------------------------
>                 Key: HARMONY-1789
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1789
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Nikolay Kuznetsov
>         Assigned To: Alexey Varlamov
>         Attachments: H-1789.patch, Test.java
> According to the specification wait/join or sleep methods should check if thread was
interrupted before entering wait. DRLVM hythread implmentation do checks interrupted status(see
hythread condition implmentation), however thread may be interrupted just after the status
was checked and before entering condition wait. Thus it's required to ensure that waiting
state will be reached having interrupted status unchanged.

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