You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Gregory Shimansky (JIRA)" <ji...@apache.org> on 2007/12/28 13:59:43 UTC

[jira] Closed: (HARMONY-4029) [drlvm][shutdown][thread] There should be a safe way to shutdown daemon threads which wouldn't cause deadlock with main thread

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

Gregory Shimansky closed HARMONY-4029.
--------------------------------------

    Resolution: Fixed
      Assignee: Gregory Shimansky  (was: weldon washburn)

Ok closing this bug according to evaluation.

> [drlvm][shutdown][thread] There should be a safe way to shutdown daemon threads which wouldn't cause deadlock with main thread
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4029
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4029
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Gregory Shimansky
>            Assignee: Gregory Shimansky
>            Priority: Minor
>
> The bug in HARMONY-3314 is a specific case of a more general bug of killing daemon threads on shutdown.
> Specification defines daemon threads as threads that VM kills when no non-daemon threads are left. Specification doesn't require the programmer who uses daemon treads to use Thread.join or implement any other precautions for clean shutdown. It is VM which has to handle this.
> When a thread is shut down in DRLVM it has to unregister from its ThreadGroup while detaching from VM. This operation is synchronized and only one thread at a time can delete itself from ThreadGroup object. VM doesn't wait enough for all daemon threads to accomplish it since VM has no idea whether a daemon thread is goring to detach itself from VM or it just hangs. VM quickly kills in a hard way all daemon threads that didn't shut down themselves yet, and often VM kills a daemon thread in its detach process while it is in synchronized block of deleting itself from ThreadGroup object.
> Then later when all daemon threads are killed, main thread tries to detach itself from VM as well, and if some daemon thread was killed in a hard way inside of a synchronized block, the monitor is held by a zombie thread which doesn't exist any more. Therefore main thread hangs forever on trying to get this monitor.

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