Bug 990566

Summary: QMP: possible memory leaks on commands failure
Product: Red Hat Enterprise Linux 7 Reporter: Luiz Capitulino <lcapitulino>
Component: qemu-kvmAssignee: Luiz Capitulino <lcapitulino>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: acathrow, bsarathy, juzhang, lcapitulino, mazhang, mkenneth, qzhang, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-1.5.3-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 990316 Environment:
Last Closed: 2014-06-13 13:20:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 990316    
Bug Blocks:    

Description Luiz Capitulino 2013-07-31 13:15:29 UTC
+++ This bug was initially created as a clone of Bug #990316 +++

Description of problem:

A number of QMP commands will possibly leak memory on failure because the release of QAPI structures is skipped on failure.

Version-Release number of selected component (if applicable): qemu-kvm-0.12.1.2-2.382.el6 (and previous)


How reproducible:

As the leak is usually small, it's hard to see. Maybe you could write a script to send the following command:

{ "execute": "dump-guest-memory", "arguments": { "protocol": "/a/a", "paging": false } }

To QMP in a loop for dozens of minutes and watch for an RSS increase, but more important than trying to reproduce this issue is to make sure that we're not breaking existing commands.

Comment 1 Luiz Capitulino 2013-09-30 20:20:21 UTC
The rebase to QEMU 1.5.3 brought the fix for this issue in (commit aa83f2e42), moving to ON_QA.

Comment 2 mazhang 2014-01-06 07:58:02 UTC
Hi Luiz,

This bug was a clone of bz990316 on rhel6, But I can't reproduce it on rhel7 as the steps bz990316 provided. Not found RSS increase with issuing following command 100 times. 
    { "execute": "dump-guest-memory", "arguments": { "protocol": "/a/a", "paging": false } }

Is there any other way to reproduce and verify this bug?

Thanks,
Mazhang.

Comment 3 Luiz Capitulino 2014-01-06 14:20:11 UTC
This one is a bit hard to reliably reproduce in practice. What I suggest you to do is to test the following commands:

o __com.redhat_block-commit
o transaction
o blockdev-snapshot-sync
o __com.redhat_drive-reopen
o __com.redhat_drive-mirror
o dump-guest-memory
o chardev-add/remove

Test regular usage (success and some errors conditions as well). If they work as expected, then you can consider this bz verified.

Comment 5 juzhang 2014-01-10 09:43:14 UTC
(In reply to Luiz Capitulino from comment #3)
> This one is a bit hard to reliably reproduce in practice. What I suggest you
> to do is to test the following commands:
> 
> o __com.redhat_block-commit
> o transaction
> o blockdev-snapshot-sync
> o __com.redhat_drive-reopen
> o __com.redhat_drive-mirror
> o dump-guest-memory
> o chardev-add/remove
> 
> Test regular usage (success and some errors conditions as well). If they
> work as expected, then you can consider this bz verified.

Hi Mazhang,

Could you have a try and update the result in the bz?

Best Regards,
Junyi

Comment 6 mazhang 2014-01-24 09:42:14 UTC
(In reply to juzhang from comment #5)
> (In reply to Luiz Capitulino from comment #3)
> > This one is a bit hard to reliably reproduce in practice. What I suggest you
> > to do is to test the following commands:
> > 
> > o __com.redhat_block-commit
> > o transaction
> > o blockdev-snapshot-sync
> > o __com.redhat_drive-reopen
> > o __com.redhat_drive-mirror
> > o dump-guest-memory
> > o chardev-add/remove
> > 
> > Test regular usage (success and some errors conditions as well). If they
> > work as expected, then you can consider this bz verified.
> 
> Hi Mazhang,
> 
> Could you have a try and update the result in the bz?
> 
> Best Regards,
> Junyi

Update latest qemu-kvm and test this bug.

Host:
qemu-kvm-rhev-1.5.3-39.el7.x86_64
kernel-3.10.0-78.el7.x86_64

Guest:
kernel-3.10.0-64.el7.x86_64

Result:
{"execute":"dump-guest-memory","arguments":{"paging": false,"protocol":"file:/tmp/guest-memory"}}
{"timestamp": {"seconds": 1390553164, "microseconds": 550373}, "event": "STOP"}
{"timestamp": {"seconds": 1390553174, "microseconds": 952832}, "event": "RESUME"}
{"return": {}}
{"execute":"dump-guest-memory","arguments":{"paging": False,"protocol":"file:/tmp/guest-memory1"}}
{"error": {"class": "GenericError", "desc": "Invalid JSON syntax"}}
{"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": "Expected 'object' in QMP input"}}
{"execute":"chardev-add","arguments":{"id":"channel0","backend":{"type":"socket","data":{"addr": {"type":"unix", "data": {"path": "/tmp/mm"}}}}}}
{"return": {}}
{"execute":"chardev-remove","arguments":{"id":"channel0"}}
{"return": {}}
{"execute":"chardev-add","arguments":{"id":"channel0","backend":{"type":"socketsocket","data":{"addr": {"type":"unix", "data": {"path": "/tmp/mm"}}}}}}
{"error": {"class": "GenericError", "desc": "Invalid parameter 'socketsocket'"}}
{ "execute": "drive-mirror", "arguments": { "device": "drive-virtio-disk0", "target": "/root/sn1", "format": "qcow2", "mode": "absolute-paths", "sync": "full", "speed": 1000000000, "on-source-error": "stop", "on-target-error": "stop" } }
{"return": {}}
{"return": {}}
{ 'execute': 'transaction', 'arguments':
  {'actions': [
    { 'type': 'blockdev-snapshot-sync', 'data' :
      { 'device': 'drive-virtio-disk0', 'snapshot-file': '/home/sn-1-1.qcow2', 'format': 'qcow2' } },
    { 'type': 'blockdev-snapshot-sync', 'data' :
      { 'device': 'drive-virtio-disk1', 'snapshot-file': '/home/sn-2-1.qcow2', 'format': 'qcow2' } } ] } }

{ 'execute': 'transaction', 'arguments':
  {'actions': [
    { 'type': 'blockdev-snapshot-sync', 'data' :
      { 'device': 'drive-virtio-disk0', 'snapshot-file': '/home/sn-1-2.qcow2', 'format': 'qcow2' } },
    { 'type': 'blockdev-snapshot-sync', 'data' :
      { 'device': 'drive-virtio-disk1', 'snapshot-file': '/home/sn-2-2.qcow2', 'format': 'qcow2' } } ] } }
{"return": {}}
{"return": {}}
{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "drive-virtio-disk0", "snapshot-file": "/root/sn4", "format": "qcow2" } }
{"return": {}}
{ "execute": "block-commit", "arguments": { "device": "drive-virtio-disk0", "base": "/root/sn1", "top": "/root/sn3", "speed": 1000000000 } }
{"return": {}}

All above command works expected, this bug has been fixed.

Comment 8 Ludek Smid 2014-06-13 13:20:15 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.