Bug 59813 - Infinite loop behavior on circular relations of Class-Path entries in Manifest.MF file
Summary: Infinite loop behavior on circular relations of Class-Path entries in Manifes...
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 8.5.3
Hardware: All All
: P2 normal (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2016-07-06 18:47 UTC by chris.verlo
Modified: 2016-07-11 21:17 UTC (History)
0 users

Circular Relationship Test Example (2.16 KB, application/x-zip-compressed)
2016-07-06 18:47 UTC, chris.verlo
Thread dump (19.13 KB, text/plain)
2016-07-06 23:51 UTC, HyunWoo Jo
Thread dump (14.58 KB, text/plain)
2016-07-07 12:10 UTC, chris.verlo

Note You need to log in before you can comment on or make changes to this bug.
Description chris.verlo 2016-07-06 18:47:03 UTC
Created attachment 34018 [details]
Circular Relationship Test Example

We're experiencing a situation with tomcat 8.5.3 where if two jars each possess a Class-Path entry to the other jar in their MANIFEST.MF file, the server hangs at startup.  

We can reproduce this problem on both Ubuntu and Windows.  

I've created two jars for testing purposes which contain manifests pointing to each other.  It is only necessary to drop these jars into the server lib folder and attempt to start the server to cause the problem to occur.  

We encountered this issue because the IBM MQ libraries have a similar circular relationship in their manifest.mf class-path entries.
Comment 1 Christopher Schultz 2016-07-06 21:27:19 UTC
(I'm surprised Tomcat even consults Class-Path entries... does it?)

Can you post a thread dump of such a hung Tomcat?
Comment 2 HyunWoo Jo 2016-07-06 23:51:40 UTC
Created attachment 34019 [details]
Thread dump

I could reproduce the problem using the circular jar files.
Comment 3 chris.verlo 2016-07-07 12:10:19 UTC
Created attachment 34020 [details]
Thread dump

I've attached a thread dump that tipped us off to the problem.  This was NOT generated using my test case, this was generated using the IBM MQ libraries which caused a heap dump as well and emitted this thread dump at the same time.

Like the thread dump generated by HyunWoo Jo, org.apache.tomcat.util.scan.StandardJarScanner.process makes an appearance.
Comment 4 Violeta Georgieva 2016-07-11 21:17:26 UTC

Thanks for the report.
This has been fixed in
- 9.0.x for 9.0.0.M10 onwards,
- 8.5.x for 8.5.5 onwards and
- 8.0.x for 8.0.37 onwards.