Glance logs 500 internal error when client disconnects during upload

Bug #1196953 reported by Paul Bourke
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Undecided
Paul Bourke

Bug Description

If a user ^C 's the client during a chunked image upload, eventlet.wsgi.server will raise one of ValueError or IOError when trying to read the next chunk.

This results in the following type of tracebacks in the api log:

2013-07-02 12:37:16.057 10222 ERROR glance.api.v1.upload_utils [a35eb7a1-d1ea-41cf-9752-13aa999defe1
 4910be49bb594a8bb625488d2847bbd6 6c6d09cd051c4fc589d700624df40ef9] Failed to upload image
2013-07-02 12:37:16.057 10222 TRACE glance.api.v1.upload_utils Traceback (most recent call last):
2013-07-02 12:37:16.057 10222 TRACE glance.api.v1.upload_utils File "/opt/stack/glance/glance/api/
v1/upload_utils.py", line 87, in upload_data_to_store
2013-07-02 12:37:16.057 10222 TRACE glance.api.v1.upload_utils image_meta['size'])
2013-07-02 12:37:16.057 10222 TRACE glance.api.v1.upload_utils File "/opt/stack/glance/glance/stor
e/filesystem.py", line 236, in add
2013-07-02 12:37:16.057 10222 TRACE glance.api.v1.upload_utils ChunkedFile.CHUNKSIZE):
2013-07-02 12:37:16.057 10222 TRACE glance.api.v1.upload_utils File "/opt/stack/glance/glance/comm
on/utils.py", line 74, in chunkiter
2013-07-02 12:37:16.057 10222 TRACE glance.api.v1.upload_utils chunk = fp.read(chunk_size)
2013-07-02 12:37:16.057 10222 TRACE glance.api.v1.upload_utils File "/opt/stack/glance/glance/comm
on/utils.py", line 106, in readfn
2013-07-02 12:37:16.057 10222 TRACE glance.api.v1.upload_utils result = fd.read(*args)
2013-07-02 12:37:16.057 10222 TRACE glance.api.v1.upload_utils File "/usr/lib/python2.7/dist-packa
ges/eventlet/wsgi.py", line 149, in read
2013-07-02 12:37:16.057 10222 TRACE glance.api.v1.upload_utils return self._chunked_read(self.rf
ile, length)
2013-07-02 12:37:16.057 10222 TRACE glance.api.v1.upload_utils File "/usr/lib/python2.7/dist-packa
ges/eventlet/wsgi.py", line 139, in _chunked_read
2013-07-02 12:37:16.057 10222 TRACE glance.api.v1.upload_utils self.chunk_length = int(rfile.rea
dline().split(";", 1)[0], 16)
2013-07-02 12:37:16.057 10222 TRACE glance.api.v1.upload_utils ValueError: invalid literal for int()
 with base 16: ''

These errors should probably be caught and handled more appropriately.

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/35286

Changed in glance:
assignee: nobody → Paul Bourke (pauldbourke)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/35286
Committed: http://github.com/openstack/glance/commit/3904860467d87c74c046974963070e029a89ba5e
Submitter: Jenkins
Branch: master

commit 3904860467d87c74c046974963070e029a89ba5e
Author: Paul Bourke <email address hidden>
Date: Thu Jun 27 11:38:00 2013 +0000

    Handle client disconnect during image upload

    If a user does a ^C during a chunked image upload, eventlet.wsgi.server
    will raise one of ValueError or IOError when trying to read the next
    chunk.

    Handle this common scenario by raising(logging) a HTTPBadRequest error rather
    than HTTPInternalServerError.

    Fixes bug 1196953

    Change-Id: Ic88b142a40c548141be4b40a15f94b71603814e9

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
milestone: none → havana-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: havana-3 → 2013.2
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.