Image fails to upload to swift: TypeError: object of type 'CooperativeReader' has no len(

Bug #1057322 reported by Sam Morrison
62
This bug affects 10 people
Affects Status Importance Assigned to Milestone
Glance
Fix Released
High
Mark Washenberger
Folsom
Fix Released
High
Sam Morrison
Grizzly
Fix Released
High
Mark Washenberger
Ubuntu Cloud Archive
Fix Released
High
Unassigned
glance (Ubuntu)
Fix Released
High
Unassigned
Quantal
Fix Released
High
Unassigned

Bug Description

Get the following error when trying to upload an image using the swift backend:

2012-09-27 16:55:19 16190 DEBUG glance.store.swift [-] Adding image object '9af41b5a-f4a2-40bb-9344-10b75fb14459' to Swift add /usr/lib/python2.7/dist-packages/glance/store/swift.py:457
2012-09-27 16:55:20 16190 ERROR glance.api.v1.images [-] Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/glance/api/v1/images.py", line 437, in _upload
    image_meta['size'])
  File "/usr/lib/python2.7/dist-packages/glance/store/swift.py", line 464, in add
    content_length=image_size)
  File "/usr/lib/python2.7/dist-packages/swiftclient/client.py", line 1048, in put_object
    headers=headers)
  File "/usr/lib/python2.7/dist-packages/swiftclient/client.py", line 950, in _retry
    rv = func(self.url, self.token, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/swiftclient/client.py", line 803, in put_object
    conn.request('PUT', path, contents, headers)
  File "/usr/lib/python2.7/httplib.py", line 958, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 992, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 954, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 818, in _send_output
    self.send(message_body)
  File "/usr/lib/python2.7/httplib.py", line 790, in send
    self.sock.sendall(data)
  File "/usr/lib/python2.7/dist-packages/eventlet/greenio.py", line 283, in sendall
    tail = self.send(data, flags)
  File "/usr/lib/python2.7/dist-packages/eventlet/greenio.py", line 265, in send
    len_data = len(data)
TypeError: object of type 'CooperativeReader' has no len()

Not sure if the bug is in swift/glance, looks like incompatibilities in supporting libraries.

glance-api:
  Installed: 2012.2~rc1-0ubuntu1~cloud0
python-swiftclient:
  Installed: 1:1.1.1-0ubuntu1~cloud0
python-eventlet:
  Installed: 0.9.17-0ubuntu1~cloud0
python2.7:
  Installed: 2.7.3-0ubuntu3.1

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in glance (Ubuntu):
status: New → Confirmed
Revision history for this message
Sam Morrison (sorrison) wrote :

Still an issue with

glance-api 2012.2-0ubuntu1~cloud0

Revision history for this message
Ondergetekende (kvdveer) wrote :

More details here.
http://<email address hidden>/msg16973.html

Changed in glance:
status: New → Confirmed
assignee: nobody → Armando Migliaccio (armando-migliaccio)
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/15241

Changed in glance:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Changed in glance:
assignee: Armando Migliaccio (armando-migliaccio) → stelford (stef-ummon)
Chuck Short (zulcss)
Changed in cloud-archive:
status: New → Confirmed
Revision history for this message
Stuart Stent (stuart-stent) wrote :

Affects cents 6.0 as well

Brian Waldon (bcwaldon)
Changed in glance:
importance: Undecided → High
milestone: none → grizzly-1
Changed in glance:
assignee: stelford (stef-ummon) → Mark Washenberger (markwash)
Brian Waldon (bcwaldon)
Changed in glance:
milestone: grizzly-1 → grizzly-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

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

Reviewed: https://review.openstack.org/16574
Committed: http://github.com/openstack/glance/commit/5daed10fc3c7a0bbf55c8e7407ceea2c86135f95
Submitter: Jenkins
Branch: master

commit 5daed10fc3c7a0bbf55c8e7407ceea2c86135f95
Author: Mark J. Washenberger <email address hidden>
Date: Tue Nov 20 12:41:48 2012 -0800

    Make cooperative reader always support read()

    glance.common.utils.CooperativeReader provides eventlet-friendly
    cooperation on top of backends that support either read() or __iter__().
    However, in the case of backends that only support __iter__(), such as
    images returned by store.get(...), read() is not defined. This patch
    adds read() in all cases.

    Fixes bug 1057322.

    Change-Id: I67d9b3e4d93fbefd7eeaf7cfc947ab635fe09534

Changed in glance:
status: In Progress → Fix Committed
Sam Morrison (sorrison)
tags: added: folsom-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (stable/folsom)

Fix proposed to branch: stable/folsom
Review: https://review.openstack.org/16931

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

Reviewed: https://review.openstack.org/16931
Committed: http://github.com/openstack/glance/commit/91aaa487d34ed57718f0183b27e79c02ac70941e
Submitter: Jenkins
Branch: stable/folsom

commit 91aaa487d34ed57718f0183b27e79c02ac70941e
Author: Mark J. Washenberger <email address hidden>
Date: Tue Nov 20 12:41:48 2012 -0800

    Make cooperative reader always support read()

    glance.common.utils.CooperativeReader provides eventlet-friendly
    cooperation on top of backends that support either read() or __iter__().
    However, in the case of backends that only support __iter__(), such as
    images returned by store.get(...), read() is not defined. This patch
    adds read() in all cases.

    Fixes bug 1057322.

    Change-Id: I67d9b3e4d93fbefd7eeaf7cfc947ab635fe09534

Changed in glance (Ubuntu):
status: Confirmed → Fix Released
Changed in glance (Ubuntu Quantal):
status: New → Confirmed
Revision history for this message
Sina Sadeghi (sina-sa) wrote :

Guys will the fix for this bug ever make it back into the Ubuntu Cloud Archive?

Revision history for this message
Clint Byrum (clint-fewbar) wrote : Please test proposed package

Hello Sam, or anyone else affected,

Accepted glance into quantal-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/glance/2012.2.1-0ubuntu1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in glance (Ubuntu Quantal):
status: Confirmed → Fix Committed
tags: added: verification-needed
Thierry Carrez (ttx)
Changed in glance:
status: Fix Committed → Fix Released
James Page (james-page)
Changed in cloud-archive:
importance: Undecided → High
Changed in glance (Ubuntu):
importance: Undecided → High
Changed in glance (Ubuntu Quantal):
importance: Undecided → High
Mark McLoughlin (markmc)
tags: removed: folsom-backport-potential
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package glance - 2012.2.1-0ubuntu1

---------------
glance (2012.2.1-0ubuntu1) quantal-proposed; urgency=low

  * Dropped patches, applied upstream:
    - debian/patches/CVE-2012-4573.patch
    - debian/patches/CVE-2012-4573b.patch
  * Resynchronize with stable/folsom (199783ce) (LP: #1085255):
    - [49408e9] Glance image-delete HTTPInternalServerError HTTP 500
      (LP: #1075580)
    - [91aaa48] Image fails to upload to swift: TypeError: object of type
      'CooperativeReader' has no len( (LP: #1057322)
    - [a296a5b] Return 403 when admin deletes a deleted image (LP: #1060944)
    - [3e58a6a] Disallow updating deleted images. (LP: #1060930)
    - [26c8085] admins can see deleted images in v2 api (LP: #1071446)
    - [8321ca6] No exclude option to skip tests in run_tests.sh (LP: #1065758)
    - [c3bea11] Badly named stable/folsom Glance tarballs (LP: #1059634)
    - [fc0ee76] Non-admin users can cause public glance images to be deleted
      from the backend storage repository in the v2 api (LP: #1076506)
    - [90bcdc5] Non-admin users can cause public glance images to be deleted
      from the backend storage repository (LP: #1065187)
    - [7841cc9] FakeAuth not always admin
    - [ddad275] Jenkins jobs fail because of incompatibility between sqlalchemy-
      migrate and the newest sqlalchemy-0.8.0b1 (LP: #1073569)
    - [1d5c651] nosetest options cause no such option errors (LP: #1056420)
    - [ac223e2] Set defaultbranch in .gitreview to stable/folsom
 -- Adam Gandelman <email address hidden> Tue, 04 Dec 2012 09:19:35 -0800

Changed in glance (Ubuntu Quantal):
status: Fix Committed → Fix Released
Changed in cloud-archive:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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