Hi all, On 12:14 Fri 24 Jan , Stratos Psomadakis wrote: > On 01/23/2014 08:28 PM, Luiz Capitulino wrote: > > Not yet, I may have some time tomorrow. How reproducible is it for > > you? > > We can trigger it (by following the steps described in the first mail) > consistently. > > > Another question: have you tried to reproduce with an old qemu version > > (say v1.0) to see if this bug always existed? If the bug was introduced > > in some recent QEMU version you could try to bisect it. > > v1.1 is not affected. I checked the code and it seems the monitor code > has been refactored since v1.1. > > > Maybe you could try to reproduce with a different subsystem so that we > > can rule out or confirm monitor's involvement? Like -serial? > > It's actually a fault of the monitor_flush() function. As far as I can > understand, monitor_flush() calls qemu_chr_fe_write() and doesn't handle > all of the return codes / error cases properly (as I described in a > previous mail). If you check the function, you'll see that the final > case (where it set ups a watch / callback) always assumes an EAGAIN / > EWOULDBLOCK error. > > If you can verify / confirm that this is the case and that the patch > sent resolves the issue in a sane / correct way, I'll resubmit it > properly (with git-format-patch, a git log msg etc).
Please see the attached testcase (python script) that programmatically reproduces this. Sample output with qemu 1.7.0: ------------------------------------------------------------------------ $ ./test-qmp.py Spawning qemu Connecting client 1 Monitor output: {"QMP": {"version": {"qemu": {"micro": 0, "minor": 7, "major": 1}, "package": " (Debian 1.7.0+dfsg-2)"}, "capabilities": []}} Connecting client 2 Monitor output: (timeout, disconnecting) Disconnecting client 1 Connecting client 3 Monitor output {"QMP": {"version": {"qemu": {"micro": 0, "minor": 7, "major": 1}, "package": " (Debian 1.7.0+dfsg-2)"}, "capabilities": []}} {"QMP": {"version": {"qemu": {"micro": 0, "minor": 7, "major": 1}, "package": " (Debian 1.7.0+dfsg-2)"}, "capabilities": []}} Terminating qemu qemu: terminating on signal 15 from pid 11269 ------------------------------------------------------------------------ Regards, Apollon
#!/usr/bin/python import os import socket import tempfile import subprocess from time import sleep sock_path = tempfile.mktemp() print "Spawning qemu" print qemu = subprocess.Popen(["/usr/bin/qemu", "-chardev", "socket,id=mon0,path=%s,server,nowait" % sock_path, "-mon", "chardev=mon0,mode=control", "-display", "none"]) # Wait for qemu to initialize while not os.path.exists(sock_path): sleep(0.1) print "Connecting client 1\n" cl1 = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) cl1.connect(sock_path) print "Monitor output:" print cl1.recv(1024) print print "Connecting client 2\n" cl2 = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) cl2.settimeout(1) try: cl2.connect(sock_path) print "Monitor output:" print cl2.recv(1024) except socket.timeout: print "(timeout, disconnecting)\n" cl2.close() print "Disconnecting client 1\n" cl1.close() print "Connecting client 3\n" cl3 = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) cl3.connect(sock_path) print "Monitor output" print cl3.recv(1024) cl3.close() print "Terminating qemu" qemu.terminate() qemu.wait()