Bug 617082 - QMP: parse error when issuing any command with extra "}"
Summary: QMP: parse error when issuing any command with extra "}"
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm
Version: 7.0
Hardware: All
OS: Linux
high
medium
Target Milestone: beta
: 7.0
Assignee: Luiz Capitulino
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Keywords: RHELNAK
Depends On:
Blocks: 559201 580449 580954
TreeView+ depends on / blocked
 
Reported: 2010-07-22 07:08 UTC by Mike Cao
Modified: 2014-06-18 03:11 UTC (History)
16 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2014-06-13 12:22:25 UTC


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

Description Mike Cao 2010-07-22 07:08:52 UTC
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 07:38:08 UTC
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 16:29:34 UTC
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 19:49:19 UTC
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 08:59:40 UTC
I think this is fixed by Jeff's QAPI backports.

Comment 12 Ademar Reis 2012-04-25 20:08:14 UTC
*** Bug 815952 has been marked as a duplicate of this bug. ***

Comment 13 IBM Bug Proxy 2012-04-25 20:15:15 UTC
Created attachment 580269 [details]
sosreport

Comment 14 Jeff Cody 2012-04-26 00:00:46 UTC
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 14:28:40 UTC
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 16:37:44 UTC
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 16:49:35 UTC
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-03 04:29:42 UTC
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 14:03:47 UTC
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-06 02:30:36 UTC
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 12:22:25 UTC
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.