diff --git a/arthas-boot.jar b/arthas-boot.jar index 9b95c68f0..dc3229d9c 100644 Binary files a/arthas-boot.jar and b/arthas-boot.jar differ diff --git a/as.sh b/as.sh index 772591460..9448bf6c0 100755 --- a/as.sh +++ b/as.sh @@ -8,10 +8,10 @@ # program : Arthas # author : Core Engine @ Taobao.com -# date : 2023-04-19 +# date : 2023-05-09 # current arthas script version -ARTHAS_SCRIPT_VERSION=3.6.8 +ARTHAS_SCRIPT_VERSION=3.6.9 # SYNOPSIS # rreadlink @@ -393,12 +393,32 @@ update_if_necessary() fi } +# jps command may crash, so need to check it +check_jps() { + "${JAVA_HOME}/bin/jps" > /dev/null 2>&1 + local exit_code=$? + if [ $exit_code -ne 0 ]; then + echo "jps command failed with exit code ${exit_code}" >&2 + fi + return $exit_code +} + call_jps() { - if [ "${VERBOSE}" = true ] ; then - "${JAVA_HOME}"/bin/jps -l -v + check_jps + local exit_code=$? + if [[ "$exit_code" -eq 0 ]]; then + # jps command is ok + local jps_command=("${JAVA_HOME}/bin/jps" "-l") + if [ "${VERBOSE}" = true ] ; then + jps_command=("${JAVA_HOME}/bin/jps" "-l" "-v") + fi + local jps_output=$("${jps_command[@]}") + echo "$jps_output" else - "${JAVA_HOME}"/bin/jps -l + # jps command failed, use ps and grep + ps_output=$(ps aux | grep java | grep -v grep | awk '{print $2" "$11}') + echo "$ps_output" fi } @@ -455,7 +475,7 @@ EXAMPLES: ./as.sh --stat-url 'http://192.168.10.11:8080/api/stat' ./as.sh -c 'sysprop; thread' ./as.sh -f batch.as - ./as.sh --use-version 3.6.8 + ./as.sh --use-version 3.6.9 ./as.sh --session-timeout 3600 ./as.sh --attach-only ./as.sh --disabled-commands stop,dump diff --git a/math-game.jar b/math-game.jar index f30c92e09..a7d0091b8 100644 Binary files a/math-game.jar and b/math-game.jar differ