You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org> on 2010/01/14 11:57:54 UTC

[jira] Created: (MYFACES-2485) Ensure invocation of @PreDestroy methods on container shutdown/restart

Ensure invocation of @PreDestroy methods on container shutdown/restart
----------------------------------------------------------------------

                 Key: MYFACES-2485
                 URL: https://issues.apache.org/jira/browse/MYFACES-2485
             Project: MyFaces Core
          Issue Type: Improvement
    Affects Versions: 2.0.0-alpha
            Reporter: Jakob Korherr


Because of the fact that only ServletContextListener.contextDestroyed() is invoked on a container shutdown/restart, the correct destruction of ManagedBeans in session, view and request scope is not ensured.

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


[jira] Commented: (MYFACES-2485) Ensure invocation of @PreDestroy methods on container shutdown/restart

Posted by "Bernhard Huemer (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12800228#action_12800228 ] 

Bernhard Huemer commented on MYFACES-2485:
------------------------------------------

Well, again I beg to differ, because a container only shuts down after all threads within any servlet's service method have exited or after a certain timeout period has passed (that's at least how it's supposed to be the case according to Sun - otherwise you've come across an issue ..). So, if you know that you've got potentially long-running requests, just increase that timeout period, just to be sure - that's it.

Regarding the "client-side state view-scoped beans", I'm just curious, how are you going to destroy those beans if they are actually saved client-side? There's no connection to that client anymore after all? Does the view itself get invalidated as well if the container restarts?

> Ensure invocation of @PreDestroy methods on container shutdown/restart
> ----------------------------------------------------------------------
>
>                 Key: MYFACES-2485
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2485
>             Project: MyFaces Core
>          Issue Type: Improvement
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>
> Because of the fact that only ServletContextListener.contextDestroyed() is invoked on a container shutdown/restart, the correct destruction of ManagedBeans in session, view and request scope is not ensured.

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


[jira] Commented: (MYFACES-2485) Ensure invocation of @PreDestroy methods on container shutdown/restart

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12800231#action_12800231 ] 

Jakob Korherr commented on MYFACES-2485:
----------------------------------------

Well, I did not think that far...

So you propose to leave it the way it is, am I right?

> Ensure invocation of @PreDestroy methods on container shutdown/restart
> ----------------------------------------------------------------------
>
>                 Key: MYFACES-2485
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2485
>             Project: MyFaces Core
>          Issue Type: Improvement
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>
> Because of the fact that only ServletContextListener.contextDestroyed() is invoked on a container shutdown/restart, the correct destruction of ManagedBeans in session, view and request scope is not ensured.

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


[jira] Commented: (MYFACES-2485) Ensure invocation of @PreDestroy methods on container shutdown/restart

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12800190#action_12800190 ] 

Jakob Korherr commented on MYFACES-2485:
----------------------------------------

So you're saying it would be better not to destroy all session beans on a container shutdown, because they are maybe serialized? Then what about a config parameter to turn this feature on or off?

And what about view and request beans?

> Ensure invocation of @PreDestroy methods on container shutdown/restart
> ----------------------------------------------------------------------
>
>                 Key: MYFACES-2485
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2485
>             Project: MyFaces Core
>          Issue Type: Improvement
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>
> Because of the fact that only ServletContextListener.contextDestroyed() is invoked on a container shutdown/restart, the correct destruction of ManagedBeans in session, view and request scope is not ensured.

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


[jira] Updated: (MYFACES-2485) Ensure invocation of @PreDestroy methods on container shutdown/restart

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jakob Korherr updated MYFACES-2485:
-----------------------------------

    Status: Patch Available  (was: Open)

> Ensure invocation of @PreDestroy methods on container shutdown/restart
> ----------------------------------------------------------------------
>
>                 Key: MYFACES-2485
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2485
>             Project: MyFaces Core
>          Issue Type: Improvement
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>
> Because of the fact that only ServletContextListener.contextDestroyed() is invoked on a container shutdown/restart, the correct destruction of ManagedBeans in session, view and request scope is not ensured.

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


[jira] Updated: (MYFACES-2485) Ensure invocation of @PreDestroy methods on container shutdown/restart

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jakob Korherr updated MYFACES-2485:
-----------------------------------

    Status: Open  (was: Patch Available)

> Ensure invocation of @PreDestroy methods on container shutdown/restart
> ----------------------------------------------------------------------
>
>                 Key: MYFACES-2485
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2485
>             Project: MyFaces Core
>          Issue Type: Improvement
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>         Attachments: myfaces-2485.patch
>
>
> Because of the fact that only ServletContextListener.contextDestroyed() is invoked on a container shutdown/restart, the correct destruction of ManagedBeans in session, view and request scope is not ensured.

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


[jira] Commented: (MYFACES-2485) Ensure invocation of @PreDestroy methods on container shutdown/restart

Posted by "Bernhard Huemer (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12800252#action_12800252 ] 

Bernhard Huemer commented on MYFACES-2485:
------------------------------------------

Yep, leaving it as it is is basically what I'm suggesting. I think there's actually no need to change anything, it's simply put none of our business if there's a bug in terms of cleaning up a container that shuts down. In fact, I can't think of another web framework that cares about it either (though this "carelessness" of course doesn't necessarily mean it's not an issue that has to be resolved, but I think I've already explained why those frameworks probably don't care). 

Have a nice day, regards! :-)

> Ensure invocation of @PreDestroy methods on container shutdown/restart
> ----------------------------------------------------------------------
>
>                 Key: MYFACES-2485
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2485
>             Project: MyFaces Core
>          Issue Type: Improvement
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>
> Because of the fact that only ServletContextListener.contextDestroyed() is invoked on a container shutdown/restart, the correct destruction of ManagedBeans in session, view and request scope is not ensured.

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


[jira] Commented: (MYFACES-2485) Ensure invocation of @PreDestroy methods on container shutdown/restart

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12800205#action_12800205 ] 

Jakob Korherr commented on MYFACES-2485:
----------------------------------------

The reason I opened this issue was because I wanted to ensure a very clean container shutdown. I can now see that it is not good destroy the session beans on a container shutdown.

However, there are maybe lots of active requests on a productive environment and I think those should definitely be destroyed correctly.

The view-scoped beans are stored in the current view and thus in the view state. If we have server-side state saving this is the session and if we have client-side state saving this is the hidden input field. So when using server-side state saving they probably should not be destroyed. However, when using client-side state saving there are problems when restoring the view after a container restart, so these should be destroyed I think.

> Ensure invocation of @PreDestroy methods on container shutdown/restart
> ----------------------------------------------------------------------
>
>                 Key: MYFACES-2485
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2485
>             Project: MyFaces Core
>          Issue Type: Improvement
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>
> Because of the fact that only ServletContextListener.contextDestroyed() is invoked on a container shutdown/restart, the correct destruction of ManagedBeans in session, view and request scope is not ensured.

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


[jira] Commented: (MYFACES-2485) Ensure invocation of @PreDestroy methods on container shutdown/restart

Posted by "Bernhard Huemer (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12800189#action_12800189 ] 

Bernhard Huemer commented on MYFACES-2485:
------------------------------------------

To be honest, I'd consider this as the expected behaviour, just imagine a clustered environment. Additionally keeping for example Tomcat in mind, knowing that Tomcat serializes sessions at shutdown, I don't really know whether it's necessary to invalidate session beans in this case.

> Ensure invocation of @PreDestroy methods on container shutdown/restart
> ----------------------------------------------------------------------
>
>                 Key: MYFACES-2485
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2485
>             Project: MyFaces Core
>          Issue Type: Improvement
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>
> Because of the fact that only ServletContextListener.contextDestroyed() is invoked on a container shutdown/restart, the correct destruction of ManagedBeans in session, view and request scope is not ensured.

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


[jira] Commented: (MYFACES-2485) Ensure invocation of @PreDestroy methods on container shutdown/restart

Posted by "Bernhard Huemer (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12800198#action_12800198 ] 

Bernhard Huemer commented on MYFACES-2485:
------------------------------------------

What I'm saying is basically don't try to mess with the container. If it really turns out to be an issue, it's definitely container related and has nothing to do with MyFaces (and I'd even suggest not to work around that issue in this case, because we'd possibly mess up things regarding holding invalid references and so on ..). It's the container's responsibility to invalidate the session properly. If the user doesn't like the serialization-default he just has to configure Tomcat accordingly and I just presume that the session callbacks will then be called once the container shuts down (otherwise I'd consider this as a container bug probably). So why am I against working around this, if it really turns out be an issue? Well, basically because destructing session beans solves that issue only partly, what about the StateManager's views? What about basically everything else that's in the session?

Regarding the view and request scoped beans, well if you're able to find a request scoped bean that hasn't been destroyed once the container shuts down (assuming that there is no active request), congratulations, you've found another container bug. View-scoped beans are probably somehow saved in the user's session, aren't they (sorry, I don't know JSF 2.0 very well)? If that's the case, you don't even have to consider it, because what I've written above just applies to these beans as well (i.e. don't try to mess with the container's responsibilities).

> Ensure invocation of @PreDestroy methods on container shutdown/restart
> ----------------------------------------------------------------------
>
>                 Key: MYFACES-2485
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2485
>             Project: MyFaces Core
>          Issue Type: Improvement
>    Affects Versions: 2.0.0-alpha
>            Reporter: Jakob Korherr
>
> Because of the fact that only ServletContextListener.contextDestroyed() is invoked on a container shutdown/restart, the correct destruction of ManagedBeans in session, view and request scope is not ensured.

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