JDK-8314263 : Signed jars triggering Logger finder recursion and StackOverflowError
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.logging
  • Affected Version: 11.0.20-oracle,22
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2023-08-15
  • Updated: 2024-03-22
  • Resolved: 2023-08-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 17 JDK 21 JDK 22
11.0.22-oracleFixed 17.0.10-oracleFixed 21.0.2Fixed 22 b14Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
Dividends paying off from porting JDK-8048190 to 11u. We have root cause of NoClassDefFoundError.

Logger call logic changed in JDK-8292033

java.lang.NoClassDefFoundError: Could not initialize class jdk.internal.logger.SimpleConsoleLogger$CallerFinder
	at java.base/jdk.internal.logger.SimpleConsoleLogger.getCallerInfo(SimpleConsoleLogger.java:194)
	at java.base/jdk.internal.logger.SimpleConsoleLogger.log(SimpleConsoleLogger.java:122)
	at java.base/java.lang.System$Logger.log(System.java:1241)
	at java.base/jdk.internal.logger.LoggerFinderLoader.loadLoggerFinder(LoggerFinderLoader.java:155)
	at java.base/jdk.internal.logger.LoggerFinderLoader.service(LoggerFinderLoader.java:73)
	at java.base/jdk.internal.logger.LoggerFinderLoader.getLoggerFinder(LoggerFinderLoader.java:206)
	at java.base/java.lang.System$LoggerFinder.lambda$accessProvider$0(System.java:1622)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:430)
	at java.base/java.lang.System$LoggerFinder.accessProvider(System.java:1623)
	at java.base/java.lang.System$LoggerFinder.getLoggerFinder(System.java:1611)
	at java.base/jdk.internal.logger.LazyLoggers.accessLoggerFinder(LazyLoggers.java:339)
	at java.base/jdk.internal.logger.LazyLoggers.getLoggerFromFinder(LazyLoggers.java:389)
	at java.base/jdk.internal.logger.LazyLoggers.getLazyLogger(LazyLoggers.java:444)
	at java.base/jdk.internal.logger.LazyLoggers.getLogger(LazyLoggers.java:414)
	at java.base/java.lang.System.getLogger(System.java:1673)
	at java.base/jdk.internal.event.EventHelper.isLoggingSecurity(EventHelper.java:145)
	at java.base/sun.security.jca.JCAUtil.tryCommitCertEvent(JCAUtil.java:104)
	
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.StackOverflowError [in thread "main"]
	at java.base/java.lang.StackWalker.<clinit>(StackWalker.java:291)
	at java.base/jdk.internal.logger.SimpleConsoleLogger$CallerFinder$1.run(SimpleConsoleLogger.java:211)
	at java.base/jdk.internal.logger.SimpleConsoleLogger$CallerFinder$1.run(SimpleConsoleLogger.java:208)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/jdk.internal.logger.SimpleConsoleLogger$CallerFinder.<clinit>(SimpleConsoleLogger.java:214)
	at java.base/jdk.internal.logger.SimpleConsoleLogger.getCallerInfo(SimpleConsoleLogger.java:194)
	at java.base/jdk.internal.logger.SimpleConsoleLogger.log(SimpleConsoleLogger.java:122)
	at java.base/java.lang.System$Logger.log(System.java:1241)
	at java.base/jdk.internal.logger.LoggerFinderLoader.loadLoggerFinder(LoggerFinderLoader.java:155)
	at java.base/jdk.internal.logger.LoggerFinderLoader.service(LoggerFinderLoader.java:73)
	at java.base/jdk.internal.logger.LoggerFinderLoader.getLoggerFinder(LoggerFinderLoader.java:206)
	at java.base/java.lang.System$LoggerFinder.lambda$accessProvider$0(System.java:1622)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:430)
	at java.base/java.lang.System$LoggerFinder.accessProvider(System.java:1623)
	at java.base/java.lang.System$LoggerFinder.getLoggerFinder(System.java:1611)
	at java.base/jdk.internal.logger.LazyLoggers.accessLoggerFinder(LazyLoggers.java:339)
	at java.base/jdk.internal.logger.LazyLoggers.getLoggerFromFinder(LazyLoggers.java:389)
	at java.base/jdk.internal.logger.LazyLoggers.getLazyLogger(LazyLoggers.java:444)
	at java.base/jdk.internal.logger.LazyLoggers.getLogger(LazyLoggers.java:414)
	at java.base/java.lang.System.getLogger(System.java:1673)
	at java.base/jdk.internal.event.EventHelper.isLoggingSecurity(EventHelper.java:145)
	at java.base/sun.security.jca.JCAUtil.tryCommitCertEvent(JCAUtil.java:104)
	at java.base/java.security.cert.CertificateFactory.generateCertificate(CertificateFactory.java:356)
Comments
Fix request [11u] I backport this for parity with 11.0.22-oracle. I include follow-up test fixes JDK-8315696 and JDK-8316087. Medium risk. Some small changes due to some unsupported attributes such as Record. Tests pass. SAP niglty testing passed.
30-10-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk11u-dev/pull/2223 Date: 2023-10-27 06:51:06 +0000
27-10-2023

Fix request [17u] I backport this for parity with 17.0.10-oracle. I include follow-up test fixes JDK-8315696 and JDK-8316087. Medium risk. Trivial resolves needed. Tests pass. SAP niglty testing passed.
21-09-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk17u-dev/pull/1756 Date: 2023-09-20 11:01:26 +0000
20-09-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u/pull/153 Date: 2023-09-11 18:50:35 +0000
11-09-2023

Fix Request for jdk21u A Logger initialization issue exposed by JDK-8292033. Can lead to JDK initialization issues for some applications which have signed jars on the application classpath.
04-09-2023

Changeset: 7daae1fb Author: Sean Coffey <coffeys@openjdk.org> Date: 2023-08-30 12:54:57 +0000 URL: https://git.openjdk.org/jdk/commit/7daae1fb4267f92b38f0152611d69b7b89691087
30-08-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/15404 Date: 2023-08-23 15:41:16 +0000
23-08-2023

Current fix involves modifying the jdk.internal.logger.LoggerFinderLoader.loadLoggerFinder() logic to detect recursive calls during bootstrap phase of Logger framework initialization . Working on automated testcase and hope to log a PR today.
18-08-2023

managed to trigger the StackOverflowError in a local reproducer. A signed jar file on the application classpath offering the "java.lang.System$LoggerFinder" service is necessary.
15-08-2023

I've obtained a fuller stack trace which tells the full story. Will attach to bug report. Signed jars appear to be on the classpath. Those jars need to be inspected during the ServiceLoader logic used by jdk.internal.logger.LoggerFinderLoader to find the Logger. The opening of a signed jar triggers a call to sun.security.jca.JCAUtil.tryCommitCertEvent which then triggers a call to java.lang.System.getLogger and recursion ensues. I haven't triggered the issue in a local reproducer yet.
15-08-2023