All,
I've been looking into the failing ceph tests as noted here:
https://bugs.launchpad.net/utah/+bug/1085835
I'm proposing this patch as a potential fix. I haven't been able to
reproduce this locally but what Paul found last night looks just like
the post I linked to in the bug.
In the long term I think we need to raise the priority of fixing the
result class to output command logs in real-time and only write the YAML
summary data at the end of the run.
Thanks,
Joe
=== modified file 'utah/client/common.py'
--- utah/client/common.py 2012-12-10 14:07:05 +0000
+++ utah/client/common.py 2012-12-14 20:20:52 +0000
@@ -27,6 +27,7 @@
import pwd
import signal
import subprocess
+import tempfile
import yaml
import jsonschema
@@ -102,43 +103,49 @@
raise TimeoutAlarm
start_time = datetime.datetime.now()
- p = subprocess.Popen("{} {}".format(cmd_prefix, command),
- shell=True, cwd=cwd,
- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-
- if timeout != 0:
- signal.signal(signal.SIGALRM, alarm_handler)
- signal.alarm(timeout)
-
- try:
- stdout, stderr = p.communicate()
- stdout = normalize_encoding(stdout)
- stderr = normalize_encoding(stderr)
-
- if timeout != 0:
- signal.alarm(0)
- except TimeoutAlarm:
- pids = [p.pid]
- # Kill p's children too.
- pids.extend(get_process_children(p.pid))
-
- for pid in pids:
- # process might have died before getting to this line
- # so wrap to avoid OSError: no such process
+ with tempfile.TemporaryFile() as stdout_file:
+ with tempfile.TemporaryFile() as stderr_file:
+ p = subprocess.Popen("{} {}".format(cmd_prefix, command),
+ shell=True, cwd=cwd,
+ stdout=stdout_file.fileno(), stderr=stderr_file.fileno())
+
+ if timeout != 0:
+ signal.signal(signal.SIGALRM, alarm_handler)
+ signal.alarm(timeout)
+
try:
- os.kill(pid, signal.SIGKILL)
- except OSError:
- pass
-
- time_delta = datetime.datetime.now() - start_time
-
- return make_result(command=command,
- retcode=ERROR_TIMEOUT,
- start_time=start_time.strftime(DATE_FORMAT),
- time_delta=str(time_delta),
- cmd_type=cmd_type,
- user=run_as,
- )
+ out, err = p.communicate()
+ stdout_file.seek(0)
+ stderr_file.seek(0)
+ stdout = stdout_file.read()
+ stderr = stderr_file.read()
+ stdout = normalize_encoding(stdout)
+ stderr = normalize_encoding(stderr)
+
+ if timeout != 0:
+ signal.alarm(0)
+ except TimeoutAlarm:
+ pids = [p.pid]
+ # Kill p's children too.
+ pids.extend(get_process_children(p.pid))
+
+ for pid in pids:
+ # process might have died before getting to this line
+ # so wrap to avoid OSError: no such process
+ try:
+ os.kill(pid, signal.SIGKILL)
+ except OSError:
+ pass
+
+ time_delta = datetime.datetime.now() - start_time
+
+ return make_result(command=command,
+ retcode=ERROR_TIMEOUT,
+ start_time=start_time.strftime(DATE_FORMAT),
+ time_delta=str(time_delta),
+ cmd_type=cmd_type,
+ user=run_as,
+ )
time_delta = datetime.datetime.now() - start_time
--
Ubuntu-utah-devel mailing list
[email protected]
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/ubuntu-utah-devel