Bug 790350 - qemu-img hits core dumped with error "qcow2_cache_destroy: Assertion" when does "qemu-img convert ........"
Summary: qemu-img hits core dumped with error "qcow2_cache_destroy: Assertion" when do...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm
Version: 6.3
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: rc
: ---
Assignee: Kevin Wolf
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-14 10:19 UTC by juzhang
Modified: 2013-01-10 00:43 UTC (History)
11 users (show)

Fixed In Version: qemu-kvm-0.12.1.2-2.238.el6
Doc Type: Bug Fix
Doc Text:
No Documentation Needed
Clone Of:
Environment:
Last Closed: 2012-06-20 11:43:22 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0746 0 normal SHIPPED_LIVE qemu-kvm bug fix and enhancement update 2012-06-19 19:31:48 UTC

Description juzhang 2012-02-14 10:19:34 UTC
Description of problem:
core dumped with error "qcow2_cache_destroy: Assertion" when does "qemu-img convert ........"

Version-Release number of selected component (if applicable):
#rpm -qa | grep qemu-kvm
qemu-kvm-0.12.1.2-2.227.el6.x86_64
qemu-kvm-debuginfo-0.12.1.2-2.227.el6.x86_64
qemu-kvm-tools-0.12.1.2-2.227.el6.x86_64


How reproducible:
100&

Steps to Reproduce:
1.#cat blkdebug.cfg
[inject-error]
event = "l2_update_compressed"
errno = "28"
immediately = "off"
2.qemu-img create -f qcow2 -o cluster_size=512 sourcecompress.qcow2 10G
3.qemu-io blkdebug:blkdebug.cfg:sourcecompress.qcow2 -c "write 0 64M"
4.qemu-img convert -c -f qcow2 -O qcow2 sourcecompress.qcow2 compressed.qcow2
5.qemu-io blkdebug:blkdebug.cfg:compressed.qcow2 -c "write 0 64M"
6.qemu-img convert -c -f qcow2 -O qcow2 sourcecompress.qcow2 blkdebug:blkdebug.cfg:compressed.qcow2
qemu-img: block/qcow2-cache.c:69: qcow2_cache_destroy: Assertion `c->entries[i].ref == 0' failed.
Aborted (core dumped)
  
Actual results:
after step6
qemu-img: block/qcow2-cache.c:69: qcow2_cache_destroy: Assertion `c->entries[i].ref == 0' failed.
Aborted (core dumped)
#qemu-img check blkdebug:blkdebug.cfg:compressed.qcow2
ERROR refcount block 8189 is outside image
ERROR refcount block 8190 is outside image
ERROR refcount block 8191 is outside image
8192 errors were found on the image.
Data may be corrupted, or further writes to the image may corrupt it.
1028 internal errors have occurred during the check.
An error has occurred during the check: Success
 The check is not complete and may have missed error.

Expected results:
Finish converting or trigger event named "l2_update_compressed"

Additional info:

Comment 1 Kevin Wolf 2012-03-02 15:41:26 UTC
Posted a patch that fixes the assertion. Won't fix that qemu-img convert and check don't work well with blkdebug.

Comment 4 Golita Yue 2012-03-22 06:06:48 UTC
Hi Kevin Wolf, 

Tested this bug in qemu-kvm-0.12.1.2-2.251.el6.x86_64 with comment#0 steps, didn't hit core dump:
1. After run step6, the result is:
# qemu-img convert -c -f qcow2 -O qcow2 sourcecompress.qcow2 blkdebug:blkdebug.cfg:compressed.qcow2
qemu-img: error while compressing sector 0

But hit core dump in our autotest installation testing with the same error information:
(qemu) qemu: block/qcow2-cache.c:69: qcow2_cache_destroy: Assertion `c->entries[i].ref == 0' failed.
Does that is the same bug?

The installation test case run:
1. install a guest
2. confime the installation complete successfully
3. run postprocess task
   a). shutdown the guest
   b). check image file

The log info as following:
03/21 15:06:58 INFO | Guest reported successful installation after 7m 1.65891098976s
03/21 15:06:58 DEBUG| Postprocessing VM 'vm1'...
03/21 15:06:58 DEBUG| 'kill_vm' specified; killing VM...
03/21 15:06:58 DEBUG| Destroying VM with PID 22012...
03/21 15:06:58 DEBUG| Trying to kill VM with monitor command...
03/21 15:06:58 DEBUG| Send command: {'execute': 'quit', 'id': 'iJZQCPE9'}
03/21 15:06:58 INFO | (qemu) qemu: block/qcow2-cache.c:69: qcow2_cache_destroy: Assertion `c->entries[i].ref == 0' failed.
03/21 15:07:02 DEBUG| Send command: {'execute': 'query-status', 'id': 'ozD1q3ai'}
03/21 15:07:03 DEBUG| Timeout elapsed
03/21 15:07:03 DEBUG| Cannot quit normally; sending a kill to close the deal...
03/21 15:07:04 INFO | (qemu) (Process terminated with status 0)
03/21 15:07:04 DEBUG| VM is down
03/21 15:07:04 DEBUG| Running '/usr/local/staf/test/RHEV/kvm-new/autotest/client/tests/kvm/qemu-img info /usr/local/staf/test/RHEV/kvm-new/autotest/client/tests/kvm/images/RHEL-Server-5.7-64.qcow2'
03/21 15:07:04 DEBUG| [stdout] image: /usr/local/staf/test/RHEV/kvm-new/autotest/client/tests/kvm/images/RHEL-Server-5.7-64.qcow2
03/21 15:07:05 DEBUG| [stdout] file format: qcow2
03/21 15:07:05 DEBUG| [stdout] virtual size: 20G (21474836480 bytes)
03/21 15:07:05 DEBUG| [stdout] disk size: 3.1G
03/21 15:07:05 DEBUG| [stdout] cluster_size: 65536
03/21 15:07:05 DEBUG| Running '/usr/local/staf/test/RHEV/kvm-new/autotest/client/tests/kvm/qemu-img check /usr/local/staf/test/RHEV/kvm-new/autotest/client/tests/kvm/images/RHEL-Server-5.7-64.qcow2'
03/21 15:07:39 ERROR| [stdout] 77 errors were found on the image.
03/21 15:07:39 ERROR| [stdout] Data may be corrupted, or further writes to the image may corrupt it.
03/21 15:07:39 ERROR| [stdout] 
03/21 15:07:39 ERROR| [stdout] 50461 leaked clusters were found on the image.
03/21 15:07:39 ERROR| [stdout] This means waste of disk space, but no harm to data.
03/21 15:07:39 ERROR| [stdout] 
03/21 15:07:39 ERROR| [stdout] 30 internal errors have occurred during the check.
03/21 15:07:39 ERROR| [stdout] 
03/21 15:07:39 ERROR| [stdout] An error has occurred during the check: Success
03/21 15:07:39 ERROR| [stdout] The check is not complete and may have missed error.

Comment 5 langfang 2012-04-06 08:01:01 UTC
Reproduced this issue with steps and  environment as follows:
version:
# uname -r
2.6.32-257.el6.x86_64
#uname -r |grep qemu-kvm
qemu-kvm-0.12.1.2-2.204.el6.x86_64

steps:
1.create file 
#cat blkdebug.cfg
[inject-error]
event = "l2_update_compressed"
errno = "28"
immediately = "off"
2.qemu-img create -f qcow2 -o cluster_size=512 sourcecompress.qcow2 10G
3.qemu-io blkdebug:blkdebug.cfg:sourcecompress.qcow2 -c "write 0 64M"
4.qemu-img convert -c -f qcow2 -O qcow2 sourcecompress.qcow2 compressed.qcow2
5.qemu-io blkdebug:blkdebug.cfg:compressed.qcow2 -c "write 0 64M"
6.qemu-img convert -c -f qcow2 -O qcow2 sourcecompress.qcow2
blkdebug:blkdebug.cfg:compressed.qcow2
qemu-img: block/qcow2-cache.c:69: qcow2_cache_destroy: Assertion
`c->entries[i].ref == 0' failed.
Aborted 

 step 7:
#qemu-img check blkdebug:blkdebug.cfg:compressed.qcow2
...
ERROR refcount block 8160 is outside image
ERROR refcount block 8161 is outside image
ERROR refcount block 8162 is outside image
ERROR refcount block 8163 is outside image
ERROR refcount block 8164 is outside image
ERROR refcount block 8165 is outside image
ERROR refcount block 8166 is outside image
ERROR refcount block 8167 is outside image
ERROR refcount block 8168 is outside image
ERROR refcount block 8169 is outside image
...
8192 errors were found on the image.
Data may be corrupted, or further writes to the image may corrupt it.

1028 internal errors have occurred during the check.

An error has occurred during the check: Success
The check is not complete and may have missed error.


verify this issue with steps(as same as reproduce) and  environment as follows:
# uname -r
2.6.32-257.el6.x86_64
# rpm -qa |grep qemu-kvm
qemu-kvm-0.12.1.2-2.262.el6.x86_64

steps:
1)
2)
3)
4)
5)
6)#qemu-img convert -c -f qcow2 -O qcow2 sourcecompress.qcow2 blkdebug:blkdebug.cfg:compressed.qcow2
qemu-img: error while compressing sector 0: Input/output error

so ,this issue has been fixed.

Comment 8 Michal Novotny 2012-05-04 10:05:34 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
[NEEDINFO: Kevin, could you please add it using CCFR pattern? Thanks!]

Comment 10 Kevin Wolf 2012-05-07 08:45:54 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-[NEEDINFO: Kevin, could you please add it using CCFR pattern? Thanks!]+No Documentation Needed

Comment 11 errata-xmlrpc 2012-06-20 11:43:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0746.html


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