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

SapMachine #1901: Feature Request to allow service to crash if direct memory is OOM #1916

Merged
merged 8 commits into from
Feb 11, 2025

Conversation

ansteiner
Copy link
Member

If the direct memory buffer run into OOM, DirectByteBuffer allocation code can notify the jvm if the system property "jdk.nio.reportErrorOnDirectMemoryOom" is set.

Benefits:

  • In a containerized environment, using Crash/ExitOnOutOfMemoryError allows a app/JVM that can no longer provide services and application code is handling the OOM of DirectByteBuffer to crash/exit and enabling the service to restart.
  • To analyze direct memory OutOfMemoryErrors, heap dumps are necessary to examine reference relationships. This can be facilitated using the HeapDumpOnOutOfMemoryError option.

Implementation with some minor adaptions from closed issue/PR from OpenJDK: openjdk/jdk#16176

fixes #1901

@SapMachine
Copy link
Member

Hello @ansteiner, this pull request fulfills all formal requirements.

Copy link
Member

@RealCLanger RealCLanger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. I made a few suggestions. Also, the new test is failing because the VM seems to exit with a different rc.

@SapMachine
Copy link
Member

Hello @ansteiner, this pull request fulfills all formal requirements.

@SapMachine
Copy link
Member

Hello @ansteiner, this pull request fulfills all formal requirements.

@RealCLanger
Copy link
Member

OK, we need to figure out what happens in the test.

Copy link
Member

@schmelter-sap schmelter-sap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type of the entry is wrong.

@SapMachine
Copy link
Member

Hello @ansteiner, this pull request fulfills all formal requirements.

@MBaesken
Copy link
Member

Hi Andreas, have you figured out the strange exit/return codes seen in some tests ?

…t on macos-aarch64 due to different MaxHeapsize/MaxDirectMemorySize by ergonomics
@SapMachine
Copy link
Member

Hello @ansteiner, this pull request fulfills all formal requirements.

@ansteiner
Copy link
Member Author

Hi Andreas, have you figured out the strange exit/return codes seen in some tests ?

Yes, it was the wrong entry type(92a964d). Mentioned by Ralf.

Copy link
Member Author

@ansteiner ansteiner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modified already

Copy link
Member Author

@ansteiner ansteiner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modified already

Copy link
Member

@RealCLanger RealCLanger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me now. I have a few last minor formatting suggestions for the test.

@MBaesken
Copy link
Member

MBaesken commented Feb 11, 2025

One question / remark - the system property 'jdk.nio.reportErrorOnDirectMemoryOom' is SapMachine specific but sounds like a standard property available in all JDK. Is this good? Should we make it clearer in the name that it is specific ?

But I am okay with this name as well so just an idea/remark .

@SapMachine
Copy link
Member

Hello @ansteiner, this pull request fulfills all formal requirements.

@ansteiner ansteiner merged commit 1ce231f into SAP:sapmachine Feb 11, 2025
66 of 67 checks passed
@ansteiner ansteiner deleted the direct_memory_oom branch February 11, 2025 15:09
ansteiner added a commit to ansteiner/SapMachine that referenced this pull request Feb 12, 2025
…ect memory is OOM (SAP#1916)

SapMachine SAP#1901: Feature Request to allow service to crash if direct memory is OOM

(cherry picked from commit 1ce231f)
ansteiner added a commit to ansteiner/SapMachine that referenced this pull request Feb 12, 2025
…ect memory is OOM (SAP#1916)

SapMachine SAP#1901: Feature Request to allow service to crash if direct memory is OOM

(cherry picked from commit 1ce231f)
@ansteiner ansteiner self-assigned this Feb 12, 2025
RealCLanger pushed a commit that referenced this pull request Feb 13, 2025
… memory is OOM (#1916)

SapMachine #1901: Feature Request to allow service to crash if direct memory is OOM

(cherry picked from commit 1ce231f)
RealCLanger pushed a commit that referenced this pull request Feb 13, 2025
… memory is OOM (#1916)

SapMachine #1901: Feature Request to allow service to crash if direct memory is OOM

(cherry picked from commit 1ce231f)
RealCLanger pushed a commit that referenced this pull request Feb 13, 2025
… memory is OOM (#1916)

SapMachine #1901: Feature Request to allow service to crash if direct memory is OOM

(cherry picked from commit 1ce231f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request to allow service to crash if direct memory is OOM
5 participants