apache / apache/logging-log4j2

ProviderUtil.lazyInit hangs indefinitely

Open
#2,655 14 comments 1 reaction 0 assignees View on GitHub
api bug osgi
Dominant language
Java
Stars
3.6k
Forks
1.7k
Avg merge
21h 30m
Merged PRs (30d)
27

Description

## Description

I am using an Eclipse plugin that uses Apache POI, which in turn uses Log4j. It runs fine in most configurations, but in some constellations I haven't been able to conclusively pin down (installed the same version twice, one works, the other reproducibly blocks), the UI hangs indefinitely. I took thread dumps in multiple occasions and the main thread always is parked inside ProviderUtil.lazyInit.
What could be the cause of this?

## Configuration

**Version:** 2.23.1

**Operating system:** Windows 10

**JDK:** different versions, including JustJ (17.0.10) and Temurin (21.0.3)

## Logs

```
"main" #1 [1584] prio=6 os_prio=0 cpu=14515.62ms elapsed=198.83s tid=0x000001f833061830 nid=1584 waiting on condition [0x0000002f0f6fb000]
java.lang.Thread.State: WAITING (parking)
at jdk.internal.misc.Unsafe.park(java.base@21.0.3/Native Method)
- parking to wait for <0x00000000813aff10> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
at java.util.concurrent.locks.LockSupport.park(java.base@21.0.3/LockSupport.java:221)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(java.base@21.0.3/AbstractQueuedSynchronizer.java:754)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireInterruptibly(java.base@21.0.3/AbstractQueuedSynchronizer.java:1010)
at java.util.concurrent.locks.ReentrantLock$Sync.lockInterruptibly(java.base@21.0.3/ReentrantLock.java:161)
at java.util.concurrent.locks.ReentrantLock.lockInterruptibly(java.base@21.0.3/ReentrantLock.java:372)
at org.apache.logging.log4j.util.ProviderUtil.lazyInit(ProviderUtil.java:151)
at org.apache.logging.log4j.util.ProviderUtil.hasProviders(ProviderUtil.java:138)
at org.apache.logging.log4j.LogManager.(LogManager.java:89)
at org.apache.poi.util.IOUtils.(IOUtils.java:43)
at org.apache.poi.poifs.filesystem.FileMagic.valueOf(FileMagic.java:209)
at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:222)
at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:185)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at ProviderUtil.java:151 and follow the lock acquisition through lazyInit, hasProviders, and LogManager. in the supplied thread dump. Reproduce the hang in the reported Eclipse plugin configuration using Apache POI's WorkbookFactory, then compare working and blocking installations. Done means the cause is isolated and a reproducible resolution or narrowly scoped fix is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
observability
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.