Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1371197 - Glance v2 Image Data API responds to Content-Range request with wrong Content-Length header
Glance v2 Image Data API responds to Content-Range request with wrong Content...
Status: CLOSED ERRATA
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-glance (Show other bugs)
8.0 (Liberty)
All Linux
unspecified Severity unspecified
: Upstream M3
: 11.0 (Ocata)
Assigned To: Cyril Roelandt
nlevinki
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-08-29 10:28 EDT by Sam Lucidi
Modified: 2017-05-17 15:32 EDT (History)
10 users (show)

See Also:
Fixed In Version: 14.0.0-2
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-05-17 15:32:31 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Launchpad 1618928 None None None 2016-08-31 10:47 EDT
OpenStack gerrit 367528 None None None 2016-09-13 09:38 EDT
Red Hat Product Errata RHEA-2017:1245 normal SHIPPED_LIVE Red Hat OpenStack Platform 11.0 Bug Fix and Enhancement Advisory 2017-05-17 19:01:50 EDT

  None (edit)
Description Sam Lucidi 2016-08-29 10:28:54 EDT
Description of problem:
When using the Glance image data API's Content-Range support to partially download an image, the server sets a Content-Length header equal to the size of the full image, rather than the size of the chunk specified by the requested Content-Range. This causes clients to wait indefinitely for the server.

Version-Release number of selected component (if applicable):
It at least affects Glance 11.0.1

Steps to Reproduce:
1. Make an authenticated GET request to /v2/images/<some_image_id>/file with
   the Content-Range header set to some value smaller than the entire length
   of the image.
2. Wait

Actual results:
Server returns a Content-Length header equal to the length of the whole image but only transmitting the requested bytes. The client waits indefinitely for the server to continue sending.

Expected results:
Server returns a Content-Length header equal to the number of bytes in the chunk, so that the client can know to disconnect.

Additional info:
If you manually specify the Connection: close header rather than using the default Connection: keep-alive, the server terminates the connection after sending the right amount of bytes, although it still sends the wrong Content-Length header.
Comment 2 Erno Kuvaja 2016-08-30 01:58:11 EDT
By the looks of it, the error happens here [0] when the range is specified.

[0] https://github.com/openstack/glance/blob/master/glance/api/v2/image_data.py#L320
Comment 3 Flavio Percoco 2016-08-30 05:09:54 EDT
According to the Content-Range RFC, the Content-Length should be equal to the number of bytes transmitted, in this case it'd be the size of the chunk: https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

Can this please be reported upstream and fixed there?
Comment 4 Francesco Vollero 2016-08-30 07:48:37 EDT
I agree, must be filled upstream, but we should also have a way to track it here so please after you open the bug, add here the bug id on the external bug tracker.

@Flavio
If not given the range in the correct form, should not just return 412 Precondition Failed and exit?
Comment 5 Sam Lucidi 2016-08-31 10:47:08 EDT
I've reported a bug upstream and added the bug ID here.
Comment 7 Cyril Roelandt 2016-09-13 09:38:18 EDT
I'm on it :)
Comment 8 Tzu-Mainn Chen 2016-09-19 17:08:41 EDT
Out of curiosity, is it possible to somehow tell through the API whether or not the version of Glance v2 contains the fix or not?  We're trying to figure out the best way to have our code support both OpenStacks with and without the fix.
Comment 9 Elise Gafford 2016-11-01 13:13:01 EDT
No recent progress on this issue. Moving to RHOS 11 for triage.
Comment 11 Cyril Roelandt 2017-03-21 12:31:24 EDT
The fix seems to be in stable/ocata upstream, and in our downstream packages as well, so let's push this to QA.
Comment 12 Avi Avraham 2017-03-27 02:09:42 EDT
verified 
RPM : openstack-glance-14.0.0-2.el7ost.noarch
image was successfully downloaded
Comment 14 errata-xmlrpc 2017-05-17 15:32:31 EDT
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.

https://access.redhat.com/errata/RHEA-2017:1245

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