You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Vivek Pandey (JIRA)" <ji...@apache.org> on 2009/04/20 21:01:48 UTC

[jira] Created: (FELIX-1045) Felix 1.6.0 fails with ClassCircularityError

Felix 1.6.0 fails with ClassCircularityError
--------------------------------------------

                 Key: FELIX-1045
                 URL: https://issues.apache.org/jira/browse/FELIX-1045
             Project: Felix
          Issue Type: Bug
            Reporter: Vivek Pandey


In Glassfish v3, JRuby runtime classes are loaded by a URLClassLoader form inside an OSGi bundle. This all worked fine till upgrade to Felix 1.6.0. With felix 1.6.0 it fails with ClassCircularityError. See [1] below. This issue seems to be related to FELIX-962. 

This is 
discussed on dev@glassfish at http://www.nabble.com/Re:-ClassCircularityError-reported-with-the-
latest-v3-trunk-td23118716.html. 

Here is the evaluation of this issue by Richard Hall, a patched version of felix.jar is tested and it works 
fine. 

----------
This code in Felix should only ever be executed when there is a CNFE that is going to be thrown. Do 
you know if you should correctly be getting a CNFE?

To be clear, the explicit issue we are talking about is this change in Felix:

    http://issues.apache.org/jira/browse/FELIX-962

We actually try to determine if a class is an inner class of a class loader when we are trying to guess 
whether or not we should delegate to the parent class loader. This is part of a hack which is a last ditch 
effort to avoid CNFE for bad JRE code that assumes it should be able to see everything on the class path 
from any class loader.

The change from FELIX-962 is actually implemented in two different ways, one for JDK < 1.5 and one 
for JDK >= 1.5. In the >= 1.5 version we use the method Class.getEnclosingClass(), which seems to 
cause the error for perhaps the reasons in the JDK bug you referenced. We implemented the two 
different approaches since we assumed performance would be better by just using getEnclosingClass() 
than trying to figure it out the enclosing class manually, which involves doing a class load.

We could potentially try always using the < 1.5 approach, which does not use that method. If I created 
a felix.jar that did that, could you test it to see if it resolved the issue? 
----------

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


[jira] Assigned: (FELIX-1045) Felix 1.6.0 fails with ClassCircularityError

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

Richard S. Hall reassigned FELIX-1045:
--------------------------------------

    Assignee: Richard S. Hall

> Felix 1.6.0 fails with ClassCircularityError
> --------------------------------------------
>
>                 Key: FELIX-1045
>                 URL: https://issues.apache.org/jira/browse/FELIX-1045
>             Project: Felix
>          Issue Type: Bug
>            Reporter: Vivek Pandey
>            Assignee: Richard S. Hall
>
> In Glassfish v3, JRuby runtime classes are loaded by a URLClassLoader form inside an OSGi bundle. This all worked fine till upgrade to Felix 1.6.0. With felix 1.6.0 it fails with ClassCircularityError. See [1] below. This issue seems to be related to FELIX-962. 
> This is 
> discussed on dev@glassfish at http://www.nabble.com/Re:-ClassCircularityError-reported-with-the-
> latest-v3-trunk-td23118716.html. 
> Here is the evaluation of this issue by Richard Hall, a patched version of felix.jar is tested and it works 
> fine. 
> ----------
> This code in Felix should only ever be executed when there is a CNFE that is going to be thrown. Do 
> you know if you should correctly be getting a CNFE?
> To be clear, the explicit issue we are talking about is this change in Felix:
>     http://issues.apache.org/jira/browse/FELIX-962
> We actually try to determine if a class is an inner class of a class loader when we are trying to guess 
> whether or not we should delegate to the parent class loader. This is part of a hack which is a last ditch 
> effort to avoid CNFE for bad JRE code that assumes it should be able to see everything on the class path 
> from any class loader.
> The change from FELIX-962 is actually implemented in two different ways, one for JDK < 1.5 and one 
> for JDK >= 1.5. In the >= 1.5 version we use the method Class.getEnclosingClass(), which seems to 
> cause the error for perhaps the reasons in the JDK bug you referenced. We implemented the two 
> different approaches since we assumed performance would be better by just using getEnclosingClass() 
> than trying to figure it out the enclosing class manually, which involves doing a class load.
> We could potentially try always using the < 1.5 approach, which does not use that method. If I created 
> a felix.jar that did that, could you test it to see if it resolved the issue? 
> ----------

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


[jira] Updated: (FELIX-1045) Felix 1.6.0 fails with ClassCircularityError

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

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

          Component/s: Framework
    Affects Version/s: felix-1.6.0
        Fix Version/s: felix-1.8.0

> Felix 1.6.0 fails with ClassCircularityError
> --------------------------------------------
>
>                 Key: FELIX-1045
>                 URL: https://issues.apache.org/jira/browse/FELIX-1045
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: felix-1.6.0
>            Reporter: Vivek Pandey
>            Assignee: Richard S. Hall
>             Fix For: felix-1.8.0
>
>
> In Glassfish v3, JRuby runtime classes are loaded by a URLClassLoader form inside an OSGi bundle. This all worked fine till upgrade to Felix 1.6.0. With felix 1.6.0 it fails with ClassCircularityError. See [1] below. This issue seems to be related to FELIX-962. 
> This is 
> discussed on dev@glassfish at http://www.nabble.com/Re:-ClassCircularityError-reported-with-the-
> latest-v3-trunk-td23118716.html. 
> Here is the evaluation of this issue by Richard Hall, a patched version of felix.jar is tested and it works 
> fine. 
> ----------
> This code in Felix should only ever be executed when there is a CNFE that is going to be thrown. Do 
> you know if you should correctly be getting a CNFE?
> To be clear, the explicit issue we are talking about is this change in Felix:
>     http://issues.apache.org/jira/browse/FELIX-962
> We actually try to determine if a class is an inner class of a class loader when we are trying to guess 
> whether or not we should delegate to the parent class loader. This is part of a hack which is a last ditch 
> effort to avoid CNFE for bad JRE code that assumes it should be able to see everything on the class path 
> from any class loader.
> The change from FELIX-962 is actually implemented in two different ways, one for JDK < 1.5 and one 
> for JDK >= 1.5. In the >= 1.5 version we use the method Class.getEnclosingClass(), which seems to 
> cause the error for perhaps the reasons in the JDK bug you referenced. We implemented the two 
> different approaches since we assumed performance would be better by just using getEnclosingClass() 
> than trying to figure it out the enclosing class manually, which involves doing a class load.
> We could potentially try always using the < 1.5 approach, which does not use that method. If I created 
> a felix.jar that did that, could you test it to see if it resolved the issue? 
> ----------

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


[jira] Resolved: (FELIX-1045) Felix 1.6.0 fails with ClassCircularityError

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

Richard S. Hall resolved FELIX-1045.
------------------------------------

    Resolution: Fixed

I have committed a patch for this issue. Please close if you are satisfied. Thanks.

> Felix 1.6.0 fails with ClassCircularityError
> --------------------------------------------
>
>                 Key: FELIX-1045
>                 URL: https://issues.apache.org/jira/browse/FELIX-1045
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: felix-1.6.0
>            Reporter: Vivek Pandey
>            Assignee: Richard S. Hall
>             Fix For: felix-1.8.0
>
>
> In Glassfish v3, JRuby runtime classes are loaded by a URLClassLoader form inside an OSGi bundle. This all worked fine till upgrade to Felix 1.6.0. With felix 1.6.0 it fails with ClassCircularityError. See [1] below. This issue seems to be related to FELIX-962. 
> This is 
> discussed on dev@glassfish at http://www.nabble.com/Re:-ClassCircularityError-reported-with-the-
> latest-v3-trunk-td23118716.html. 
> Here is the evaluation of this issue by Richard Hall, a patched version of felix.jar is tested and it works 
> fine. 
> ----------
> This code in Felix should only ever be executed when there is a CNFE that is going to be thrown. Do 
> you know if you should correctly be getting a CNFE?
> To be clear, the explicit issue we are talking about is this change in Felix:
>     http://issues.apache.org/jira/browse/FELIX-962
> We actually try to determine if a class is an inner class of a class loader when we are trying to guess 
> whether or not we should delegate to the parent class loader. This is part of a hack which is a last ditch 
> effort to avoid CNFE for bad JRE code that assumes it should be able to see everything on the class path 
> from any class loader.
> The change from FELIX-962 is actually implemented in two different ways, one for JDK < 1.5 and one 
> for JDK >= 1.5. In the >= 1.5 version we use the method Class.getEnclosingClass(), which seems to 
> cause the error for perhaps the reasons in the JDK bug you referenced. We implemented the two 
> different approaches since we assumed performance would be better by just using getEnclosingClass() 
> than trying to figure it out the enclosing class manually, which involves doing a class load.
> We could potentially try always using the < 1.5 approach, which does not use that method. If I created 
> a felix.jar that did that, could you test it to see if it resolved the issue? 
> ----------

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


[jira] Updated: (FELIX-1045) Felix 1.6.0 fails with ClassCircularityError

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

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

    Fix Version/s:     (was: felix-1.8.0)
                   felix-1.6.1

> Felix 1.6.0 fails with ClassCircularityError
> --------------------------------------------
>
>                 Key: FELIX-1045
>                 URL: https://issues.apache.org/jira/browse/FELIX-1045
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: felix-1.6.0
>            Reporter: Vivek Pandey
>            Assignee: Richard S. Hall
>             Fix For: felix-1.6.1
>
>
> In Glassfish v3, JRuby runtime classes are loaded by a URLClassLoader form inside an OSGi bundle. This all worked fine till upgrade to Felix 1.6.0. With felix 1.6.0 it fails with ClassCircularityError. See [1] below. This issue seems to be related to FELIX-962. 
> This is 
> discussed on dev@glassfish at http://www.nabble.com/Re:-ClassCircularityError-reported-with-the-
> latest-v3-trunk-td23118716.html. 
> Here is the evaluation of this issue by Richard Hall, a patched version of felix.jar is tested and it works 
> fine. 
> ----------
> This code in Felix should only ever be executed when there is a CNFE that is going to be thrown. Do 
> you know if you should correctly be getting a CNFE?
> To be clear, the explicit issue we are talking about is this change in Felix:
>     http://issues.apache.org/jira/browse/FELIX-962
> We actually try to determine if a class is an inner class of a class loader when we are trying to guess 
> whether or not we should delegate to the parent class loader. This is part of a hack which is a last ditch 
> effort to avoid CNFE for bad JRE code that assumes it should be able to see everything on the class path 
> from any class loader.
> The change from FELIX-962 is actually implemented in two different ways, one for JDK < 1.5 and one 
> for JDK >= 1.5. In the >= 1.5 version we use the method Class.getEnclosingClass(), which seems to 
> cause the error for perhaps the reasons in the JDK bug you referenced. We implemented the two 
> different approaches since we assumed performance would be better by just using getEnclosingClass() 
> than trying to figure it out the enclosing class manually, which involves doing a class load.
> We could potentially try always using the < 1.5 approach, which does not use that method. If I created 
> a felix.jar that did that, could you test it to see if it resolved the issue? 
> ----------

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


[jira] Commented: (FELIX-1045) Felix 1.6.0 fails with ClassCircularityError

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

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

It appears as if Felix is running into the following JDK bug:

    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6508296

The JVM thinks there is a circularity error when there is not. The workaround for us seems to be avoid using Class.getEnclosingClass(). The only potential downside is the possible performance impact and/or accuracy of manually trying to determine the enclosing class, which may or may not be an issue.

> Felix 1.6.0 fails with ClassCircularityError
> --------------------------------------------
>
>                 Key: FELIX-1045
>                 URL: https://issues.apache.org/jira/browse/FELIX-1045
>             Project: Felix
>          Issue Type: Bug
>            Reporter: Vivek Pandey
>
> In Glassfish v3, JRuby runtime classes are loaded by a URLClassLoader form inside an OSGi bundle. This all worked fine till upgrade to Felix 1.6.0. With felix 1.6.0 it fails with ClassCircularityError. See [1] below. This issue seems to be related to FELIX-962. 
> This is 
> discussed on dev@glassfish at http://www.nabble.com/Re:-ClassCircularityError-reported-with-the-
> latest-v3-trunk-td23118716.html. 
> Here is the evaluation of this issue by Richard Hall, a patched version of felix.jar is tested and it works 
> fine. 
> ----------
> This code in Felix should only ever be executed when there is a CNFE that is going to be thrown. Do 
> you know if you should correctly be getting a CNFE?
> To be clear, the explicit issue we are talking about is this change in Felix:
>     http://issues.apache.org/jira/browse/FELIX-962
> We actually try to determine if a class is an inner class of a class loader when we are trying to guess 
> whether or not we should delegate to the parent class loader. This is part of a hack which is a last ditch 
> effort to avoid CNFE for bad JRE code that assumes it should be able to see everything on the class path 
> from any class loader.
> The change from FELIX-962 is actually implemented in two different ways, one for JDK < 1.5 and one 
> for JDK >= 1.5. In the >= 1.5 version we use the method Class.getEnclosingClass(), which seems to 
> cause the error for perhaps the reasons in the JDK bug you referenced. We implemented the two 
> different approaches since we assumed performance would be better by just using getEnclosingClass() 
> than trying to figure it out the enclosing class manually, which involves doing a class load.
> We could potentially try always using the < 1.5 approach, which does not use that method. If I created 
> a felix.jar that did that, could you test it to see if it resolved the issue? 
> ----------

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