RFR: 8314263: Signed jars triggering Logger finder recursion and StackOverflowError

Daniel Fuchs dfuchs at openjdk.org
Wed Aug 23 17:41:31 UTC 2023


On Wed, 23 Aug 2023 17:15:03 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> Recursive initialization calls possible during loading of LoggerFinder service.  
>> 
>> This fix detects the recursive call and returns a temporary LoggerFinder that is backed by a lazy logger. Automated test case developed to simulate loading of an external LoggerFinder service while also having other threads poke System.getLogger during this framework initialization.
>
> src/java.base/share/classes/jdk/internal/logger/LoggerFinderLoader.java line 83:
> 
>> 81:             Thread currentThread = Thread.currentThread();
>> 82:             if (loadingThread == currentThread) {
>> 83:                 return new TemporaryLoggerFinder();
> 
> Suggestion:
> 
>                 // recursive ttempt to load the backend while loading the backend
>                 // use a temporary logger finder that returns special BootsrtapLoggers
>                 // which will wait until loading is finished
>                 return new TemporaryLoggerFinder();

We could create a singleton instance of TemporaryLoggerFinder in the TemporaryLoggerFinder class and return that.
Suggestion:

                return new TemporaryLoggerFinder.INSTANCE;

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/15404#discussion_r1303321618


More information about the core-libs-dev mailing list