From fad9ce436648b23b14186e508db31480c57e140f Mon Sep 17 00:00:00 2001 From: Mike Rushton Date: Fri, 3 Mar 2017 21:16:16 -0500 Subject: Fix memory_stress_ng for LP: #1573062 --- bin/memory_stress_ng | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'bin') 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 -- cgit v1.2.3