Print JVM thread dumps if the build is cancelled

See gh-39761
This commit is contained in:
Andy Wilkinson 2024-02-28 10:17:57 +00:00
parent 868629d9c7
commit ca6ee61493
2 changed files with 6 additions and 3 deletions

View File

@ -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
exit 0

View File

@ -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()