summaryrefslogtreecommitdiff
diff options
authorMike Rushton <mike.rushton@canonical.com>2017-03-03 21:16:16 -0500
committerSylvain Pineau <sylvain.pineau@canonical.com>2017-04-03 09:39:22 +0200
commitfad9ce436648b23b14186e508db31480c57e140f (patch)
tree9a506849b467172fe28f6488b330b074011aed09
parent41577fd1c96a5e76862e3bdfe1f504507e862312 (diff)
Fix memory_stress_ng for LP: #1573062
-rwxr-xr-xbin/memory_stress_ng19
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