You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shiro.apache.org by "Tuomas Kiviaho (JIRA)" <ji...@apache.org> on 2012/10/15 11:18:03 UTC

[jira] [Created] (SHIRO-387) EnvironmentLoader destroys wrong environment

Tuomas Kiviaho created SHIRO-387:
------------------------------------

             Summary: EnvironmentLoader destroys wrong environment
                 Key: SHIRO-387
                 URL: https://issues.apache.org/jira/browse/SHIRO-387
             Project: Shiro
          Issue Type: Bug
          Components: Web
    Affects Versions: 1.2.1
            Reporter: Tuomas Kiviaho


I've got a singleton EnvironmentLoader that is used to create multiple environments for multiple servlet contexts. Initialization goes all well but destroying is done to the last created environment and not to the one that resides in given servlet context.

A simple fix/workaroud would be to change the destroyEnvironment as
{code}
LifecycleUtils.destroy(servletContext.removeAttribute(ENVIRONMENT_ATTRIBUTE_KEY));
{code}

Instance variable reference to last initialized environment should also be removed to allow garbage to be collected after last environment has been destroyed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (SHIRO-387) EnvironmentLoader destroys wrong environment

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

Tuomas Kiviaho updated SHIRO-387:
---------------------------------

    Description: 
I've got a singleton EnvironmentLoader that is used to create multiple environments for multiple servlet contexts. Initialization goes all well but destroying is done to the last created environment and not to the one that resides in given servlet context.

A simple fix/workaroud would be to change the destroyEnvironment as
{code}
Object environment = servletContext.getAttribute(ENVIRONMENT_ATTRIBUTE_KEY);
LifecycleUtils.destroy(environment);
{code}

Instance variable reference to last initialized environment should also be removed to allow garbage to be collected after last environment has been destroyed.

  was:
I've got a singleton EnvironmentLoader that is used to create multiple environments for multiple servlet contexts. Initialization goes all well but destroying is done to the last created environment and not to the one that resides in given servlet context.

A simple fix/workaroud would be to change the destroyEnvironment as
{code}
LifecycleUtils.destroy(servletContext.removeAttribute(ENVIRONMENT_ATTRIBUTE_KEY));
{code}

Instance variable reference to last initialized environment should also be removed to allow garbage to be collected after last environment has been destroyed.

    
> EnvironmentLoader destroys wrong environment
> --------------------------------------------
>
>                 Key: SHIRO-387
>                 URL: https://issues.apache.org/jira/browse/SHIRO-387
>             Project: Shiro
>          Issue Type: Bug
>          Components: Web
>    Affects Versions: 1.2.1
>            Reporter: Tuomas Kiviaho
>
> I've got a singleton EnvironmentLoader that is used to create multiple environments for multiple servlet contexts. Initialization goes all well but destroying is done to the last created environment and not to the one that resides in given servlet context.
> A simple fix/workaroud would be to change the destroyEnvironment as
> {code}
> Object environment = servletContext.getAttribute(ENVIRONMENT_ATTRIBUTE_KEY);
> LifecycleUtils.destroy(environment);
> {code}
> Instance variable reference to last initialized environment should also be removed to allow garbage to be collected after last environment has been destroyed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (SHIRO-387) EnvironmentLoader destroys wrong environment

Posted by "Tuomas Kiviaho (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHIRO-387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13476052#comment-13476052 ] 

Tuomas Kiviaho commented on SHIRO-387:
--------------------------------------

An extra feature request would be to have a finalizeEnvironment counterpart to customizeEnvironment which singleton EnvironmentLoaders could utilize to avoid destroying of shared objects
                
> EnvironmentLoader destroys wrong environment
> --------------------------------------------
>
>                 Key: SHIRO-387
>                 URL: https://issues.apache.org/jira/browse/SHIRO-387
>             Project: Shiro
>          Issue Type: Bug
>          Components: Web
>    Affects Versions: 1.2.1
>            Reporter: Tuomas Kiviaho
>
> I've got a singleton EnvironmentLoader that is used to create multiple environments for multiple servlet contexts. Initialization goes all well but destroying is done to the last created environment and not to the one that resides in given servlet context.
> A simple fix/workaroud would be to change the destroyEnvironment as
> {code}
> Object environment = servletContext.getAttribute(ENVIRONMENT_ATTRIBUTE_KEY);
> LifecycleUtils.destroy(environment);
> {code}
> Instance variable reference to last initialized environment should also be removed to allow garbage to be collected after last environment has been destroyed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (SHIRO-387) EnvironmentLoader destroys wrong environment

Posted by "Les Hazlewood (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHIRO-387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13476490#comment-13476490 ] 

Les Hazlewood commented on SHIRO-387:
-------------------------------------

Quite right - thanks for the issue Tuomas!
                
> EnvironmentLoader destroys wrong environment
> --------------------------------------------
>
>                 Key: SHIRO-387
>                 URL: https://issues.apache.org/jira/browse/SHIRO-387
>             Project: Shiro
>          Issue Type: Bug
>          Components: Web
>    Affects Versions: 1.2.1
>            Reporter: Tuomas Kiviaho
>
> I've got a singleton EnvironmentLoader that is used to create multiple environments for multiple servlet contexts. Initialization goes all well but destroying is done to the last created environment and not to the one that resides in given servlet context.
> A simple fix/workaroud would be to change the destroyEnvironment as
> {code}
> Object environment = servletContext.getAttribute(ENVIRONMENT_ATTRIBUTE_KEY);
> LifecycleUtils.destroy(environment);
> {code}
> Instance variable reference to last initialized environment should also be removed to allow garbage to be collected after last environment has been destroyed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira