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 2010/04/30 11:49:35 UTC

DO NOT REPLY [Bug 49236] New: JAR indexing does not have any benefits and can cause some harm

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

           Summary: JAR indexing does not have any benefits and can cause
                    some harm
           Product: Tomcat 7
           Version: trunk
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Packaging
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: knst.kolinko@gmail.com


In TC 7, 6, 5.5 build scripts in several places we use <jar index="true"/>,
which creates META-INF/INDEX.LIST file in the JAR.

I should say that
a) The JAR Index feature is designed to speed up location and download of other
*.jar files. It is not intended to be used on a single file.

See specification [1], blog article that describes main problems [2], ANT
documentation on JAR task and especially the nested "indexjars" element as
described there [3].

One should use <indexjars> element inside the <jar> task to exploit this
feature properly.


b) It does not speed up processing of a single JAR.

First, a JAR file already has an index, "Central Directory" - see picture in
Wikipedia article [4], or official specification from PKWARE [5].

AFAIK, in Sun JRE this central directory is always read and loaded into memory
before any random-access query on the file is performed, such as
ZipFile#getEntry(String).

Second, an URLClassLoader has to consider JARs mentioned in the Index file. It
incurs some overhead, though I have not measured how much it is.


c) Using Index file can conflict with "Class-Path" entry of the manifest. See
[2] for explanation.

Also the text of the index file starts with the name of the current JAR file. I
suppose that it can have some consequences if the file is renamed.


Based on the above, we have to use index="false" on all our <jar> tasks.


Links:
[1] JAR Index specification - JDK 1.5
http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#JAR%20Index

[2] To Use or not to Use Jar Index - A blog article
http://javahowto.blogspot.com/2006/08/to-use-or-not-to-use-jar-index.html

[3] Jar Task - Apache ANT Documentation
http://ant.apache.org/manual/CoreTasks/jar.html

[4] ZIP (file format) - Wikipedia
http://en.wikipedia.org/wiki/ZIP_%28file_format%29#Technical_information

[5] ZIP APPNOTE - PKWARE
http://www.pkware.com/support/zip-application-note

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 49236] JAR indexing does not have any benefits and can cause some harm

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

Konstantin Kolinko <kn...@gmail.com> changed:

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

--- Comment #4 from Konstantin Kolinko <kn...@gmail.com> 2010-05-14 02:41:14 EDT ---
Fixed in 6.0, 5.5, will be in 6.0.27, 5.5.30.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 49236] JAR indexing does not have any benefits and can cause some harm

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

Konstantin Kolinko <kn...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Packaging                   |Unknown
            Version|trunk                       |5.5.28
            Product|Tomcat 7                    |Tomcat 5

--- Comment #3 from Konstantin Kolinko <kn...@gmail.com> 2010-04-30 06:29:32 EDT ---
Fixed in trunk, proposed for 6.0 and 5.5

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 49236] JAR indexing does not have any benefits and can cause some harm

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

--- Comment #2 from Konstantin Kolinko <kn...@gmail.com> 2010-04-30 06:13:32 EDT ---
Created an attachment (id=25382)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25382)
2010-04-30_tc55_bug49236.patch

Patch for TC 5.5.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 49236] JAR indexing does not have any benefits and can cause some harm

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

--- Comment #1 from Konstantin Kolinko <kn...@gmail.com> 2010-04-30 06:03:35 EDT ---
Created an attachment (id=25381)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25381)
2010-04-30_tc6_bug49236.patch

Fixed in trunk in r939612.  I am attaching patch for TC6.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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