Ultimate Boot CD
http://www.ultimatebootcd.com/forums/

CPU Burn-in still runs on background when user 'Ctrl+C'
http://www.ultimatebootcd.com/forums/viewtopic.php?f=12&t=14429
Page 1 of 1

Author:  Explorer09 [ Wed Sep 05, 2012 12:31 am ]
Post subject:  CPU Burn-in still runs on background when user 'Ctrl+C'

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:
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:
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+\ .

Author:  Explorer09 [ Sun Oct 21, 2012 7:10 am ]
Post subject:  Re: CPU Burn-in still runs on background when user 'Ctrl+C'

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:
--- 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
 

Author:  Explorer09 [ Wed Oct 24, 2012 10:21 pm ]
Post subject:  Re: CPU Burn-in still runs on background when user 'Ctrl+C'

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

Code:
--- 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

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/