Glance Content-Range request returns incorrect Content-Length

Bug #1618928 reported by Samuel Lucidi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Undecided
Cyril Roelandt

Bug Description

When using the Glance 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 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.

Revision history for this message
Nikhil Komawar (nikhil-komawar) wrote :

Hi,

thanks for reporting this bug.

can you please specify which stores are configured for your backend storage?

thanks.

Changed in glance:
assignee: nobody → Cyril Roelandt (cyril-roelandt)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

Fix proposed to branch: master
Review: https://review.openstack.org/367370

Changed in glance:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to glance (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/367528

Revision history for this message
Samuel Lucidi (slucidi) wrote :

Hi,

The only store configured for my Glance install is the default file store.

Thanks

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/367528
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=400230cd9d72f00caf6c1d5824da906ea335a1ad
Submitter: Jenkins
Branch: master

commit 400230cd9d72f00caf6c1d5824da906ea335a1ad
Author: Dharini Chandrasekar <email address hidden>
Date: Thu Sep 8 17:03:40 2016 +0000

    Handling HTTP range requests in Glance

    Currently Glance does not send Partial response codes while
    handling HTTP range requests. Also, content length is not
    appropriately set.

    This patch is to send partial response code and to set the correct
    content length based on the range request for image download.

    Upon success status code 206 is sent and the content length is set to the
    requested range.
    Upon failure, there can be 2 cases:
     * If the HTTP range request for the image download is bad (For example,
       requesting download of range of bytes 10 to 50 bytes when there are only 48
       bytes), status code is set to 416 and HTTPRequestRangeNotSatisfiable is
       raised.
     * If the content range is valid, but the request is not satisfiable due to
       glance_store side erros or privacy issues, appropriate exceptions are
       raised.

    APIImpact
    DocImpact

    Closes-Bug: #1417069
    Closes-Bug: #1624508
    Closes-Bug: #1399851
    Closes-Bug: #1618928

    Change-Id: I3cd47b998be79604511b3cd4879209820cf776b7

Changed in glance:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/glance 14.0.0.0b3

This issue was fixed in the openstack/glance 14.0.0.0b3 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on glance (master)

Change abandoned by Cyril Roelandt (<email address hidden>) on branch: master
Review: https://review.openstack.org/367370

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.