Image API v2 image tags broken with E500

Bug #1296589 reported by Erno Kuvaja
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Undecided
Erno Kuvaja

Bug Description

There is set([]) passed to json.dumps() which is not parseable:
 self.func(req, *args, **kwargs)
   File "/usr/lib/python2.7/dist-packages/glance/common/wsgi.py", line 625, in __call__
     request, **action_args)
   File "/usr/lib/python2.7/dist-packages/glance/common/wsgi.py", line 644, in dispatch
     return method(*args, **kwargs)
   File "/usr/lib/python2.7/dist-packages/glance/common/utils.py", line 422, in wrapped
     return func(self, req, *args, **kwargs)
   File "/usr/lib/python2.7/dist-packages/glance/api/v2/image_tags.py",
 line 46, in update
     image_repo.save(image)
   File "/usr/lib/python2.7/dist-packages/glance/domain/proxy.py", line 65, in save
     result = self.base.save(base_item)
   File "/usr/lib/python2.7/dist-packages/glance/domain/proxy.py", line 65, in save
     result = self.base.save(base_item)
   File "/usr/lib/python2.7/dist-packages/glance/notifier/__init__.py", line 140, in save
     super(ImageRepoProxy, self).save(image)
   File
 "/usr/lib/python2.7/dist-packages/glance/domain/proxy.py", line 65, in save
     result = self.base.save(base_item)
   File "/usr/lib/python2.7/dist-packages/glance/api/policy.py", line 186, in save
     return super(ImageRepoProxy, self).save(image)
   File "/usr/lib/python2.7/dist-packages/glance/domain/proxy.py", line 65, in save
     result = self.base.save(base_item)
   File "/usr/lib/python2.7/dist-packages/glance/domain/proxy.py", line 65, in save

 result = self.base.save(base_item)
   File "/usr/lib/python2.7/dist-packages/glance/store/__init__.py", line 398, in save
     result = super(ImageRepoProxy, self).save(image)
   File "/usr/lib/python2.7/dist-packages/glance/domain/proxy.py", line 65, in save
     result = self.base.save(base_item)
   File "/usr/lib/python2.7/dist-packages/glance/db/__init__.py", line 170, in save
     image.tags)
   File "/usr/lib/python2.7/dist-packages/glance/db/registry/api.py", line 59,
 in wrapper
     return func(client, *args, **kwargs)
   File "/usr/lib/python2.7/dist-packages/glance/db/registry/api.py", line 200, in image_tag_set_all
     client.image_tag_set_all(image_id=image_id, tags=tags)
   File "/usr/lib/python2.7/dist-packages/glance/common/rpc.py", line 274, in method_proxy
     return self.do_request(item, **kw)
   File "/usr/lib/python2.7/dist-packages/glance/common/rpc.py", line 240, in do_request
     'kwargs': kwargs}])
   File
 "/usr/lib/python2.7/dist-packages/glance/common/client.py", line 64, in wrapped
     return func(self, *args, **kwargs)
   File "/usr/lib/python2.7/dist-packages/glance/common/rpc.py", line 223, in bulk_request
     body = self._serializer.to_json(commands)
   File "/usr/lib/python2.7/dist-packages/glance/common/wsgi.py", line 577, in to_json
     return json.dumps(data, default=self._sanitizer)
   File "/usr/lib/python2.7/json/__init__.py", line 238, in dumps

 **kw).encode(obj)
   File "/usr/lib/python2.7/json/encoder.py", line 201, in encode
     chunks = self.iterencode(o, _one_shot=True)
   File "/usr/lib/python2.7/json/encoder.py", line 264, in iterencode
     return _iterencode(o, 0)
 ValueError: Circular reference detected

Erno Kuvaja (jokke)
Changed in glance:
assignee: nobody → Erno Kuvaja (jokke)
Revision history for this message
Stuart McLaren (stuart-mclaren) wrote :

Is this always the case? Or is it only when using the v2 registry?

Erno Kuvaja (jokke)
Changed in glance:
status: New → In Progress
Revision history for this message
Erno Kuvaja (jokke) wrote :

This is with registry data_api in use.

Erno Kuvaja (jokke)
description: updated
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/83046

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

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

Reviewed: https://review.openstack.org/83046
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=9a31a64a92054170b48e22ccc5350118f9f68a68
Submitter: Jenkins
Branch: master

commit 9a31a64a92054170b48e22ccc5350118f9f68a68
Author: Erno Kuvaja <email address hidden>
Date: Thu Mar 27 16:32:14 2014 +0000

    Sanitize set passed to jsonutils.dumps()

    Datatype set is not parseable by json.dumps() and will cause
    ValueError. Catching that in _sanitizer and converting to list.

    Change-Id: I9f1374c4268182e8d35e82c5784fb05c7b84c209
    Fixes-Bug: #1296589

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