From 508edf5cc52aadc5c212a9e9da467679709bf561 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Mon, 12 Dec 2016 09:16:29 +0100 Subject: [PATCH] Fix a rare crash when stopping qemu Fix #821 --- gns3server/compute/qemu/qemu_vm.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/gns3server/compute/qemu/qemu_vm.py b/gns3server/compute/qemu/qemu_vm.py index f93488aa..735a380f 100644 --- a/gns3server/compute/qemu/qemu_vm.py +++ b/gns3server/compute/qemu/qemu_vm.py @@ -972,12 +972,13 @@ class QemuVM(BaseNode): except ProcessLookupError: pass except asyncio.TimeoutError: - try: - self._process.kill() - except ProcessLookupError: - pass - if self._process.returncode is None: - log.warn('QEMU VM "{}" PID={} is still running'.format(self._name, self._process.pid)) + if self._process: + try: + self._process.kill() + except ProcessLookupError: + pass + if self._process.returncode is None: + log.warn('QEMU VM "{}" PID={} is still running'.format(self._name, self._process.pid)) self._process = None self._stop_cpulimit() yield from super().stop()