Skip to content

Possible JDK16 issue in 3.0.0: ThreadLocal not initialised? #515

@StrangeNoises

Description

@StrangeNoises

So I just upgraded our project to JDK 16 and tried to actually run it. It failed with this:

Caused by: java.lang.NullPointerException: Cannot load from int array because the return value of "java.lang.ThreadLocal.get()" is null
	at com.github.benmanes.caffeine.cache.StripedBuffer$ThreadLocalProbe.get(StripedBuffer.java:346)
	at com.github.benmanes.caffeine.cache.StripedBuffer.expandOrRetry(StripedBuffer.java:204)
	at com.github.benmanes.caffeine.cache.StripedBuffer.offer(StripedBuffer.java:145)
	at com.github.benmanes.caffeine.cache.BoundedLocalCache.afterRead(BoundedLocalCache.java:1208)
	at com.github.benmanes.caffeine.cache.BoundedLocalCache.getIfPresent(BoundedLocalCache.java:1999)
	at com.github.benmanes.caffeine.cache.LocalManualCache.getIfPresent(LocalManualCache.java:56)

(The rest of the stack trace is in our code)

It looks like it's trying to read values from that ThreadLocal in StripedBuffer.ThreadLocalProbe before it's initialised.

I've been running 3.0.0 in JDK 15 for a while just fine, with jdk.unsupported absent, so this looks like it may be a JDK 16 thing. Don't know if relevant but they did do some deprecating stuff in ThreadGroup. OTOH only deprecating (for removal later), not actually removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions