Skip to content

Using component scanning in signed jars is very slow [SPR-4694] #9371

Closed
@spring-projects-issues

Description

@spring-projects-issues

Todd Huss opened SPR-4694 and commented

Since upgrading from Spring 2.0.8 to Spring 2.5.3 our application that runs in signed jars (as required by webstart) starts VERY slowly. It runs fine in a signed jar with Spring 2.0.8 but since the upgrade now takes 5 or more minutes to start as opposed to 10-15 seconds under Spring 2.0.8.

What's interesting is that it's equally fast with Spring 2.5.3 as long as the jar is unsigned. However, as soon as you sign the jar and then run the application (via java -cp ourfile.jar mainclass) it takes forever to start. Downgrading back to Spring 2.0.8 also solves the issue. Getting stack dumps show that it seems like as of Spring 2.5.x (we tried 2.5.1-2.5.3) during startup on a signed jar is now spending a tremendous amount of time doing jar verification triggered from org.springframework.core.io.UrlResource. Here are a couple sample stack dumps of what the application is doing during the now very long startup period:

....
at java.util.jar.JarFile.getManifestFromReference(JarFile.java:159)
at java.util.jar.JarFile.getManifest(JarFile.java:146)
at sun.net.www.protocol.jar.URLJarFile.isSuperMan(URLJarFile.java:155)
- locked <0x8c031f88> (a sun.net.www.protocol.jar.URLJarFile)
at sun.net.www.protocol.jar.URLJarFile.getManifest(URLJarFile.java:121)
at java.util.jar.JarFile.maybeInstantiateVerifier(JarFile.java:287)
at java.util.jar.JarFile.getInputStream(JarFile.java:381)
- locked <0x8c031f88> (a sun.net.www.protocol.jar.URLJarFile)
at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:144)
at org.springframework.core.io.UrlResource.getInputStream(UrlResource.java:123)
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:74)

or here

....
at java.util.jar.JarVerifier.processEntry(JarVerifier.java:250)
- locked <0x8d9c05a0> (a [B)
at java.util.jar.JarVerifier.update(JarVerifier.java:188)
at java.util.jar.JarFile.initializeVerifier(JarFile.java:321)
at java.util.jar.JarFile.getInputStream(JarFile.java:386)
- locked <0x8dc380e8> (a sun.net.www.protocol.jar.URLJarFile)
at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:144)
at org.springframework.core.io.UrlResource.getInputStream(UrlResource.java:123)

Affects: 2.5.1, 2.5.2, 2.5.3

Issue Links:

13 votes, 10 watchers

Metadata

Metadata

Assignees

Labels

has: votes-jiraIssues migrated from JIRA with more than 10 votes at the time of importin: coreIssues in core modules (aop, beans, core, context, expression)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions