From 35c77f9bab1f9c8b48f82e7e6656372173ebd801 Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Fri, 6 Dec 2024 17:47:27 +0000 Subject: [PATCH] Capture memory leak failures during tests Tests will automatically save memory dumps when out of memory issues occur in java test cases. Updated CI to also pick these up for troubleshooting as needed. Signed-off-by: Peter Nied --- .github/workflows/CI.yml | 18 ++++++++++++++++++ build.gradle | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4c6e1c36e..849a1fddf 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -121,6 +121,24 @@ jobs: env: OS_MIGRATIONS_GRADLE_SCAN_TOS_AGREE_AND_ENABLED: '' + - name: Detect Memory Dumps + if: failure() + run: | + if find . -type f -name "*.hprof" | grep -q '.'; then + echo "::group::Memory Dumps Detected" + echo "::warning::Memory dumps were found and uploaded as artifacts. Review these files to diagnose OOM issues." + echo "To download and inspect these files, navigate to 'Actions' -> 'Artifacts'." + echo "::endgroup::" + fi + + - name: Upload memory dump + if: failure() + uses: actions/upload-artifact@v4 + with: + if-no-files-found: ignore + name: memory-dumps + path: ./**/*.hprof + - uses: actions/upload-artifact@v4 if: always() with: diff --git a/build.gradle b/build.gradle index 232d8ba32..f03862c97 100644 --- a/build.gradle +++ b/build.gradle @@ -127,7 +127,7 @@ subprojects { systemProperty 'junit.jupiter.execution.parallel.enabled', 'false' systemProperty 'log4j2.contextSelector', 'org.apache.logging.log4j.core.selector.BasicContextSelector' // Verify assertions in tests - jvmArgs '-ea' + jvmArgs = ['-ea', '-XX:+HeapDumpOnOutOfMemoryError'] jacoco.enabled = true }