rmetzger commented on a change in pull request #14033:
URL: https://github.com/apache/flink/pull/14033#discussion_r523151423



##########
File path: flink-end-to-end-tests/test-scripts/common.sh
##########
@@ -822,11 +839,20 @@ internal_run_with_timeout() {
 
   (
       command_pid=$BASHPID
-      (sleep "${timeout_in_seconds}" # set a timeout for this command
-      echo "${command_label:-"The command '${command}'"} (pid: $command_pid) 
did not finish after $timeout_in_seconds seconds."
-      eval "${on_failure}"
-      kill "$command_pid") & watchdog_pid=$!
+      (# this subshell contains the watchdog
+        local wakeup_time=$(( ${timeout_in_seconds} + $(date +%s) ))
+        while true; do
+          sleep 1
+          if [ $wakeup_time -le $(date +%s) ]; then
+            echo "${command_label:-"The command '${command}'"} (pid: 
$command_pid) did not finish after $timeout_in_seconds seconds."
+            eval "${on_failure}"
+            kill "$command_pid"
+            pkill -P "$command_pid"

Review comment:
       My understanding is that this command kills all children of 
`$command_pid`, and if there's no pattern, it'll kill all of them




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to