Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SoftReferences not cleared before OOME #1096

Open
1 task done
devinrsmith opened this issue May 23, 2024 · 8 comments
Open
1 task done

SoftReferences not cleared before OOME #1096

devinrsmith opened this issue May 23, 2024 · 8 comments
Labels
bug Something isn't working jbs:reported Someone from our org has reported it to OpenJDK keep This label can be applied to prevent the Stale bot from closing it after a period of inactivity

Comments

@devinrsmith
Copy link

Please provide a brief summary of the bug

The JVM throws an OutOfMemoryError without first cleaning reclaimable SoftReferences if it is concurrently doing computations that involve JNI critical regions (subject to multiple attempts wrt to -XX:GCLockerRetryAllocationCount). This seems to break one of the core tenants of SoftReference's JavaDoc:

All soft references to softly-reachable objects are guaranteed to have been cleared before the virtual machine throws an OutOfMemoryError

Did you test with the latest update version?

  • Yes

Please provide steps to reproduce where possible

https://github.com/devinrsmith/GCLockerTooOftenAllocating

I've tested across the latest 8, 11, 17, and 21 OpenJDKs. Most of the GC collectors I've tried exhibit this bug. It appears that ZGC and Shenandoah do not exhibit this bug.

Expected Results

The small reproducer program should complete successfully when SoftReferences are cleared.

seed=0, totalOutputSize=96107180
seed=1, totalOutputSize=96106767
seed=3, totalOutputSize=96107220
seed=2, totalOutputSize=96107158
Completed, count=15834

(specific values may differ).

Actual Results

[1.242s][warning][gc,alloc] main: Retried waiting for GCLocker too often allocating 524290 words
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
        at java.base/java.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:71)
        at java.base/java.nio.ByteBuffer.allocate(ByteBuffer.java:391)
        at io.deephaven.example.GCLockerTooOftenAllocating.main(GCLockerTooOftenAllocating.java:45)

What Java Version are you using?

openjdk 21.0.3 2024-04-16 LTS OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS) OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (build 21.0.3+9-LTS, mixed mode, sharing)

What is your operating system and platform?

Fedora 39 x86_64. Have also been able to reproduce an OS X aarch64.

How did you install Java?

Downloaded tar.gz for Adoptium LTS. Also able to reproduce using Azul builds installed via dnf/rpm.

Did it work before?

No response

Did you test with other Java versions?

No response

Relevant log output

No response

@karianna
Copy link
Contributor

@devinrsmith Are you able to post your message to https://mail.openjdk.org/mailman/listinfo/hotspot-gc-use - I'm not sure this is the correct interpretation so would like to get the experts to comment there.

@devinrsmith
Copy link
Author

Will do shortly, thanks.

@devinrsmith
Copy link
Author

https://mail.openjdk.org/pipermail/hotspot-gc-use/2024-May/002938.html for those interested

@devinrsmith
Copy link
Author

@karianna It doesn't seem like I've gotten on the radar of anybody from hotspot-gc-use; is there another mailing list that may be more receptive, or other actions I should take to try and elevate this?

@karianna
Copy link
Contributor

@devinrsmith Sorry for the long delay, hotspot-gc-dev is your next best bet!

@devinrsmith
Copy link
Author

No need to apologize; I appreciate your help. https://mail.openjdk.org/pipermail/hotspot-gc-dev/2024-June/048283.html for those interested.

@devinrsmith
Copy link
Author

It's been noted as a special case of https://bugs.openjdk.org/browse/JDK-8192647.

@karianna karianna added jbs:reported Someone from our org has reported it to OpenJDK and removed Waiting on OP labels Jun 14, 2024
Copy link

We are marking this issue as stale because it has not been updated for a while. This is just a way to keep the support issues queue manageable.
It will be closed soon unless the stale label is removed by a committer, or a new comment is made.

@github-actions github-actions bot added the stale label Sep 13, 2024
@karianna karianna added keep This label can be applied to prevent the Stale bot from closing it after a period of inactivity and removed stale labels Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working jbs:reported Someone from our org has reported it to OpenJDK keep This label can be applied to prevent the Stale bot from closing it after a period of inactivity
Projects
None yet
Development

No branches or pull requests

2 participants