Bug 617082 - QMP: parse error when issuing any command with extra "}"
QMP: parse error when issuing any command with extra "}"
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
7.0
All Linux
high Severity medium
: beta
: 7.0
Assigned To: Luiz Capitulino
Virtualization Bugs
: RHELNAK
Depends On:
Blocks: 559201 580449 580954
  Show dependency treegraph
 
Reported: 2010-07-22 03:08 EDT by Mike Cao
Modified: 2014-06-17 23:11 EDT (History)
16 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-13 08:22:25 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
sosreport (1.17 MB, application/x-xz)
2012-04-25 16:15 EDT, IBM Bug Proxy
no flags Details

  None (edit)
Description Mike Cao 2010-07-22 03:08:52 EDT
Description of problem:


Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.97.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. /usr/libexec/qemu-kvm -chardev stdio,id=monitor  -mon
chardev=monitor,mode=control
2. Send command
{"execute":"qmp_capabilities"}} 
(note that it is not {"execute":"qmp_capabilities"} )
3.Send command
{"execute":"query-status"}
  
Actual results:
After step2,
{"return": {}}

After step3,
{"error": {"class": "JSONParsing", "desc": "Invalid JSON syntax", "data": {}}}
{"error": {"class": "QMPBadInputObject", "desc": "Expected 'object' in QMP input", "data": {"expected": "object"}}}
{"error": {"class": "JSONParsing", "desc": "Invalid JSON syntax", "data": {}}}
{"error": {"class": "QMPBadInputObject", "desc": "Expected 'object' in QMP input", "data": {"expected": "object"}}}



Expected results:
After step2,it will return QMP parse error.
After step3,it should be {"return": {}}.


Additional info:
Comment 2 RHEL Product and Program Management 2010-07-22 03:38:08 EDT
This issue has been proposed when we are only considering blocker
issues in the current Red Hat Enterprise Linux release.

** If you would still like this issue considered for the current
release, ask your support representative to file as a blocker on
your behalf. Otherwise ask that it be considered for the next
Red Hat Enterprise Linux release. **
Comment 6 Luiz Capitulino 2010-07-22 12:29:34 EDT
This is related to bug #580449, possibly it's even the same issue. But won't close as a duplicated though, not before we figuring it out.

However, this is not severe, as it only happens with certain types of bad inputs and the client would have to be buggy too to issue them.

Thanks for the report Mike, let's fix it for rhel6.1.
Comment 10 Luiz Capitulino 2011-12-09 14:49:19 EST
This won't be fixed for RHEL6 because it's a minor bug, libvirt would have to
send broken json to qemu to trigger this.

But this bug exists upstream and will be fixed there in the near future. Will
move this BZ to RHEL7.0 so that we can keep track of it.
Comment 11 Paolo Bonzini 2012-03-07 03:59:40 EST
I think this is fixed by Jeff's QAPI backports.
Comment 12 Ademar Reis 2012-04-25 16:08:14 EDT
*** Bug 815952 has been marked as a duplicate of this bug. ***
Comment 13 IBM Bug Proxy 2012-04-25 16:15:15 EDT
Created attachment 580269 [details]
sosreport
Comment 14 Jeff Cody 2012-04-25 20:00:46 EDT
I believe Paolo is correct, I think this is fixed - here is a quick test on qemu-kvm-0.12.1.2-2.285.el6:


[Jeff.Cody@jefflaptop ~]$ telnet localhost 4444
Trying ::1...
Connected to localhost.
Escape character is '^]'.
{"QMP": {"version": {"qemu": {"micro": 1, "minor": 12, "major": 0}, "package": "(qemu-kvm-devel)"}, "capabilities": []}}

{ "execute": "qmp_capabilities" }}
{"return": {}}
{"error": {"class": "JSONParsing", "desc": "Invalid JSON syntax", "data": {}}}

{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "virtio0","snapshot-file":"/tmp/f16-snapnew.img","mode": "existing","format": "qcow2" } }
{"return": {}}

{ "execute": "query-status" }
{"return": {"status": "running", "singlestep": false, "running": true}}
Comment 15 Luiz Capitulino 2012-04-26 10:28:40 EDT
The behavior of the problem has changed, but it's still buggy: QMP is emitting a success response _and_ an error response, this is illegal.

The correct behavior is just failing (and query-status shouldn't work, as qmp_capabilities has not succeeded).

Haven't checked this on upstream yet.
Comment 16 Luiz Capitulino 2012-04-26 12:37:44 EDT
Talked with Jeff on IRC and it turns out he's right (comment 14).

The parser is doing the right thing here. First, it parses the qmp_capabilities command dict. The syntax is right and the command is good, so the success response is emitted. Then the parser parses "}", which is invalid, and returns an error message accordingly (look at the 'data' member).

No multiple errors as described in the original description. Also, QMP works normally (ie. doesn't get stuck).

Moving to QA.
Comment 18 Luiz Capitulino 2013-06-11 12:49:35 EDT
The version this got fixed is unknown. This is a quite old bz that we suddenly realized it was fixed.
Comment 19 mazhang 2014-01-02 23:29:42 EST
Test this bug on rhel7, but still have a problem, After issue a invalid command, qmp monitor can NOT be used, Any right commands will return error.

Host:
qemu-kvm-rhev-1.5.3-30.el7.x86_64
kernel-3.10.0-64.el7.x86_64

Guest:
RHEL7

Result:
Escape character is '^]'.
{"QMP": {"version": {"qemu": {"micro": 3, "minor": 5, "major": 1}, "package": " (qemu-kvm-1.5.3-30.el7)"}, "capabilities": []}}
{"execute":"qmp_capabilities"}} 
{"return": {}}
{"error": {"class": "GenericError", "desc": "Invalid JSON syntax"}}
{"execute":"query-status"}
{"return": {"status": "running", "singlestep": false, "running": true}}
{"execute":"qmp_capabisadfewfsds"}} 
{"error": {"class": "CommandNotFound", "desc": "The command qmp_capabisadfewfsds has not been found"}}
{"error": {"class": "GenericError", "desc": "Invalid JSON syntax"}}
{"execute":"qmp_capabilsdfwe234543t)(&%
}
{"execute":"query-status"}
{"error": {"class": "GenericError", "desc": "Invalid JSON syntax"}}
{"error": {"class": "GenericError", "desc": "Invalid JSON syntax"}}
{"execute":"query-status"}
{"error": {"class": "GenericError", "desc": "Expected 'object' in QMP input"}}
{"error": {"class": "GenericError", "desc": "Invalid JSON syntax"}}
{"error": {"class": "GenericError", "desc": "Expected 'object' in QMP input"}}
{"error": {"class": "GenericError", "desc": "Invalid JSON syntax"}}
{"error": {"class": "GenericError", "desc": "Invalid JSON syntax"}}
{"error": {"class": "GenericError", "desc": "Invalid JSON syntax"}}
{"execute": "query-block"}
{"error": {"class": "GenericError", "desc": "Expected 'object' in QMP input"}}
{"error": {"class": "GenericError", "desc": "Invalid JSON syntax"}}
{"error": {"class": "GenericError", "desc": "Expected 'object' in QMP input"}}
{"error": {"class": "GenericError", "desc": "Invalid JSON syntax"}}
{"error": {"class": "GenericError", "desc": "Invalid JSON syntax"}}
{"error": {"class": "GenericError", "desc": "Invalid JSON syntax"}}
Comment 20 Luiz Capitulino 2014-01-03 09:03:47 EST
Well, it's a different pattern that breaks it. This bz is so old that I think it's better to open a new bz for the problem you found.
Comment 21 mazhang 2014-01-05 21:30:36 EST
As developer suggestion in comment 20, file a new bug 1048648 against problem in comment 19.
This bug has been verified, any problem please let me know.
Comment 24 Ludek Smid 2014-06-13 08:22:25 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

Note You need to log in before you can comment on or make changes to this bug.