← Back to team overview

registry team mailing list archive

[Bug 686438] [NEW] Cannot create image: Json Circular reference detected

 

Public bug reported:

When trying to play around with 'glance' and create an image I am keep
getting a :

Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/eventlet/wsgi.py", line 336, in handle_one_response
    result = self.application(self.environ, start_response)
  File "/usr/local/lib/python2.6/dist-packages/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/usr/lib/pymodules/python2.6/routes/middleware.py", line 131, in __call__
    response = self.app(environ, start_response)
  File "/usr/local/lib/python2.6/dist-packages/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/usr/local/lib/python2.6/dist-packages/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/lib/python2.6/dist-packages/webob/dec.py", line 208, in call_func
    return self.func(req, *args, **kwargs)
  File "/home/chmouel/GIT/glance/glance/common/wsgi.py", line 217, in __call__
    return self._serialize(result, req)
  File "/home/chmouel/GIT/glance/glance/common/wsgi.py", line 229, in _serialize
    return serializer.to_content_type(data)
  File "/home/chmouel/GIT/glance/glance/common/wsgi.py", line 259, in to_content_type
    return self._methods.get(mimetype, repr)(data)
  File "/home/chmouel/GIT/glance/glance/common/wsgi.py", line 268, in _to_json
    return json.dumps(data, default=sanitizer)
  File "/usr/lib/python2.6/json/__init__.py", line 237, in dumps
    **kw).encode(obj)
  File "/usr/lib/python2.6/json/encoder.py", line 367, in encode
    chunks = list(self.iterencode(o))
  File "/usr/lib/python2.6/json/encoder.py", line 309, in _iterencode
    for chunk in self._iterencode_dict(o, markers):
  File "/usr/lib/python2.6/json/encoder.py", line 275, in _iterencode_dict
    for chunk in self._iterencode(value, markers):
  File "/usr/lib/python2.6/json/encoder.py", line 317, in _iterencode
    for chunk in self._iterencode_default(o, markers):
  File "/usr/lib/python2.6/json/encoder.py", line 315, in _iterencode
    raise ValueError("Circular reference detected")
ValueError: Circular reference detected

Something along those lines would fix it : (since we were trying to
serialize a non serializable object)

=== modified file 'glance/parallax/controllers.py'
--- glance/parallax/controllers.py	2010-12-02 20:19:26 +0000
+++ glance/parallax/controllers.py	2010-12-07 10:57:59 +0000
@@ -108,6 +108,9 @@
         try:
             new_image = db.image_create(context, image_data)
             return dict(image=new_image)
+            n = {'image' : dict(new_image)}
+            del(n['image']['_sa_instance_state'])
+            return n
         except exception.Duplicate:
             return exc.HTTPConflict()
         except exception.Invalid:

Let me know if that seems to be good enough and I'll do a merge
request..

** Affects: glance
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Registry
Administrators, which is subscribed to OpenStack.
https://bugs.launchpad.net/bugs/686438

Title:
  Cannot create image: Json Circular reference detected



Follow ups

References