2882: arv-mount restores signal handlers after sp.wait(). Fixed spelling ellapsed...
authorPeter Amstutz <peter.amstutz@curoverse.com>
Wed, 4 Jun 2014 18:52:07 +0000 (14:52 -0400)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Wed, 4 Jun 2014 18:52:07 +0000 (14:52 -0400)
services/crunch/crunchstat/src/arvados.org/crunchstat/crunchstat.go
services/fuse/bin/arv-mount

index f11b93e52e0fee53b096d1e0664e91da6a934d81..75284856fad62e102433a92282fb3b17f52908f7 100644 (file)
@@ -63,7 +63,7 @@ func PollCgroupStats(cgroup_path string, stderr chan string, poll int64) {
        cpuset_cpus := fmt.Sprintf("%s/cpuset.cpus", cgroup_path)
        memory_stat := fmt.Sprintf("%s/memory.stat", cgroup_path)
 
-       var ellapsed int64 = poll
+       var elapsed int64 = poll
 
        for {
                /*{
@@ -119,11 +119,11 @@ func PollCgroupStats(cgroup_path string, stderr chan string, poll int64) {
                                // time is in milliseconds, we need to boost
                                // that to 1000 jiffies per second, then boost
                                // it by another 100x to get a percentage, then
-                               // finally divide by the actual ellapsed time
+                               // finally divide by the actual elapsed time
                                // and the number of cpus to get average load
                                // over the polling period.
-                               user_pct := (user_diff * 10 * 100) / (ellapsed * cpus)
-                               sys_pct := (sys_diff * 10 * 100) / (ellapsed * cpus)
+                               user_pct := (user_diff * 10 * 100) / (elapsed * cpus)
+                               sys_pct := (sys_diff * 10 * 100) / (elapsed * cpus)
 
                                stderr <- fmt.Sprintf("crunchstat: cpuacct.stat user %v", user_pct)
                                stderr <- fmt.Sprintf("crunchstat: cpuacct.stat sys %v", sys_pct)
@@ -182,7 +182,7 @@ func PollCgroupStats(cgroup_path string, stderr chan string, poll int64) {
                bedtime := time.Now()
                time.Sleep(time.Duration(poll) * time.Millisecond)
                morning := time.Now()
-               ellapsed = morning.Sub(bedtime).Nanoseconds() / int64(time.Millisecond)
+               elapsed = morning.Sub(bedtime).Nanoseconds() / int64(time.Millisecond)
        }
 }
 
index 4f1d23f02180466fd64e7544096af7cbe0407672..b4afffab061fc2ceaf56bc7dcb93a105fa3d93cb 100755 (executable)
@@ -65,14 +65,22 @@ collections on the server.""")
         # wait until the driver is finished initializing
         operations.initlock.wait()
 
+        rc = 255
         try:
             sp = subprocess.Popen(args.exec_args, shell=False)
+
             # forward signals to the process.
             signal.signal(signal.SIGINT, lambda signum, frame: sp.send_signal(signum))
             signal.signal(signal.SIGTERM, lambda signum, frame: sp.send_signal(signum))
             signal.signal(signal.SIGQUIT, lambda signum, frame: sp.send_signal(signum))
-            rc = 255
+
+            # wait for process to complete.
             rc = sp.wait()
+
+            # restore default signal handlers.
+            signal.signal(signal.SIGINT, signal.SIG_DFL)
+            signal.signal(signal.SIGTERM, signal.SIG_DFL)
+            signal.signal(signal.SIGQUIT, signal.SIG_DFL)
         except OSError as e:
             sys.stderr.write('arv-mount: %s -- exec %s\n' % (str(e), args.exec_args))
             rc = e.errno