CPU Burn-in still runs on background when user 'Ctrl+C'

Report new bugs here, or look at known issues of current and previous releases of UBCD.

Moderators: Icecube, StopSpazzing

Post Reply
Message
Author
Explorer09
Posts: 178
Joined: Fri Jun 17, 2011 11:23 pm

CPU Burn-in still runs on background when user 'Ctrl+C'

#1 Post by Explorer09 » Wed Sep 05, 2012 12:31 am

Steps to reproduce this bug:
1. Have a computer that has 2 or more CPU cores. (i.e. Test this bug on modern computers)
2. Boot UBCD 5.0.3 (UBCD 5.1 will cause a kernel panic and thus can't test.)
2. Select "CPU -> CPU Burn-in" from UBCD boot menu.
3. Wait and let cpuburn-in run for a few minutes. You should see some output like this:

Code: Select all

20000 iterations complete.
20000 iterations complete.
25000 iterations complete.
25000 iterations complete.
30000 iterations complete.
30000 iterations complete.
4. Press Ctrl+C.

Actual result:
All of the cpuburn-in instances are still running in the background, and you are still seeing them output things.

Code: Select all

35000 iterations complete.
35000 iterations complete.
^C
# 40000 iterations complete.
40000 iterations complete.
......
Expected result:
All instances of cpuburn-in should be terminated.

Notes:
The same problem happens when you press CTRL+\ .

Explorer09
Posts: 178
Joined: Fri Jun 17, 2011 11:23 pm

Re: CPU Burn-in still runs on background when user 'Ctrl+C'

#2 Post by Explorer09 » Sun Oct 21, 2012 7:10 am

Ahh... I forgot to tell that I've already patched this bug in my modified CPUstress image v2.1expl3.

Patch is attached below. Basically I added two trap commands to catch the signals generated by Ctrl+C and Ctrl+\, and finally release them.

Code: Select all

--- initrd-old/usr/local/bin/cpuburn	2012-10-21 22:49:42.458631019 +0800
+++ initrd-new/usr/local/bin/cpuburn	2012-10-21 22:53:25.106636051 +0800
@@ -23,7 +23,8 @@
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #
 #
-# Last updated by Gert Hulselmans on 26 February 2009.
+# Last updated by Gert Hulselmans on 7 September 2012.
+# Patched by Explorer to fix a "Ctrl+C" bug and terminate cpuburn-in properly.
 
 
 CPUS=`awk '/^processor/ {CPU=$3}; END {print CPU+1}' /proc/cpuinfo`
@@ -65,7 +66,9 @@
         /opt/cpuburn/cpuburn-in $time &
     done
 
+    trap 'pkill cpuburn-in; trap - 2 3; exit' 2 3
     read -s -n1
     pkill cpuburn-in
+    trap - 2 3
 fi
 

Explorer09
Posts: 178
Joined: Fri Jun 17, 2011 11:23 pm

Re: CPU Burn-in still runs on background when user 'Ctrl+C'

#3 Post by Explorer09 » Wed Oct 24, 2012 10:21 pm

2nd revision. I moved the first trap command to the place before the instances of cpuburn-in are started.

Code: Select all

--- initrd-old/usr/local/bin/cpuburn	2012-10-25 14:20:26.628338545 +0800
+++ initrd-new/usr/local/bin/cpuburn	2012-10-25 14:17:05.000000000 +0800
@@ -23,8 +23,7 @@
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #
 #
-# Last updated by Gert Hulselmans on 25 October 2012.
-# Patched by Explorer to fix a "Ctrl+C" bug and terminate cpuburn-in properly.
+# Last updated by Gert Hulselmans on 26 February 2009.
 
 
 CPUS=`awk '/^processor/ {CPU=$3}; END {print CPU+1}' /proc/cpuinfo`
@@ -59,7 +58,6 @@
     echo
     echo 'To stop cpuburn-in, press any key.'
 
-    trap 'pkill cpuburn-in; trap - 2 3; exit' 2 3
     for i in `seq 1 $CPUS`; do
         echo
         echo "Starting instance $i of cpuburn-in ('cpuburn-in $time &')."
@@ -69,6 +67,5 @@
 
     read -s -n1
     pkill cpuburn-in
-    trap - 2 3
 fi

Post Reply