Bug 59813

Summary: Infinite loop behavior on circular relations of Class-Path entries in Manifest.MF file
Product: Tomcat 8 Reporter: chris.verlo
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 8.5.3   
Target Milestone: ----   
Hardware: All   
OS: All   
Attachments: Circular Relationship Test Example
Thread dump
Thread dump

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
Hi,

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.

Regards,
Violeta