diff from v1 ============ 1. drop patches 1-2 of v1. As to "event loop" patch seems nobody has "production" problems due to leaks on termination. Turning freeing callback objects registered in event loop on after it is finished has an impact that is hard to predict. Different parts of libvirt use event loop and the patch can trigger paths that were not passed before. Let's wait for real issue) "Breaking cyclic dependency" patch will not reach its target without "event loop patch" anyway - daemon object will still leak in certain situation so let's drop it too. 2. add code commenting patch It documents another reason why we should not free callback object synchronously in remove handle/timeout function besides Dan's objection: https://www.redhat.com/archives/libvir-list/2016-September/msg01005.html Reproducing: ============ Crash situation of patches 1-2 can easily be simulated, just patch libvirt: diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 30a2830..f6b71d6 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4515,6 +4515,8 @@ processMonitorEOFEvent(virQEMUDriverPtr driver, unsigned int stopFlags = 0; virObjectEventPtr event = NULL; + sleep(3); + if (qemuProcessBeginStopJob(driver, vm, QEMU_JOB_DESTROY, true) < 0) return; then when it is up and running and there is also a qemu domain running: kill -9 $QEMU_DOMAIN && pkill libvirtd By the way there should be no admin connection at the moment or crash will not happen due to leaks. Nikolay Shirokovskiy (3): daemon: keep daemon until all hypervisors drivers are cleaned up qemu: first wait all workers finish on state cleanup util: event loop: document another reason to defer deletion daemon/libvirtd.c | 4 +++- src/qemu/qemu_driver.c | 2 +- src/util/vireventpoll.c | 7 +++++++ 3 files changed, 11 insertions(+), 2 deletions(-) -- 1.8.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list