Bug 1013643

Summary: Glance download is not interrupted when the InputStream is closed
Product: Red Hat Enterprise Virtualization Manager Reporter: Federico Simoncelli <fsimonce>
Component: openstack-java-sdkAssignee: Federico Simoncelli <fsimonce>
Status: CLOSED CURRENTRELEASE QA Contact: Elad <ebenahar>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 3.3.0CC: abaron, acathrow, alonbl, amureini, fsimonce, iheim, lpeer, Rhev-m-bugs, scohen, yeylon
Target Milestone: ---Flags: abaron: Triaged+
Target Release: 3.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: storage
Fixed In Version: is24 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-21 22:17:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1019461, 1038284    

Description Federico Simoncelli 2013-09-30 13:54:16 UTC
Description of problem:
It is impossible to abruptly close the InputStream used to download a glance image, in fact when close() is called the entire image is downloaded before shutting down the tcp connection.

This is a serious issue for applications such as rhevm-backend that are using the InputStream to inspect the QCOW2 header in order to discover the image virtual size.

Even more since resteasy (shipped in jboss) is using the SelfExpandingBufferredInputStream under the hood I also suspect that the entire image is not only downloaded but also cached in memory (leading to out of memory crashes).

Version-Release number of selected component (if applicable):
openstack-java-sdk-3.0.0-1.el6ev

How reproducible:
100%

Steps to Reproduce:
1. Import a large (>~2Gb) QCOW2 glance image from rhev webadmin (or rest api)

Actual results:
The entire image is downloaded (from the engine backend); the canDoAction validation takes a long time (inspecting the image virtual size).

Expected results:
Only the initial part of the image should be downloaded (resulting in a quick canDoAction and no memory usage).

Additional info:
This bug should be moved to openstack-java-sdk as soon as it will appear in the components list.

Comment 1 Federico Simoncelli 2013-09-30 13:55:18 UTC
A fix has been proposed upstream:

https://github.com/simon3z/openstack-java-sdk/commit/c4f9cbefd618be11562e41a076d3a3501f7db0fe

Comment 3 Elad 2013-12-17 12:59:58 UTC
The CanDoAction validation takes a short time (1 sec) when downloading a QCOW2 image (3G in size) 

Verified on is27

Comment 4 Itamar Heim 2014-01-21 22:17:30 UTC
Closing - RHEV 3.3 Released

Comment 5 Itamar Heim 2014-01-21 22:24:03 UTC
Closing - RHEV 3.3 Released