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/01/07 19:13:45 UTC

[Bug 55970] New: A reloadable context is reloaded repeatedly if WEB-INF/lib contains non-jar files

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

            Bug ID: 55970
           Summary: A reloadable context is reloaded repeatedly if
                    WEB-INF/lib contains non-jar files
           Product: Tomcat 8
           Version: 8.0.0-RC10
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: knst.kolinko@gmail.com

This is reproduction recipe for an issue reported on the users@ list.

See "rc-10 bug?" thread.
http://tomcat.markmail.org/thread/m6eecxjuygj6yjxq

Steps to reproduce with 8.0.0-RC10:
-------------------------------------
1. Mark the "examples" web application as reloadable, by adding the following
file: /META-INF/context.xml

<Context reloadable="true"/>

2. Add a stray non-jar file to the WEB-INF/lib directory.
E.g. /WEB-INF/lib/foo.txt

3. Start Tomcat.
4. Every 10 seconds the examples webapp is reloaded.
This is accompanied by the following log messages:

07-Jan-2014 22:01:58.672 INFO
[ContainerBackgroundProcessor[StandardEngine[Catalina]]]
org.apache.catalina.loader.WebappClassLoader.modified One of more JARs have
been added to the web application [/examples]
07-Jan-2014 22:01:58.673 INFO
[ContainerBackgroundProcessor[StandardEngine[Catalina]]]
org.apache.catalina.core.StandardContext.reload Reloading Context with name
[/examples] has started
07-Jan-2014 22:01:59.704 INFO
[ContainerBackgroundProcessor[StandardEngine[Catalina]]]
org.apache.catalina.core.StandardContext.reload Reloading Context with name
[/examples] is completed
-------------------------------------

Quoting from the e-mail:
[quote]
>From webappclassloader.java snippet below (line 737), jars[] does not only
contain jars, but also any other resources. i added a howTo.txt file in
WEB-INF/lib, which results in  jars.length will NEVER equal
jarModificationTimes.size().

Fix is simple - just filter out the non-jar, non-executable elements b4
comparing. Workaround is equally trivial - remove said elements from the the
lib folder.
Hope this helps,
Peter

        // Check if JARs have been added or removed
        WebResource[] jars = resources.listResources("/WEB-INF/lib");

        if (jars.length > jarModificationTimes.size()) {
            log.info(sm.getString("webappClassLoader.jarsAdded",
                    resources.getContext().getName()));
            return true;
        } else if (jars.length < jarModificationTimes.size()){
            log.info(sm.getString("webappClassLoader.jarsRemoved",
                    resources.getContext().getName()));
            return true;
        }

        for (WebResource jar : jars) {
            if (jar.getName().endsWith(".jar") && jar.isFile() &&
jar.canRead()) {
[/quote]

This affects only those web applications that were explicitly marked as
"reloadable" in their or in the default context.xml file.

In the default configuration the "reloadable" flag is false and thus the
"modified()" check in WebappLoader.backgroundProcess() is skipped.

-- 
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 55970] A reloadable context is reloaded repeatedly if WEB-INF/lib contains non-jar files

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

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

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

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Fixed in 8.0.x for 8.0.0 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