<div dir="ltr">Hi<div><br></div><div>For a long time SpiceQE from time to time had this error:</div><div><br></div><div>Exception thrown while loading env<br></div><div><div>(AttributeError("'VM' object has no attribute 'name'",), <class virttest.qemu_monitor.HumanMonitor at 0x3992a78>, (<virttest.qemu_vm.VM object at 0x3e25950>, 'hmp1', '/var/tmp/avocado_bFZBC6/monitor-hmp1-20170210-134859-mVznyQoq', False))</div><div>Creating new, empty env file 2</div></div><div><br></div><div>After which Avocado test process hangs forever. It was very hard to explain.</div><div><br></div><div>I finally found the cause.</div><div><br></div><div>It is easy reproduce even with "boot" test.</div><div><br></div><div>1. Change boot.py to raise any exception at the beginning of run() function: "raise E...."</div><div>2. Run this test with:</div><div><br></div><div>avocado run --show-job-log boot --vt-extra-params 'kill_vm=no' 'kill_vm_on_error=no'<br></div><div><br></div><div>This test will stay active all time no matter what. </div><div><br></div><div>The problem is: there is active thread:</div><div><br></div><div>[<_MainThread(MainThread, started 140040446437184)>, <Thread(tail_thread_MwKAuDx9_QEMU_AUDIO, started 140040077772544)>]<br></div><div><br></div><div>tail_thread_xxxxxx thread is created at:</div><div><br></div><div>./lib/python2.7/site-packages/aexpect/client.py:624:        self.tail_thread = threading.Thread(target=self._tail,<br></div><div><br></div><div>This is a cause that Avocado process stays active.</div><div><div><br></div><div>It reaches exit point:</div><div><br></div><div>--Return--</div><div>> /mnt/tests/spice/qe-tests/virtualenv/bin/avocado(83)<module>()->None</div><div>-> sys.exit(app.run())</div><div>(Pdb)</div></div><div><br></div><div>But running thread doesn't allow to exit:</div><div><br></div><div><div># strace -f -p 22879</div><div>Process 22879 attached with 2 threads</div><div>[pid 22879] select(10, [9], [], [], {0, 17975} <unfinished ...></div><div>[pid 22353] futex(0x45e0760, FUTEX_WAIT_PRIVATE, 0, NULL <unfinished ...></div><div>[pid 22879] <... select resumed> )      = 0 (Timeout)</div><div>[pid 22879] select(10, [9], [], [], {0, 50000}) = 0 (Timeout)</div><div>[pid 22879] select(10, [9], [], [], {0, 50000}) = 0 (Timeout)</div><div>[pid 22879] select(10, [9], [], [], {0, 50000}) = 0 (Timeout)</div><div>[pid 22879] select(10, [9], [], [], {0, 50000}) = 0 (Timeout)</div></div><div><br></div><div><br></div><div>Okay. We can set "kill_vm" to "yes".  But...... There is something wrong with:</div><div><br></div><div>kill_vm = no + kill_vm_on_error=no<br></div><div><br></div></div>