swiftclient should check response before upload

Bug #1298283 reported by Amala Basha
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-swiftclient
In Progress
Undecided
Amala Basha

Bug Description

Scenario:

1. swiftclient receives a request to upload an image
2. swiftclient obtains an auth token
3. upload of the image commences are multiple chunks.
4. mid way the orignal auth token expires.
5. swiftclient attempts to upload the next chunk with the same auth token
6. Upload fails with a 401 after attempting to upload the entire chunk.

Proposed solution:

1. Fire a HEAD call before the actual PUT call with the same headers.
2. If the status returned is a 401, refetch the auth token and retry.
3. Upload the remaining chunks with the new token.

Amala Basha (amalabasha)
Changed in python-swiftclient:
assignee: nobody → Amala Basha (amalabasha)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-swiftclient (master)

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

Changed in python-swiftclient:
status: New → In Progress
Revision history for this message
clayg (clay-gerrard) wrote :

I think an extra request in the put_object function is definitely the wrong approach. The top level functions are ment to be fairly thin wrappers around the direct REST API, retry and auth logic belongs in the Connection class.

Does a 401 on PUT somehow not result in a ClientException already? It definitely should.

I know the Connection classes retry method already handles reauth - but I'm guessing some how it's interaction is missed on segmented upload from the swift cli?

Revision history for this message
Amala Basha (amalabasha) wrote :

Left the comment on the patch.

Revision history for this message
clayg (clay-gerrard) wrote :

"""The point here is not that the chunk upload is not able to process the reauth. The point is it tries it after it tries to upload an entire chunk. The HEAD call sort of acts as a fast failing mechanism which will refetch the token and retry. Something like a 100-continue would have served this purpose, but unfortunately requests doesn' t support that yet."""

-- Amala

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

Change abandoned by John Dickinson (<email address hidden>) on branch: master
Review: https://review.openstack.org/83330
Reason: Abandoning due to lack of change since the last negative review. If you'd like to keep working on this, you can restore the change.

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.