404 and accept 'application/xml' causes 500 response

Bug #1065234 reported by Meynard Alconis
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Undecided
wanglong

Bug Description

When requesting a resource which does not exist and expecting a 404 Keystone returns a 500 with a stack trace. This happens when the request 'accept' header is set as 'application/xml'

curl localhost:5000/v2.0/someting -v -H "accept:application/xml"
* About to connect() to localhost port 5000 (#0)
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 5000 (#0)
> GET /v2.0/someting HTTP/1.1
> User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6
> Host: localhost:5000
> accept:application/xml
>
< HTTP/1.1 500 Internal Server Error
< Content-Type: text/plain
< Content-Length: 2447
< Date: Wed, 10 Oct 2012 19:37:24 GMT
< Connection: close
<
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/eventlet/wsgi.py", line 382, in handle_one_response
    result = self.application(self.environ, start_response)
  File "/usr/local/lib/python2.6/dist-packages/paste/urlmap.py", line 203, in __call__
    return app(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 "/usr/local/lib/python2.6/dist-packages/keystone-2013.1-py2.6.egg/keystone/common/wsgi.py", line 323, in __call__
    response = request.get_response(self.application)
  File "/usr/local/lib/python2.6/dist-packages/webob/request.py", line 1053, in get_response
    application, catch_exc_info=False)
  File "/usr/local/lib/python2.6/dist-packages/webob/request.py", line 1022, in call_application
    app_iter = application(self.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 "/usr/local/lib/python2.6/dist-packages/keystone-2013.1-py2.6.egg/keystone/common/wsgi.py", line 323, in __call__
    response = request.get_response(self.application)
  File "/usr/local/lib/python2.6/dist-packages/webob/request.py", line 1053, in get_response
    application, catch_exc_info=False)
  File "/usr/local/lib/python2.6/dist-packages/webob/request.py", line 1022, in call_application
    app_iter = application(self.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 "/usr/local/lib/python2.6/dist-packages/keystone-2013.1-py2.6.egg/keystone/common/wsgi.py", line 324, in __call__
    return self.process_response(request, response)
  File "/usr/local/lib/python2.6/dist-packages/keystone-2013.1-py2.6.egg/keystone/middleware/core.py", line 151, in process_response
    raise exception.Error(message=response.body)
Error: 404 Not Found The resource could not be found.

wanglong (long-wang)
Changed in keystone:
assignee: nobody → wanglong (long-wang)
status: New → In Progress
wanglong (long-wang)
Changed in keystone:
status: In Progress → Confirmed
wanglong (long-wang)
Changed in keystone:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

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

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

Reviewed: https://review.openstack.org/14519
Committed: http://github.com/openstack/keystone/commit/eb6681fca927b3296bbc43ee0fec6d034e83cbea
Submitter: Jenkins
Branch: master

commit eb6681fca927b3296bbc43ee0fec6d034e83cbea
Author: long-wang <email address hidden>
Date: Mon Oct 15 15:25:33 2012 +0800

    Fix Not Found error, when router not match.

    Fixes bug 1065234

    when the router not match, keystone should return 404 error with
    json format or xml format. Not the webob.exc.HTTPNotFound() in
    html format.

    Change-Id: I88e873b65db5df8393c0bb22db0e98712d77e350

Changed in keystone:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in keystone:
milestone: none → grizzly-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in keystone:
milestone: grizzly-1 → 2013.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.