You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Sahoo (JIRA)" <ji...@apache.org> on 2010/09/14 06:19:32 UTC

[jira] Created: (FELIX-2598) Hang in Felix: thread owing a bundle lock waits for ever to lock it again

Hang in Felix: thread owing a bundle lock waits for ever to lock it again
-------------------------------------------------------------------------

                 Key: FELIX-2598
                 URL: https://issues.apache.org/jira/browse/FELIX-2598
             Project: Felix
          Issue Type: Bug
          Components: Framework
    Affects Versions: framework-3.0.2
            Reporter: Sahoo
            Assignee: Richard S. Hall
             Fix For: framework-3.2.0


In GlassFish, I detected a hang. PFA jstack output. The scenario happens like this:

a) I updated a bundle using telnet console. This thread is holding the bundle lock.
b) Upon receiving the UPDATED event, one of our extenders bundle enhances the bundle and calls PackageAdmin.refreshPackages(bundle).
c) PackageAdmin thread holds the global lock and tries to hold the bundle lock, which is currently held by telnetconsole thread.
d) telnetconsole thread is waiting indefinitely to obtain the bundle lock.

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


[jira] Commented: (FELIX-2598) Hang in Felix: thread owing a bundle lock waits for ever to lock it again

Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2598?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12912675#action_12912675 ] 

Richard S. Hall commented on FELIX-2598:
----------------------------------------

This appears to be a logic bug in how we check whether or not we can get the bundle lock in acquireBundleLock(). We allow bundles already holding bundle locks to continue holding them when the global lock is acquired, but we don't want new bundle locks to be acquired. The idea is that in most cases only a single bundle lock is required to perform an operation so the existing threads holding bundle locks should be able to complete. If the global lock holder needs a locked bundle, it just needs to wait for the holder to finish.

The logic error is that we block a thread from acquiring the bundle lock of a lock it already owns, which isn't correct, it should be reentrant. We need to specifically check for this case in the condition of our wait loop.

> Hang in Felix: thread owing a bundle lock waits for ever to lock it again
> -------------------------------------------------------------------------
>
>                 Key: FELIX-2598
>                 URL: https://issues.apache.org/jira/browse/FELIX-2598
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: framework-3.0.2
>            Reporter: Sahoo
>            Assignee: Richard S. Hall
>             Fix For: framework-3.0.3
>
>         Attachments: hang.txt
>
>
> In GlassFish, I detected a hang. PFA jstack output. The scenario happens like this:
> a) I updated a bundle using telnet console. This thread is holding the bundle lock.
> b) Upon receiving the UPDATED event, one of our extenders bundle enhances the bundle and calls PackageAdmin.refreshPackages(bundle).
> c) PackageAdmin thread holds the global lock and tries to hold the bundle lock, which is currently held by telnetconsole thread.
> d) telnetconsole thread is waiting indefinitely to obtain the bundle lock.

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


[jira] Updated: (FELIX-2598) Hang in Felix: thread owing a bundle lock waits for ever to lock it again

Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-2598?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard S. Hall updated FELIX-2598:
-----------------------------------

    Fix Version/s: framework-3.0.3
                       (was: framework-3.2.0)

> Hang in Felix: thread owing a bundle lock waits for ever to lock it again
> -------------------------------------------------------------------------
>
>                 Key: FELIX-2598
>                 URL: https://issues.apache.org/jira/browse/FELIX-2598
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: framework-3.0.2
>            Reporter: Sahoo
>            Assignee: Richard S. Hall
>             Fix For: framework-3.0.3
>
>         Attachments: hang.txt
>
>
> In GlassFish, I detected a hang. PFA jstack output. The scenario happens like this:
> a) I updated a bundle using telnet console. This thread is holding the bundle lock.
> b) Upon receiving the UPDATED event, one of our extenders bundle enhances the bundle and calls PackageAdmin.refreshPackages(bundle).
> c) PackageAdmin thread holds the global lock and tries to hold the bundle lock, which is currently held by telnetconsole thread.
> d) telnetconsole thread is waiting indefinitely to obtain the bundle lock.

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


[jira] Updated: (FELIX-2598) Hang in Felix: thread owing a bundle lock waits for ever to lock it again

Posted by "Sahoo (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-2598?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sahoo updated FELIX-2598:
-------------------------

    Attachment: hang.txt

jstack output

> Hang in Felix: thread owing a bundle lock waits for ever to lock it again
> -------------------------------------------------------------------------
>
>                 Key: FELIX-2598
>                 URL: https://issues.apache.org/jira/browse/FELIX-2598
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: framework-3.0.2
>            Reporter: Sahoo
>            Assignee: Richard S. Hall
>             Fix For: framework-3.2.0
>
>         Attachments: hang.txt
>
>
> In GlassFish, I detected a hang. PFA jstack output. The scenario happens like this:
> a) I updated a bundle using telnet console. This thread is holding the bundle lock.
> b) Upon receiving the UPDATED event, one of our extenders bundle enhances the bundle and calls PackageAdmin.refreshPackages(bundle).
> c) PackageAdmin thread holds the global lock and tries to hold the bundle lock, which is currently held by telnetconsole thread.
> d) telnetconsole thread is waiting indefinitely to obtain the bundle lock.

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


[jira] Resolved: (FELIX-2598) Hang in Felix: thread owing a bundle lock waits for ever to lock it again

Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-2598?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard S. Hall resolved FELIX-2598.
------------------------------------

    Resolution: Fixed

Committed a fix for this, please close if you are satisfied. Thanks.

> Hang in Felix: thread owing a bundle lock waits for ever to lock it again
> -------------------------------------------------------------------------
>
>                 Key: FELIX-2598
>                 URL: https://issues.apache.org/jira/browse/FELIX-2598
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: framework-3.0.2
>            Reporter: Sahoo
>            Assignee: Richard S. Hall
>             Fix For: framework-3.0.3
>
>         Attachments: hang.txt
>
>
> In GlassFish, I detected a hang. PFA jstack output. The scenario happens like this:
> a) I updated a bundle using telnet console. This thread is holding the bundle lock.
> b) Upon receiving the UPDATED event, one of our extenders bundle enhances the bundle and calls PackageAdmin.refreshPackages(bundle).
> c) PackageAdmin thread holds the global lock and tries to hold the bundle lock, which is currently held by telnetconsole thread.
> d) telnetconsole thread is waiting indefinitely to obtain the bundle lock.

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