You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Décio Heinzelmann Luckow (JIRA)" <ji...@apache.org> on 2007/12/17 21:18:35 UTC

[jira] Created: (WW-2381) Destroy method of Interceptor is never called by Struts

Destroy method of Interceptor is never called by Struts
-------------------------------------------------------

                 Key: WW-2381
                 URL: https://issues.apache.org/struts/browse/WW-2381
             Project: Struts 2
          Issue Type: Bug
          Components: Core Interceptors
    Affects Versions: 2.0.9
         Environment: Window XP, Apache Tomcat 5.5.23, Java 5, Eclise 3.2
            Reporter: Décio Heinzelmann Luckow


I was testing the Interceptor behavior, and put an breakpoint inside the methods init and destroy of Interceptor (TestInterceptor created). The init method was ok, the  breakpoint stopped on the server startup.

To test the breakpoint of destroy method I does:
- normal shutdown of tomcat (via Tomcat plugin in Eclipse)
- redeploy the application
- changed some classes to tomcat do the automatic reload

But any of this cases the destroy method was called. I seach in the source code to find it and understand when it is called, but I don´t found.

I use the 2.09 version, but is possible that it occurs in all versions of Struts2

Attached the conversation about this in dev-list

Tom Schneider wrote:
You know, I think you're right!  I searched the entire codebase (both xwork and struts) and I have found nowhere where we call destroy() on the interceptors.  I guess that hasn't been an issue because if the destroy isn't being called, no big deal because your usually shutting down anyway.

If we were to call destroy on the interceptors, I would expect it to happen in the cleanup() method of Dispatcher.  This is where all the rest of the cleanup happens.  At runtime, the list of interceptors is stored in the ActionConfig object.  (part of xwork)  Perhaps it might be a good idea to submit a patch that fixes this issue. :) (hint, hint) Tom

Dale Newfield wrote:
This might be why undeploying a struts webapp tends to fail (the struts core and plugin jars can't be removed because they're still in use).

Ted Husted wrote:
I haven't traced the code, but I believe we redeploy the Interceptors in dev mode, making a destroy option more important.



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


[jira] Updated: (WW-2381) Destroy method of Interceptor is never called by Struts

Posted by "David N. Arnold (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2381?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David N. Arnold updated WW-2381:
--------------------------------

    Attachment: InterceptorDestroy.diff

Attached patch for Dispatcher.cleanup() as Tom Schneider suggested.  However, I used PackageConfig instead of ActionConfig to build the set of Interceptors to be destroyed.  AFAICT, that's the only way ensure every Interceptor is destroyed.

This issue is important to me since I allocate database connections in an Interceptor.init() and they aren't getting released when Jetty auto-redeploys :)

> Destroy method of Interceptor is never called by Struts
> -------------------------------------------------------
>
>                 Key: WW-2381
>                 URL: https://issues.apache.org/struts/browse/WW-2381
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors
>    Affects Versions: 2.0.9
>         Environment: Window XP, Apache Tomcat 5.5.23, Java 5, Eclise 3.2
>            Reporter: Décio Heinzelmann Luckow
>             Fix For: Future
>
>         Attachments: InterceptorDestroy.diff
>
>
> I was testing the Interceptor behavior, and put an breakpoint inside the methods init and destroy of Interceptor (TestInterceptor created). The init method was ok, the  breakpoint stopped on the server startup.
> To test the breakpoint of destroy method I does:
> - normal shutdown of tomcat (via Tomcat plugin in Eclipse)
> - redeploy the application
> - changed some classes to tomcat do the automatic reload
> But any of this cases the destroy method was called. I seach in the source code to find it and understand when it is called, but I don´t found.
> I use the 2.09 version, but is possible that it occurs in all versions of Struts2
> Attached the conversation about this in dev-list
> Tom Schneider wrote:
> You know, I think you're right!  I searched the entire codebase (both xwork and struts) and I have found nowhere where we call destroy() on the interceptors.  I guess that hasn't been an issue because if the destroy isn't being called, no big deal because your usually shutting down anyway.
> If we were to call destroy on the interceptors, I would expect it to happen in the cleanup() method of Dispatcher.  This is where all the rest of the cleanup happens.  At runtime, the list of interceptors is stored in the ActionConfig object.  (part of xwork)  Perhaps it might be a good idea to submit a patch that fixes this issue. :) (hint, hint) Tom
> Dale Newfield wrote:
> This might be why undeploying a struts webapp tends to fail (the struts core and plugin jars can't be removed because they're still in use).
> Ted Husted wrote:
> I haven't traced the code, but I believe we redeploy the Interceptors in dev mode, making a destroy option more important.

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


[jira] Updated: (WW-2381) Destroy method of Interceptor is never called by Struts

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

James Holmes updated WW-2381:
-----------------------------

            Flags: [Patch]
    Fix Version/s:     (was: Future)
                   2.1.3

> Destroy method of Interceptor is never called by Struts
> -------------------------------------------------------
>
>                 Key: WW-2381
>                 URL: https://issues.apache.org/struts/browse/WW-2381
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors
>    Affects Versions: 2.0.9
>         Environment: Window XP, Apache Tomcat 5.5.23, Java 5, Eclise 3.2
>            Reporter: Décio Heinzelmann Luckow
>             Fix For: 2.1.3
>
>         Attachments: InterceptorDestroy.diff
>
>
> I was testing the Interceptor behavior, and put an breakpoint inside the methods init and destroy of Interceptor (TestInterceptor created). The init method was ok, the  breakpoint stopped on the server startup.
> To test the breakpoint of destroy method I does:
> - normal shutdown of tomcat (via Tomcat plugin in Eclipse)
> - redeploy the application
> - changed some classes to tomcat do the automatic reload
> But any of this cases the destroy method was called. I seach in the source code to find it and understand when it is called, but I don´t found.
> I use the 2.09 version, but is possible that it occurs in all versions of Struts2
> Attached the conversation about this in dev-list
> Tom Schneider wrote:
> You know, I think you're right!  I searched the entire codebase (both xwork and struts) and I have found nowhere where we call destroy() on the interceptors.  I guess that hasn't been an issue because if the destroy isn't being called, no big deal because your usually shutting down anyway.
> If we were to call destroy on the interceptors, I would expect it to happen in the cleanup() method of Dispatcher.  This is where all the rest of the cleanup happens.  At runtime, the list of interceptors is stored in the ActionConfig object.  (part of xwork)  Perhaps it might be a good idea to submit a patch that fixes this issue. :) (hint, hint) Tom
> Dale Newfield wrote:
> This might be why undeploying a struts webapp tends to fail (the struts core and plugin jars can't be removed because they're still in use).
> Ted Husted wrote:
> I haven't traced the code, but I believe we redeploy the Interceptors in dev mode, making a destroy option more important.

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


[jira] Updated: (WW-2381) Destroy method of Interceptor is never called by Struts

Posted by "David N. Arnold (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2381?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David N. Arnold updated WW-2381:
--------------------------------

    Attachment: InterceptorDestroyAgainstTrunk.diff

The previous patch was against 2.0.11.2.  Since you marked the Fix Version as 2.1.3, I suppose a patch against trunk would be more useful.

I've included it and a new test case in this diff.

> Destroy method of Interceptor is never called by Struts
> -------------------------------------------------------
>
>                 Key: WW-2381
>                 URL: https://issues.apache.org/struts/browse/WW-2381
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors
>    Affects Versions: 2.0.9
>         Environment: Window XP, Apache Tomcat 5.5.23, Java 5, Eclise 3.2
>            Reporter: Décio Heinzelmann Luckow
>             Fix For: 2.1.3
>
>         Attachments: InterceptorDestroy.diff, InterceptorDestroyAgainstTrunk.diff
>
>
> I was testing the Interceptor behavior, and put an breakpoint inside the methods init and destroy of Interceptor (TestInterceptor created). The init method was ok, the  breakpoint stopped on the server startup.
> To test the breakpoint of destroy method I does:
> - normal shutdown of tomcat (via Tomcat plugin in Eclipse)
> - redeploy the application
> - changed some classes to tomcat do the automatic reload
> But any of this cases the destroy method was called. I seach in the source code to find it and understand when it is called, but I don´t found.
> I use the 2.09 version, but is possible that it occurs in all versions of Struts2
> Attached the conversation about this in dev-list
> Tom Schneider wrote:
> You know, I think you're right!  I searched the entire codebase (both xwork and struts) and I have found nowhere where we call destroy() on the interceptors.  I guess that hasn't been an issue because if the destroy isn't being called, no big deal because your usually shutting down anyway.
> If we were to call destroy on the interceptors, I would expect it to happen in the cleanup() method of Dispatcher.  This is where all the rest of the cleanup happens.  At runtime, the list of interceptors is stored in the ActionConfig object.  (part of xwork)  Perhaps it might be a good idea to submit a patch that fixes this issue. :) (hint, hint) Tom
> Dale Newfield wrote:
> This might be why undeploying a struts webapp tends to fail (the struts core and plugin jars can't be removed because they're still in use).
> Ted Husted wrote:
> I haven't traced the code, but I believe we redeploy the Interceptors in dev mode, making a destroy option more important.

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


[jira] Resolved: (WW-2381) Destroy method of Interceptor is never called by Struts

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

Musachy Barroso resolved WW-2381.
---------------------------------

    Resolution: Fixed

Thanks for the patch!

> Destroy method of Interceptor is never called by Struts
> -------------------------------------------------------
>
>                 Key: WW-2381
>                 URL: https://issues.apache.org/struts/browse/WW-2381
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors
>    Affects Versions: 2.0.9
>         Environment: Window XP, Apache Tomcat 5.5.23, Java 5, Eclise 3.2
>            Reporter: Décio Heinzelmann Luckow
>             Fix For: 2.1.3
>
>         Attachments: InterceptorDestroy.diff, InterceptorDestroyAgainstTrunk.diff
>
>
> I was testing the Interceptor behavior, and put an breakpoint inside the methods init and destroy of Interceptor (TestInterceptor created). The init method was ok, the  breakpoint stopped on the server startup.
> To test the breakpoint of destroy method I does:
> - normal shutdown of tomcat (via Tomcat plugin in Eclipse)
> - redeploy the application
> - changed some classes to tomcat do the automatic reload
> But any of this cases the destroy method was called. I seach in the source code to find it and understand when it is called, but I don´t found.
> I use the 2.09 version, but is possible that it occurs in all versions of Struts2
> Attached the conversation about this in dev-list
> Tom Schneider wrote:
> You know, I think you're right!  I searched the entire codebase (both xwork and struts) and I have found nowhere where we call destroy() on the interceptors.  I guess that hasn't been an issue because if the destroy isn't being called, no big deal because your usually shutting down anyway.
> If we were to call destroy on the interceptors, I would expect it to happen in the cleanup() method of Dispatcher.  This is where all the rest of the cleanup happens.  At runtime, the list of interceptors is stored in the ActionConfig object.  (part of xwork)  Perhaps it might be a good idea to submit a patch that fixes this issue. :) (hint, hint) Tom
> Dale Newfield wrote:
> This might be why undeploying a struts webapp tends to fail (the struts core and plugin jars can't be removed because they're still in use).
> Ted Husted wrote:
> I haven't traced the code, but I believe we redeploy the Interceptors in dev mode, making a destroy option more important.

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