← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1069979] Re: v2 API: image create and update return HTTP 500

 

** Changed in: glance
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1069979

Title:
  v2 API: image create and update return HTTP 500

Status in OpenStack Image Registry and Delivery Service (Glance):
  Fix Released

Bug description:
  Any request that performs a notification in v2 of the API fails with
  an HTTP 500. This is because the image object received from the db has
  the _sa_instance_state attribute which is not JSON serializable. So
  when the notifier is called it fails with the following traceback.  In
  most cases however, the actual change in data is performed since
  notification calls generally happen last.

  Traceback (most recent call last):
    File "/usr/local/lib/python2.7/dist-packages/eventlet/wsgi.py", line 382, in handle_one_response
      result = self.application(self.environ, start_response)
    File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
      resp = self.call_func(req, *args, **self.kwargs)
    File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
      return self.func(req, *args, **kwargs)
    File "/opt/stack/glance/glance/common/wsgi.py", line 332, in __call__
      response = req.get_response(self.application)
    File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in get_response
      application, catch_exc_info=False)
    File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in call_application
      app_iter = application(self.environ, start_response)
    File "/opt/stack/keystone/keystone/middleware/auth_token.py", line 278, in __call__
      return self.app(env, start_response)
    File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
      resp = self.call_func(req, *args, **self.kwargs)
    File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
      return self.func(req, *args, **kwargs)
    File "/opt/stack/glance/glance/common/wsgi.py", line 332, in __call__
      response = req.get_response(self.application)
    File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in get_response
      application, catch_exc_info=False)
    File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in call_application
      app_iter = application(self.environ, start_response)
    File "/usr/lib/python2.7/dist-packages/paste/urlmap.py", line 203, in __call__
      return app(environ, start_response)
    File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 159, in __call__
      return resp(environ, start_response)
    File "/usr/lib/pymodules/python2.7/routes/middleware.py", line 131, in __call__
      response = self.app(environ, start_response)
    File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 159, in __call__
      return resp(environ, start_response)
    File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
      resp = self.call_func(req, *args, **self.kwargs)
    File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
      return self.func(req, *args, **kwargs)
    File "/opt/stack/glance/glance/common/wsgi.py", line 538, in __call__
      request, **action_args)
    File "/opt/stack/glance/glance/common/wsgi.py", line 555, in dispatch
      return method(*args, **kwargs)
    File "/opt/stack/glance/glance/common/utils.py", line 408, in wrapped
      return func(self, req, *args, **kwargs)
    File "/opt/stack/glance/glance/api/v2/images.py", line 109, in create
      self.notifier.info('image.update', image)
    File "/opt/stack/glance/glance/notifier/__init__.py", line 83, in info
      self.strategy.info(msg)
    File "/opt/stack/glance/glance/notifier/notify_kombu.py", line 221, in info
      self._notify(msg, "INFO")
    File "/opt/stack/glance/glance/notifier/notify_kombu.py", line 195, in _notify
      self._send_message(msg, routing_key)
    File "/opt/stack/glance/glance/notifier/notify_kombu.py", line 176, in _send_message
      msg = self.exchange.Message(json.dumps(msg),
    File "/usr/lib/python2.7/json/__init__.py", line 231, in dumps
      return _default_encoder.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)
    File "/usr/lib/python2.7/json/encoder.py", line 178, in default
      raise TypeError(repr(o) + " is not JSON serializable")
  TypeError: <sqlalchemy.orm.state.InstanceState object at 0x2d56110> is not JSON serializable

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1069979/+subscriptions