harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xiao-Feng Li (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-3647) [drlvm][thread] Issues with native threads creation and termination
Date Wed, 25 Apr 2007 10:42:15 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-3647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12491594

Xiao-Feng Li commented on HARMONY-3647:

Gregory, I think HARMONY-3671 is only a workaround. We need have better solution for native
thread attaching Java thread. Let's keep this JIRA open, which points to all the three related
issues. HARMONY-3578, HARMONY-3588, and HARMONY-3671. 

> [drlvm][thread] Issues with native threads creation and termination
> -------------------------------------------------------------------
>                 Key: HARMONY-3647
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3647
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Win/Linux
>            Reporter: Li-Gang Wang
> While I tested the native finref (finalizer & ref enqueue) thread implementation,
I met two issues about native thread creation and termination. I have only temporary workarounds
for them currently. The basic issue is how to create/terminate a native thread that has associated
java.lang.Thread object.
> 1.        On Win & Linux, jvmti.test failed occasionally
> CAUSE: We couldn't attach finref threads as Java threads atomically with the according
interface, attach_current_thread(). The attaching action may contend some lock with the main
thread. When we ran jvmti.test, if the main thread held the lock firstly, finref threads had
to run Thread class's constructor before they were associated to a Java thread structure.
This would incur failure.
> The related issue is on Jira is https://issues.apache.org/jira/browse/HARMONY-3578.
> In this patch I make the main thread wait until all finref threads finish their attaching
> 2.    On Win, gc.FinAlloc test hung after it printed "PASSED" once per tens of times.
> CAUSE: In vm_destroy(), finref threads are signaled to terminate and then the main thread
terminates itself. But the termination of native threads is not atomic, so sometimes finref
threads were not terminated properly and held a shared lock after termination. In this situation
when the main thread was calling Thread.detach() method to detach itself, it could not hold
the lock and was blocked.
> The related issue is on Jira is https://issues.apache.org/jira/browse/HARMONY-3588.
> In this patch, when VM signals finref threads to terminate, it will wait until the termination
action finishes.
> With the exploration, I suspect that current design in DRLVM might require this kind
of native thread (that has associated j.l.thread object) to be treated as real Java thread,
and created in Java code. That is, it doesn't allow the VM to simply create a native thread
to be associated with a j.l.thread object. We need this kind of thread because we need them
to run Java methods (the finalizers). I guess  this should be a bug in current design, since
the main thread must be created from native thread but able to run main() method of the entry

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message