Circular reference serializing InstanceTypeNotFound

Bug #1175414 reported by Andrew Laski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Andrew Laski

Bug Description

During server creation, if an instance type is disabled an InstanceTypeNotFound is raised. This is caught in nova/api/openstack/compute/servers.py and the exception is stuffed into a HTTPBadRequest. Because the exception is put in there and not the exception message, when the wsgi layer tries to serialize it it results in:

2013-05-02 01:24:20.157 DEBUG nova.api.openstack.wsgi [req-9e8649fa-902d-4edc-99ba-cf1f88291bac demo demo] Calling method <bound method Controller.create of <nova.api.openstack.compute.servers.Controller object at 0x3efb890>> from (pid=16849) _process_stack /opt/stack/nova/nova/api/openstack/wsgi.py:920
2013-05-02 01:24:20.172 INFO nova.api.openstack.wsgi [req-9e8649fa-902d-4edc-99ba-cf1f88291bac demo demo] HTTP exception thrown: Instance type 2 could not be found.
2013-05-02 01:24:20.172 DEBUG nova.api.openstack.wsgi [req-9e8649fa-902d-4edc-99ba-cf1f88291bac demo demo] Returning 400 to user: Instance type 2 could not be found. from (pid=16849) __call__ /opt/stack/nova/nova/api/openstack/wsgi.py:1173
2013-05-02 01:24:20.172 ERROR nova.api.openstack [req-9e8649fa-902d-4edc-99ba-cf1f88291bac demo demo] Caught error: Circular reference detected
2013-05-02 01:24:20.172 TRACE nova.api.openstack Traceback (most recent call last):
2013-05-02 01:24:20.172 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/__init__.py", line 81, in __call__
2013-05-02 01:24:20.172 TRACE nova.api.openstack return req.get_response(self.application)
2013-05-02 01:24:20.172 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
2013-05-02 01:24:20.172 TRACE nova.api.openstack application, catch_exc_info=False)
2013-05-02 01:24:20.172 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
2013-05-02 01:24:20.172 TRACE nova.api.openstack app_iter = application(self.environ, start_response)
2013-05-02 01:24:20.172 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-05-02 01:24:20.172 TRACE nova.api.openstack return resp(environ, start_response)
2013-05-02 01:24:20.172 TRACE nova.api.openstack File "/opt/stack/python-keystoneclient/keystoneclient/middleware/auth_token.py", line 451, in __call__
2013-05-02 01:24:20.172 TRACE nova.api.openstack return self.app(env, start_response)
2013-05-02 01:24:20.172 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-05-02 01:24:20.172 TRACE nova.api.openstack return resp(environ, start_response)
2013-05-02 01:24:20.172 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-05-02 01:24:20.172 TRACE nova.api.openstack return resp(environ, start_response)
2013-05-02 01:24:20.172 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-05-02 01:24:20.172 TRACE nova.api.openstack return resp(environ, start_response)
2013-05-02 01:24:20.172 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__
2013-05-02 01:24:20.172 TRACE nova.api.openstack response = self.app(environ, start_response)
2013-05-02 01:24:20.172 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-05-02 01:24:20.172 TRACE nova.api.openstack return resp(environ, start_response)
2013-05-02 01:24:20.172 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-05-02 01:24:20.172 TRACE nova.api.openstack return resp(environ, start_response)
2013-05-02 01:24:20.172 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
2013-05-02 01:24:20.172 TRACE nova.api.openstack resp = self.call_func(req, *args, **self.kwargs)
2013-05-02 01:24:20.172 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
2013-05-02 01:24:20.172 TRACE nova.api.openstack return self.func(req, *args, **kwargs)
2013-05-02 01:24:20.172 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 1195, in __call__
2013-05-02 01:24:20.172 TRACE nova.api.openstack self.wrapped_exc.body = serializer.serialize(fault_data)
2013-05-02 01:24:20.172 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 321, in serialize
2013-05-02 01:24:20.172 TRACE nova.api.openstack return self.dispatch(data, action=action)
2013-05-02 01:24:20.172 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 186, in dispatch
2013-05-02 01:24:20.172 TRACE nova.api.openstack return action_method(*args, **kwargs)
2013-05-02 01:24:20.172 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 331, in default
2013-05-02 01:24:20.172 TRACE nova.api.openstack return jsonutils.dumps(data)
2013-05-02 01:24:20.172 TRACE nova.api.openstack File "/opt/stack/nova/nova/openstack/common/jsonutils.py", line 149, in dumps
2013-05-02 01:24:20.172 TRACE nova.api.openstack return json.dumps(value, default=default, **kwargs)
2013-05-02 01:24:20.172 TRACE nova.api.openstack File "/usr/lib/python2.7/json/__init__.py", line 238, in dumps
2013-05-02 01:24:20.172 TRACE nova.api.openstack **kw).encode(obj)
2013-05-02 01:24:20.172 TRACE nova.api.openstack File "/usr/lib/python2.7/json/encoder.py", line 201, in encode
2013-05-02 01:24:20.172 TRACE nova.api.openstack chunks = self.iterencode(o, _one_shot=True)
2013-05-02 01:24:20.172 TRACE nova.api.openstack File "/usr/lib/python2.7/json/encoder.py", line 264, in iterencode
2013-05-02 01:24:20.172 TRACE nova.api.openstack return _iterencode(o, 0)
2013-05-02 01:24:20.172 TRACE nova.api.openstack ValueError: Circular reference detected
2013-05-02 01:24:20.172 TRACE nova.api.openstack

The exception has a format_message() method for this, it just needs to be used.

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

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

Changed in nova:
assignee: nobody → Andrew Laski (alaski)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/28002
Committed: http://github.com/openstack/nova/commit/051cf0d756d9a9e1d0a5ea1169fa97d89b7885bc
Submitter: Jenkins
Branch: master

commit 051cf0d756d9a9e1d0a5ea1169fa97d89b7885bc
Author: Andrew Laski <email address hidden>
Date: Wed May 1 21:30:52 2013 -0400

    Call format_message on InstanceTypeNotFound exception

    Put the exception message from InstanceTypeNotFound into the
    HTTPBadRequest rather than the exception itself. Prevents a Circular
    reference error during serialization later.

    Bug 1175414

    Change-Id: I4811e727311af670cd964a6d16ac5fce0fe3186e

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/grizzly)

Fix proposed to branch: stable/grizzly
Review: https://review.openstack.org/28076

Thierry Carrez (ttx)
Changed in nova:
milestone: none → havana-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-1 → 2013.2
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.