RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 870703 - after run wrong command can not execute virt-agent commands anymore
Summary: after run wrong command can not execute virt-agent commands anymore
Keywords:
Status: CLOSED DUPLICATE of bug 870311
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm
Version: 6.4
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Laszlo Ersek
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-28 03:28 UTC by langfang
Modified: 2013-08-06 21:14 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-08-06 21:14:21 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description langfang 2012-10-28 03:28:06 UTC
Description of problem:

after run wrong command can not use virt-agent commands  anymore

Version-Release number of selected component (if applicable):
host:
# uname -r
2.6.32-336.el6.x86_64
# rpm -q qemu-kvm
qemu-kvm-0.12.1.2-2.331.el6.x86_64

guest:
# uname -r
2.6.32-336.el6.x86_64
qemu-guest-agent-0.12.1.2-2.329.el6.x86_64

How reproducible:

100%

Steps to Reproduce:
1.boot guest with 
-chardev socket,path=/tmp/qga.sock,server,nowait,id=qga0 -device  virtio-serial -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 ...
2.on host

# nc -U /tmp/qga.sock

3. in guest
#service qemu-ga start


 
Actual results:

# nc -U /tmp/qga.sock
{"execute":"guest-ping"}
{"return": {}}
{"execute":"guest-sync", "arguments":{"id":1234}}
{"return": 1234}
{"execute":"guest-file-open", "arguments":{"path":"/tmp/testqga","mode":"r"}}
{"return": 7}
{"execute":"guest-file-open", "arguments":{"path":"/tmp/testqga","mode":"r"}}{"e   ----wrong command                                                                       

{"execute":"guest-ping"}
{"error": {"class": "JSONParsing", "desc": "Invalid JSON syntax", "data": {}}}
{"error": {"class": "JSONParseError", "desc": "JSON parse error, invalid keyword `ing'", "data": {"message": "invalid keyword `ing'"}}}


{"execute":"guest-sync"}
{"error": {"class": "JSONParsing", "desc": "Invalid JSON syntax", "data": {}}}
{"error": {"class": "JSONParseError", "desc": "JSON parse error, invalid keyword `execute'", "data": {"message": "invalid keyword `execute'"}}}
{"error": {"class": "JSONParsing", "desc": "Invalid JSON syntax", "data": {}}}
{"error": {"class": "JSONParseError", "desc": "JSON parse error, invalid keyword `guest'", "data": {"message": "invalid keyword `guest'"}}}
{"error": {"class": "JSONParsing", "desc": "Invalid JSON syntax", "data": {}}}
{"error": {"class": "JSONParseError", "desc": "JSON parse error, invalid keyword `ync'", "data": {"message": "invalid keyword `ync'"}}}
"execute":"guest-ping"}
{"error": {"class": "JSONParsing", "desc": "Invalid JSON syntax", "data": {}}}
{"error": {"class": "JSONParseError", "desc": "JSON parse error, invalid keyword `execute'", "data": {"message": "invalid keyword `execute'"}}}
{"error": {"class": "JSONParsing", "desc": "Invalid JSON syntax", "data": {}}}
{"error": {"class": "JSONParseError", "desc": "JSON parse error, invalid keyword `guest'", "data": {"message": "invalid keyword `guest'"}}}
{"error": {"class": "JSONParsing", "desc": "Invalid JSON syntax", "data": {}}}
{"error": {"class": "JSONParseError", "desc": "JSON parse error, invalid keyword `ing'", "data": {"message": "invalid keyword `ing'"}}}
{"execute":"guest-ping"}
{"error": {"class": "JSONParsing", "desc": "Invalid JSON syntax", "data": {}}}
{"error": {"class": "JSONParseError", "desc": "JSON parse error, invalid keyword `execute'", "data": {"message": "invalid keyword `execute'"}}}
{"error": {"class": "JSONParsing", "desc": "Invalid JSON syntax", "data": {}}}
{"error": {"class": "JSONParseError", "desc": "JSON parse error, invalid keyword `guest'", "data": {"message": "invalid keyword `guest'"}}}
{"error": {"class": "JSONParsing", "desc": "Invalid JSON syntax", "data": {}}}
{"error": {"class": "JSONParseError", "desc": "JSON parse error, invalid keyword `ing'", "data": {"message": "invalid keyword `ing'"}}}

Expected results:


Additional info:

Comment 3 Laszlo Ersek 2013-08-06 21:14:21 UTC
(1) Markus recently submitted cleanups for the JSON parser, if memory serves. I think they might be quite intrusive though, so I'm not sure if we'd want to hazard a backport for such a low prio problem.

(2) The parser is actually *right* here. Maybe not very user friendly, but it is correct. This fragment from comment #0:

> {"execute":"guest-file-open",
> "arguments":{"path":"/tmp/testqga","mode":"r"}}{"e 

first runs a correct command (the guest-file-open), but the second command ends with an unterminated string literal. So it's no wonder the lexer keeps looking for the closing quote that would balance it out to zero depth.

If, at this point, you enter

  {"execute":"guest-ping"}
   ^^^^^^^^^ ^^^^^^^^^^^^
   string    string
   literal   literal

it is actually lexed as

  { "e{" execute ":" guest-ping "}
    ^^^^         ^^^            ^^
    string       string         string
    literal      literal        literal (unterminated)

which is a series of tokens the parser justifiedly refuses as nonsensical.

You can recover from this state by simply closing the original quote, and then the original bracket. This will clean up the lexer's state, draw some further complaints from the parser, but then everything will be fine again:

<enter this> "}
<response>
{"error": {"class": "JSONParsing", "desc": "Invalid JSON syntax", "data": {}}}
{"error": {"class": "JSONParsing", "desc": "Invalid JSON syntax", "data": {}}}

<enter this> {"execute":"guest-ping"}
<response> {"return": {}}

The exact same problem was (mis-)reported earlier as bug 870311 (see bug 870311 comment 8), so I'm closing this one as a duplicate.

*** This bug has been marked as a duplicate of bug 870311 ***


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