diff options
author | Mike Rushton <mike.rushton@canonical.com> | 2017-03-03 21:16:16 -0500 |
---|---|---|
committer | Mike Rushton <mike.rushton@canonical.com> | 2017-03-03 21:16:16 -0500 |
commit | 7492b2d0b19e7ecad5c58598034eb80a5498c26c (patch) | |
tree | 35c1b56e5dc6f291fad7f2f120f524364deadff0 | |
parent | b8e5fb6158ef5ee9b819228aee58266a3b23506b (diff) |
Fix memory_stress_ng for LP: #1573062
-rwxr-xr-x | bin/memory_stress_ng | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/bin/memory_stress_ng b/bin/memory_stress_ng index 35c7725..a2b232b 100755 --- a/bin/memory_stress_ng +++ b/bin/memory_stress_ng @@ -75,10 +75,27 @@ run_stressor() { end_time=$((runtime*15/10)) echo "Running stress-ng $1 stressor for $2 seconds...." # Use "timeout" command to launch stress-ng, to catch it should it go into la-la land - timeout -s 9 $end_time stress-ng --aggressive --verify --timeout $runtime --$1 0 + timeout -s 14 $end_time stress-ng -k --aggressive --verify --timeout $runtime --$1 0 return_code="$?" echo "return_code is $return_code" if [ "$return_code" != "0" ] ; then + # + # a small grace period to allow stressors to terminate + # + sleep 10 + # + # still running? aggressively kill all stressors + # + pids=$(pidof stress-ng) + if [ -n "$pids" ]; then + kill -9 $pids + sleep 1 + kill -9 $pids + pids=$(pidof stress-ng) + if [ -n "$pids" ]; then + echo "Note: stress-ng (PIDS $pids) could not be killed" + fi + fi had_error=1 echo "*****************************************************************" if [ $return_code = "137" ] ; then |