From ca6ee61493916c8909b85dea3265307fff9cf65b Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 28 Feb 2024 10:17:57 +0000 Subject: [PATCH] Print JVM thread dumps if the build is cancelled See gh-39761 --- .github/actions/print-jvm-thread-dumps/action.yml | 6 +++--- .github/workflows/windows-build.yml | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/actions/print-jvm-thread-dumps/action.yml b/.github/actions/print-jvm-thread-dumps/action.yml index ff7284fd1f1..e5ddf48457d 100644 --- a/.github/actions/print-jvm-thread-dumps/action.yml +++ b/.github/actions/print-jvm-thread-dumps/action.yml @@ -3,12 +3,12 @@ description: Prints a thread dump for all running JVMs runs: using: composite steps: - - run: | + - shell: bash + run: | for java_pid in $(jps -q -J-XX:+PerfDisableSharedMem); do echo "------------------------ pid $java_pid ------------------------" cat /proc/$java_pid/cmdline | xargs -0 echo jcmd $java_pid Thread.print -l jcmd $java_pid GC.heap_info done - exit 0 - shell: bash \ No newline at end of file + exit 0 \ No newline at end of file diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index c83725f18f3..cb9ff37bf94 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -44,6 +44,9 @@ jobs: GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }} GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }} run: ./gradlew build + - name: Print JVM thread dumps when cancelled + uses: ./.github/actions/print-jvm-thread-dumps + if: cancelled() - name: Send notification uses: ./.github/actions/send-notification if: always()