You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2014/04/11 15:04:03 UTC

[Bug 56390] New: Tomcat keeps jar files in /WEB-INF/lib opened and app cannot be fully undeployed

https://issues.apache.org/bugzilla/show_bug.cgi?id=56390

            Bug ID: 56390
           Summary: Tomcat keeps jar files in <app>/WEB-INF/lib opened and
                    app cannot be fully undeployed
           Product: Tomcat 8
           Version: trunk
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: violetagg@apache.org

Created attachment 31513
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31513&action=edit
Profiling analyses

Hi,

If there are jar files in <app>/WEB-INF/lib, Tomcat keeps them opened and
during undeploy they cannot be cleared. The following error appears:

"SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]]
org.apache.catalina.startup.ExpandWar.delete [...] could not be completely
deleted. The presence of the remaining files may cause problems" 

The problem is because during startup of the application, a call to
o.a.catalina.loader.WebappClassLoader.findResource is made, which opens the
files. See the profiling analyses that are attached. (openedfiles.jpg)

A possible solution would be to invoke java.net.URLClassLoader.close() in
org.apache.catalina.loader.WebappClassLoader.stop method:

Index: C:/tc8.0.x/java/org/apache/catalina/loader/WebappClassLoader.java
===================================================================
--- C:/tc8.0.x/java/org/apache/catalina/loader/WebappClassLoader.java   
(revision 1585681)
+++ C:/tc8.0.x/java/org/apache/catalina/loader/WebappClassLoader.java   
(working copy)
@@ -1497,6 +1497,12 @@

         permissionList.clear();
         loaderPC.clear();
+
+        try {
+            super.close();
+        } catch (IOException e) {
+            throw new LifecycleException(e);
+        }
     }

What do you think?

Regards
Violeta

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56390] Tomcat keeps jar files in /WEB-INF/lib opened and app cannot be fully undeployed

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56390

--- Comment #4 from Violeta Georgieva <vi...@apache.org> ---
(In reply to Mark Thomas from comment #1)
> Steps to reproduce?

- ant clean deploy
- go to output/build and start Tomcat
- deploy the attached application
- undeploy the application

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56390] Tomcat keeps jar files in /WEB-INF/lib opened and app cannot be fully undeployed

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56390

--- Comment #6 from Violeta Georgieva <vi...@apache.org> ---
(In reply to Konstantin Kolinko from comment #3)
> 2. Are you running without a JreMemoryLeakPreventionListener ?

It is there I did a regular "ant clean deploy" without any additional changes

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56390] Tomcat keeps jar files in /WEB-INF/lib opened and app cannot be fully undeployed

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56390

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Steps to reproduce?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56390] Tomcat keeps jar files in /WEB-INF/lib opened and app cannot be fully undeployed

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56390

--- Comment #10 from Dennis Lundberg <de...@apache.org> ---
We are seeing this issue as well in Tomcat 6.0.35 on Windows 7.
Is there any chance of a back-port to Tomcat 6 or 7 for this fix?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56390] Tomcat keeps jar files in /WEB-INF/lib opened and app cannot be fully undeployed

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56390

--- Comment #3 from Konstantin Kolinko <kn...@gmail.com> ---
> A possible solution would be to invoke java.net.URLClassLoader.close() in
> org.apache.catalina.loader.WebappClassLoader.stop method:

1. What will be an effect of calling stop(),start() (I have not checked if
anything calls those methods in a pair).

If URLClassLoader cannot recover after a call to close() then it should be done
in destroy() instead of stop().

2. Are you running without a JreMemoryLeakPreventionListener ?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56390] Tomcat keeps jar files in /WEB-INF/lib opened and app cannot be fully undeployed

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56390

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #9 from Mark Thomas <ma...@apache.org> ---
Fix in 8.0.x for 8.0.6 onwards.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56390] Tomcat keeps jar files in /WEB-INF/lib opened and app cannot be fully undeployed

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56390

--- Comment #5 from Violeta Georgieva <vi...@apache.org> ---
Created attachment 31515
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31515&action=edit
example

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56390] Tomcat keeps jar files in /WEB-INF/lib opened and app cannot be fully undeployed

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56390

--- Comment #7 from Mark Thomas <ma...@apache.org> ---
Looking at this with YourKit the proposed patch (modified as suggested by
Konstantin) addresses 2 out of the 4 open file issues I am seeing with lsof.

I want to see if I can find the source of the remaining 2 files before I commit
a fix.

Note that triggering GC does clean up all the remaining open files.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56390] Tomcat keeps jar files in /WEB-INF/lib opened and app cannot be fully undeployed

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56390

--- Comment #8 from Mark Thomas <ma...@apache.org> ---
I've committed a partial fix for this. I made some progress with tracking down
the cause of the other files locks but still have some work to do there.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56390] Tomcat keeps jar files in /WEB-INF/lib opened and app cannot be fully undeployed

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56390

--- Comment #2 from Sebb <se...@apache.org> ---
May not be directly relevant, but I've noticed that Java on Windows keeps an OS
lock on files that it has got open - even when read-only. So one cannot delete
jars that are in use (and it makes tailing log files tricky in Windows!)
Unix Java does not seem to have this restriction.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org