On Fri, Jan 13, 2012 at 6:32 PM, Anthony Liguori <aligu...@us.ibm.com> wrote: > + pid = fork(); > + if (pid == 0) { > + command = g_strdup_printf("%s " > + "-qtest unix:%s,server,nowait " > + "-qtest-log /dev/null " > + "-pidfile %s " > + "-machine accel=qtest " > + "%s", qemu_binary, socket_path, > + pid_file, > + extra_args ?: ""); > + > + ret = system(command);
qtest_init() launches qemu with a pidfile so that we can send SIGTERM later. But we never get around to doing that if g_assert() fails - it calls abort(3). The result is a run-away qemu process. I find the qemu process consumes 100% in send_all() trying to write to the closed qtest socket and SIGTERM no longer works since we're stuck in a tight loop that never runs the event loop. A simple solution is to handle SIGABRT in tests/libqtest.c and sent SIGTERM to qemu when the test aborts. The downside is that this only covers the abort(3) case - a segfault or other abnormal termination would still leave the run-away qemu process. I was wondering about a qemu-side solution where a closed qtest socket means we need to shut down, but am not sure if the chardev code lets us do that. (Really we want POLLHUP but we only seem to have POLLIN/POLLOUT handlers.) Thoughts? Stefan