You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Joe Bergmark (JIRA)" <ji...@apache.org> on 2010/04/14 05:02:06 UTC

[jira] Created: (OWB-354) WebContextService may throw NPE in tiered classloading environmemt

WebContextService may throw NPE in tiered classloading environmemt
------------------------------------------------------------------

                 Key: OWB-354
                 URL: https://issues.apache.org/jira/browse/OWB-354
             Project: OpenWebBeans
          Issue Type: Bug
          Components: Context and Scopes
    Affects Versions: M4
            Reporter: Joe Bergmark
            Assignee: Joe Bergmark
             Fix For: 1.0.0


WebContextService sets the static context variables (which are ThreadLocals) to null during a call to destroy.  For example requestContext.

In a classloading environment where the same WebContextService would be shared between webapps, this could lead to a NullPointerException in another application as the static variable has been set to null and that static would be shared.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (OWB-354) WebContextService may throw NPE in tiered classloading environmemt

Posted by "Gurkan Erdogdu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12857084#action_12857084 ] 

Gurkan Erdogdu commented on OWB-354:
------------------------------------

I have committed changes.

> WebContextService may throw NPE in tiered classloading environmemt
> ------------------------------------------------------------------
>
>                 Key: OWB-354
>                 URL: https://issues.apache.org/jira/browse/OWB-354
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Context and Scopes
>    Affects Versions: M4
>            Reporter: Joe Bergmark
>            Assignee: Joe Bergmark
>             Fix For: 1.0.0
>
>
> WebContextService sets the static context variables (which are ThreadLocals) to null during a call to destroy.  For example requestContext.
> In a classloading environment where the same WebContextService would be shared between webapps, this could lead to a NullPointerException in another application as the static variable has been set to null and that static would be shared.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (OWB-354) WebContextService may throw NPE in tiered classloading environmemt

Posted by "Joe Bergmark (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12857066#action_12857066 ] 

Joe Bergmark commented on OWB-354:
----------------------------------

I was thinking some more about this today.

It seems like there is no need for these variables in the WebContextService to be static at all.  Please correct me if I am wrong, but the ContextService is already looked up via the WebBeansFinder, so we will already have one per classloader (which presumably means one per application).  If the goal is to share things inside of an app, we already get that behavior by having them as instance variables.  The threadlocals will prevent us from sharing those particular contexts between different threads in the same app.

It seems a simple solution would be to simply make all of the static variables instance variables, unless there is something we really need to share between applications.  I can't come up with anything in my review.

> WebContextService may throw NPE in tiered classloading environmemt
> ------------------------------------------------------------------
>
>                 Key: OWB-354
>                 URL: https://issues.apache.org/jira/browse/OWB-354
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Context and Scopes
>    Affects Versions: M4
>            Reporter: Joe Bergmark
>            Assignee: Joe Bergmark
>             Fix For: 1.0.0
>
>
> WebContextService sets the static context variables (which are ThreadLocals) to null during a call to destroy.  For example requestContext.
> In a classloading environment where the same WebContextService would be shared between webapps, this could lead to a NullPointerException in another application as the static variable has been set to null and that static would be shared.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (OWB-354) WebContextService may throw NPE in tiered classloading environmemt

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

Gurkan Erdogdu closed OWB-354.
------------------------------

      Assignee: Gurkan Erdogdu  (was: Joe Bergmark)
    Resolution: Fixed

> WebContextService may throw NPE in tiered classloading environmemt
> ------------------------------------------------------------------
>
>                 Key: OWB-354
>                 URL: https://issues.apache.org/jira/browse/OWB-354
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Context and Scopes
>    Affects Versions: M4
>            Reporter: Joe Bergmark
>            Assignee: Gurkan Erdogdu
>             Fix For: 1.0.0-CR1
>
>
> WebContextService sets the static context variables (which are ThreadLocals) to null during a call to destroy.  For example requestContext.
> In a classloading environment where the same WebContextService would be shared between webapps, this could lead to a NullPointerException in another application as the static variable has been set to null and that static would be shared.

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


[jira] Commented: (OWB-354) WebContextService may throw NPE in tiered classloading environmemt

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12857102#action_12857102 ] 

Mark Struberg commented on OWB-354:
-----------------------------------

There are a few problematic areas with non-static ThreadLocals, but they are allowed in general.
http://www.0xcafefeed.com/2004/06/of-non-static-threadlocals-and-memory/


> WebContextService may throw NPE in tiered classloading environmemt
> ------------------------------------------------------------------
>
>                 Key: OWB-354
>                 URL: https://issues.apache.org/jira/browse/OWB-354
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Context and Scopes
>    Affects Versions: M4
>            Reporter: Joe Bergmark
>            Assignee: Joe Bergmark
>             Fix For: 1.0.0
>
>
> WebContextService sets the static context variables (which are ThreadLocals) to null during a call to destroy.  For example requestContext.
> In a classloading environment where the same WebContextService would be shared between webapps, this could lead to a NullPointerException in another application as the static variable has been set to null and that static would be shared.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (OWB-354) WebContextService may throw NPE in tiered classloading environmemt

Posted by "Gurkan Erdogdu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12857083#action_12857083 ] 

Gurkan Erdogdu commented on OWB-354:
------------------------------------

ThreadLocals are static variables. But point is that we can remove null assigning in destroy(), seems that that is a problem.

> WebContextService may throw NPE in tiered classloading environmemt
> ------------------------------------------------------------------
>
>                 Key: OWB-354
>                 URL: https://issues.apache.org/jira/browse/OWB-354
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Context and Scopes
>    Affects Versions: M4
>            Reporter: Joe Bergmark
>            Assignee: Joe Bergmark
>             Fix For: 1.0.0
>
>
> WebContextService sets the static context variables (which are ThreadLocals) to null during a call to destroy.  For example requestContext.
> In a classloading environment where the same WebContextService would be shared between webapps, this could lead to a NullPointerException in another application as the static variable has been set to null and that static would be shared.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (OWB-354) WebContextService may throw NPE in tiered classloading environmemt

Posted by "Gurkan Erdogdu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12857115#action_12857115 ] 

Gurkan Erdogdu commented on OWB-354:
------------------------------------

Using of Thread local is related with current context of the current thread. Please see context section is spec.

> WebContextService may throw NPE in tiered classloading environmemt
> ------------------------------------------------------------------
>
>                 Key: OWB-354
>                 URL: https://issues.apache.org/jira/browse/OWB-354
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Context and Scopes
>    Affects Versions: M4
>            Reporter: Joe Bergmark
>            Assignee: Joe Bergmark
>             Fix For: 1.0.0
>
>
> WebContextService sets the static context variables (which are ThreadLocals) to null during a call to destroy.  For example requestContext.
> In a classloading environment where the same WebContextService would be shared between webapps, this could lead to a NullPointerException in another application as the static variable has been set to null and that static would be shared.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (OWB-354) WebContextService may throw NPE in tiered classloading environmemt

Posted by "Joe Bergmark (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12857099#action_12857099 ] 

Joe Bergmark commented on OWB-354:
----------------------------------

I wasn't aware that ThreadLocal's had to be static.

What about the non-ThreadLocal's - sessionCtxManager & conversationManager?  Do we really want those shared between applications?  That is what will happen in a tiered classloading environment when multiple applications are using the same OWB classloader.

Couldn't those both just be instance variables as well?

> WebContextService may throw NPE in tiered classloading environmemt
> ------------------------------------------------------------------
>
>                 Key: OWB-354
>                 URL: https://issues.apache.org/jira/browse/OWB-354
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Context and Scopes
>    Affects Versions: M4
>            Reporter: Joe Bergmark
>            Assignee: Joe Bergmark
>             Fix For: 1.0.0
>
>
> WebContextService sets the static context variables (which are ThreadLocals) to null during a call to destroy.  For example requestContext.
> In a classloading environment where the same WebContextService would be shared between webapps, this could lead to a NullPointerException in another application as the static variable has been set to null and that static would be shared.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira