You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ma...@apache.org on 2023/06/14 13:32:04 UTC
[flink-connector-shared-utils] branch ci_utils updated: [FLINK-32331][Build System] Enable printing of thread dumps in the CI. This closes #15
This is an automated email from the ASF dual-hosted git repository.
martijnvisser pushed a commit to branch ci_utils
in repository https://gitbox.apache.org/repos/asf/flink-connector-shared-utils.git
The following commit(s) were added to refs/heads/ci_utils by this push:
new 445fc79 [FLINK-32331][Build System] Enable printing of thread dumps in the CI. This closes #15
445fc79 is described below
commit 445fc790fb1641dc3d589300fca1133fb176127f
Author: MartijnVisser <ma...@apache.org>
AuthorDate: Wed Jun 14 15:31:58 2023 +0200
[FLINK-32331][Build System] Enable printing of thread dumps in the CI. This closes #15
* [FLINK-32331][Build System] Print thread dumps in the CI if build has been cancelled or failed
* [FLINK-32331][Build System] Add copyright and source from Netty
* [FLINK-32331][Build System] Only trigger on build failures, not build cancellations
---
.github/workflows/ci.yml | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 26d841a..d0a714a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -150,3 +150,39 @@ jobs:
-Dexec.args="${{ env.MVN_BUILD_OUTPUT_FILE }} $(pwd) ${{ env.MVN_VALIDATION_DIR }}" \
${{ env.MVN_CONNECTION_OPTIONS }} \
-Dlog4j.configurationFile=file://$(pwd)/tools/ci/log4j.properties
+
+ - name: Print JVM thread dumps when cancelled
+ if: ${{ failure() }}
+ run: |
+ # ----------------------------------------------------------------------------
+ # Copyright 2023 The Netty Project
+ #
+ # ----------------------------------------------------------------------------
+ # Source: https://github.com/netty/netty/blob/main/.github/actions/thread-dump-jvms/action.yml
+ echo "$OSTYPE"
+ if [[ "$OSTYPE" == "linux-gnu"* ]] && command -v sudo &> /dev/null; then
+ echo "Setting up JVM thread dumps"
+ # use jattach so that Java processes in docker containers are also covered
+ # download jattach
+ curl -s -L -o /tmp/jattach https://github.com/apangin/jattach/releases/download/v2.1/jattach
+ if command -v sha256sum &> /dev/null; then
+ # verify hash of jattach binary
+ sha256sum -c <(echo "07885fdc782e02e7302c6d190f54c3930afa10a38140365adf54076ec1086a8e /tmp/jattach") || exit 1
+ fi
+ chmod +x /tmp/jattach
+ for java_pid in $(sudo pgrep java); do
+ echo "----------------------- pid $java_pid -----------------------"
+ echo "command line: $(sudo cat /proc/$java_pid/cmdline | xargs -0 echo)"
+ sudo /tmp/jattach $java_pid jcmd VM.command_line || true
+ sudo /tmp/jattach $java_pid jcmd "Thread.print -l"
+ sudo /tmp/jattach $java_pid jcmd GC.heap_info || true
+ done
+ else
+ for java_pid in $(jps -q -J-XX:+PerfDisableSharedMem); do
+ echo "----------------------- pid $java_pid -----------------------"
+ jcmd $java_pid VM.command_line || true
+ jcmd $java_pid Thread.print -l
+ jcmd $java_pid GC.heap_info || true
+ done
+ fi
+ exit 0