You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Paul Benedict <pb...@apache.org> on 2008/08/23 06:10:54 UTC

S2: Unable to undeploy app in Tomcat

I am unable to have Tomcat delete the physical directory of my webapp
when I undeploy from Tomcat Manager. My application gets undeployed,
but there is a lock is on the struts2-core library. Anyone encounter
this problem? I am using 2.0.11.2 and Tomcat 6.0.16.

Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: S2: Unable to undeploy app in Tomcat

Posted by Paul Benedict <pb...@apache.org>.
Jeromy,

Any good chance 2.0.12 would contain the fix? Is the fix totally not
able to be backported?

Paul

On Sat, Aug 23, 2008 at 12:05 AM, Jeromy Evans
<je...@blueskyminds.com.au> wrote:
> Paul Benedict wrote:
>>
>> I am unable to have Tomcat delete the physical directory of my webapp
>> when I undeploy from Tomcat Manager. My application gets undeployed,
>> but there is a lock is on the struts2-core library. Anyone encounter
>> this problem? I am using 2.0.11.2 and Tomcat 6.0.16.
>>
>> Paul
>>
>
> Yes.  I don't think there's a work-around in 2.0.  I think there's an issue
> in JIRA and recall it relates to the threadlocal ActionContext not being
> released.
>
> A work-around was applied to the FilterDispatcher in 2.1 that would force it
> to release the ActionContext.
>
> Sounds like you're using windows.  On that platform I always perform an
> undeploy, stop, then a reliable delete, then start, then deploy.  Linux
> platforms don't experience the same file locking issue.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: S2: Unable to undeploy app in Tomcat

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Paul Benedict wrote:
> I can't see how this could be a Tomcat or Windows problem. With Struts
> 2.1.2 and setting antiJARLocking="true", I was able to undeploy.
> However, the necessity of the option tells me Struts (or XWork) is
> leaky somewhere and is not properly cleaning up its house. When
> running under Windows, files are only locked when they are open, and
> if Tomcat can't GC due to uncollectable references, then it's proof
> there's a leak.
>
> I don't think this problem should be ignored.
>   

I agree, but it hasn't deserved the same priority as the numerous other 
S2 + Xwork problems because there's a reasonable work-around.  If you 
can isolate it that would be great!

For me, the inability to release PermGen space (consumed by cglib 
others) overrules the need to re-deploy quickly because that kills 
Tomcat on any platform faster than an open file or unallocated resource 
consumed by S2.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: S2: Unable to undeploy app in Tomcat

Posted by Paul Benedict <pb...@apache.org>.
I can't see how this could be a Tomcat or Windows problem. With Struts
2.1.2 and setting antiJARLocking="true", I was able to undeploy.
However, the necessity of the option tells me Struts (or XWork) is
leaky somewhere and is not properly cleaning up its house. When
running under Windows, files are only locked when they are open, and
if Tomcat can't GC due to uncollectable references, then it's proof
there's a leak.

I don't think this problem should be ignored.

Paul

On Sun, Aug 24, 2008 at 6:59 PM, Jeromy Evans
<je...@blueskyminds.com.au> wrote:
> Hi Paul,
>
> I'm not 100% sure as I've never investigated this in detail myself.  Now
> that you've mentioned it though, I recall another issue with Struts 2
> leaving files open.  It related to the FreeMarker template caching and
> someone had setup a task to monitor open file counts at run-time.
>
> That would also cause the problem you're seeing and there's probably an
> issue in JIRA about that one too.
>
> I rarely attempt to undeploy myself as the application servers run out of
> PermGen space eventually anyway requiring a restart.  I prefer a reliable
> slow restart rather than a fast redeployment with an occasional failure.
> Paul Benedict wrote:
>>
>> Jeromy,
>>
>> I wrapped a try/finally in the init and destroy method as you and the
>> ticket described, but there was still a memory leak that locked down
>> the Struts 2 core library. Are you sure these are the only things to
>> be done?
>>
>> @Override
>> public void init(FilterConfig filterConfig) throws ServletException {
>>    try {
>>        super.init(filterConfig);
>>    } finally {
>>        ActionContext.setContext(null);
>>    }
>> }
>>
>> @Override
>> public void destroy() {
>>    try {
>>        super.destroy();
>>    } finally {
>>        ActionContext.setContext(null);
>>    }
>> }
>>
>> Paul
>>
>> On Sat, Aug 23, 2008 at 12:20 AM, Jeromy Evans
>> <je...@blueskyminds.com.au> wrote:
>>
>>>
>>> Paul Benedict wrote:
>>>
>>>>
>>>> https://issues.apache.org/struts/browse/WW-2167
>>>>
>>>>
>>>
>>> Yes, it's easy to retrofit to 2.0.  It only requires a finally statement
>>> in
>>> the init and destroy methods.
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


[OT] Re: S2: Unable to undeploy app in Tomcat

Posted by Dave Newton <ne...@yahoo.com>.
> I prefer a reliable slow restart rather than 
> a fast redeployment with an occasional failure. 

That's what she said.

(Had to; long, irritating weekend.)

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: S2: Unable to undeploy app in Tomcat

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Hi Paul,

I'm not 100% sure as I've never investigated this in detail myself.  Now 
that you've mentioned it though, I recall another issue with Struts 2 
leaving files open.  It related to the FreeMarker template caching and 
someone had setup a task to monitor open file counts at run-time.

That would also cause the problem you're seeing and there's probably an 
issue in JIRA about that one too.

I rarely attempt to undeploy myself as the application servers run out 
of PermGen space eventually anyway requiring a restart.  I prefer a 
reliable slow restart rather than a fast redeployment with an occasional 
failure. 

Paul Benedict wrote:
> Jeromy,
>
> I wrapped a try/finally in the init and destroy method as you and the
> ticket described, but there was still a memory leak that locked down
> the Struts 2 core library. Are you sure these are the only things to
> be done?
>
> @Override
> public void init(FilterConfig filterConfig) throws ServletException {
>     try {
>         super.init(filterConfig);
>     } finally {
>         ActionContext.setContext(null);
>     }
> }
>
> @Override
> public void destroy() {
>     try {
>         super.destroy();
>     } finally {
>         ActionContext.setContext(null);
>     }
> }
>
> Paul
>
> On Sat, Aug 23, 2008 at 12:20 AM, Jeromy Evans
> <je...@blueskyminds.com.au> wrote:
>   
>> Paul Benedict wrote:
>>     
>>> https://issues.apache.org/struts/browse/WW-2167
>>>
>>>       
>> Yes, it's easy to retrofit to 2.0.  It only requires a finally statement in
>> the init and destroy methods.
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: S2: Unable to undeploy app in Tomcat

Posted by Paul Benedict <pb...@apache.org>.
Jeromy,

I wrapped a try/finally in the init and destroy method as you and the
ticket described, but there was still a memory leak that locked down
the Struts 2 core library. Are you sure these are the only things to
be done?

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    try {
        super.init(filterConfig);
    } finally {
        ActionContext.setContext(null);
    }
}

@Override
public void destroy() {
    try {
        super.destroy();
    } finally {
        ActionContext.setContext(null);
    }
}

Paul

On Sat, Aug 23, 2008 at 12:20 AM, Jeromy Evans
<je...@blueskyminds.com.au> wrote:
> Paul Benedict wrote:
>>
>> https://issues.apache.org/struts/browse/WW-2167
>>
>
> Yes, it's easy to retrofit to 2.0.  It only requires a finally statement in
> the init and destroy methods.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: S2: Unable to undeploy app in Tomcat

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Paul Benedict wrote:
> https://issues.apache.org/struts/browse/WW-2167
>   

Yes, it's easy to retrofit to 2.0.  It only requires a finally statement 
in the init and destroy methods.


PS. stop developing java on windows...  ;-) My estimate is that Sun's 
java compiler is at least 50% faster (perhaps more) under Linux.  I 
don't know the reason, but that alone makes for a significant 
productivity difference when working with struts.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: S2: Unable to undeploy app in Tomcat

Posted by Paul Benedict <pb...@apache.org>.
https://issues.apache.org/struts/browse/WW-2167

On Sat, Aug 23, 2008 at 12:05 AM, Jeromy Evans
<je...@blueskyminds.com.au> wrote:
> Paul Benedict wrote:
>>
>> I am unable to have Tomcat delete the physical directory of my webapp
>> when I undeploy from Tomcat Manager. My application gets undeployed,
>> but there is a lock is on the struts2-core library. Anyone encounter
>> this problem? I am using 2.0.11.2 and Tomcat 6.0.16.
>>
>> Paul
>>
>
> Yes.  I don't think there's a work-around in 2.0.  I think there's an issue
> in JIRA and recall it relates to the threadlocal ActionContext not being
> released.
>
> A work-around was applied to the FilterDispatcher in 2.1 that would force it
> to release the ActionContext.
>
> Sounds like you're using windows.  On that platform I always perform an
> undeploy, stop, then a reliable delete, then start, then deploy.  Linux
> platforms don't experience the same file locking issue.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: S2: Unable to undeploy app in Tomcat

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Paul Benedict wrote:
> I am unable to have Tomcat delete the physical directory of my webapp
> when I undeploy from Tomcat Manager. My application gets undeployed,
> but there is a lock is on the struts2-core library. Anyone encounter
> this problem? I am using 2.0.11.2 and Tomcat 6.0.16.
>
> Paul
>   

Yes.  I don't think there's a work-around in 2.0.  I think there's an 
issue in JIRA and recall it relates to the threadlocal ActionContext not 
being released.

A work-around was applied to the FilterDispatcher in 2.1 that would 
force it to release the ActionContext.

Sounds like you're using windows.  On that platform I always perform an 
undeploy, stop, then a reliable delete, then start, then deploy.  Linux 
platforms don't experience the same file locking issue.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: S2: Unable to undeploy app in Tomcat

Posted by Wendy Smoak <ws...@gmail.com>.
On Fri, Aug 22, 2008 at 9:10 PM, Paul Benedict <pb...@apache.org> wrote:
> I am unable to have Tomcat delete the physical directory of my webapp
> when I undeploy from Tomcat Manager. My application gets undeployed,
> but there is a lock is on the struts2-core library. Anyone encounter
> this problem? I am using 2.0.11.2 and Tomcat 6.0.16.

Windows I assume?  Look for some Tomcat options like 'antiJARLocking'
and 'antiResourceLocking' to set in (I think) context.xml.

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org