← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1612485] [NEW] 500 Error is returned when specifying string that is partial matched to "application/json" as format of HTTP header.

 

Public bug reported:

Currently, 'get_content_type' method in neutron/wsgi.py checks
specified format by 'in' statement.
Thus, string that is partial matched to 'application/json' is judged as valid.
However, we cannot find valid serializer from the format.

request
===========================
ubuntu@neutron-ml2:/opt/stack/neutron$ curl -g -i -X GET http://172.16.1.29:9696/v2.0/networks -H "X-Auth-Token: $TOKEN" -H "Content-type: ppli"
HTTP/1.1 500 Internal Server Error
Content-Length: 114
Content-Type: text/plain; charset=UTF-8
X-Openstack-Request-Id: req-c82ae85b-dbec-49ae-ad1f-d1104c437acd
Date: Fri, 12 Aug 2016 03:18:14 GMT

500 Internal Server Error

The server has either erred or is incapable of performing the requested operation.
=============================

trace in neutron-server
=============================
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors Traceback (most recent call last):
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/oslo_middleware/catch_errors.py", line 38, in __call__
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     response = req.get_response(self.application)
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1299, in send
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     application, catch_exc_info=False)
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1263, in call_application
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     app_iter = application(self.environ, start_response)
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     resp = self.call_func(req, *args, **self.kwargs)
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     return self.func(req, *args, **kwargs)
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/keystonemiddleware/auth_token/__init__.py", line 331, in
 __call__
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     response = req.get_response(self._app)
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1299, in send
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     application, catch_exc_info=False)
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1263, in call_application
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     app_iter = application(self.environ, start_response)
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     return resp(environ, start_response)
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     return resp(environ, start_response)
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/routes/middleware.py", line 141, in __call__
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     response = self.app(environ, start_response)
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     return resp(environ, start_response)
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     return resp(environ, start_response)
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/routes/middleware.py", line 141, in __call__
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     response = self.app(environ, start_response)
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     return resp(environ, start_response)
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     resp = self.call_func(req, *args, **self.kwargs)
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     return self.func(req, *args, **kwargs)
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/opt/stack/neutron/neutron/api/v2/resource.py", line 97, in resource
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     body = serializer.serialize(result)
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors AttributeError: 'NoneType' object has no attribute 'serialize'
2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors
2016-08-12 03:18:14.262 13757 INFO neutron.wsgi [req-c82ae85b-dbec-49ae-ad1f-d1104c437acd b3ec23ec52144d7e96696abef028a5b0 7dbb594bc59546f6b26ad73da253c90a - - -] 172.16.1.29 - - [12/Aug/2016 03:18:14] "GET /v2.0/networks HTTP/1.1" 500 317 0.680435
===============================

** Affects: neutron
     Importance: Undecided
     Assignee: Kengo Hobo (hobo-kengo)
         Status: New

** Changed in: neutron
     Assignee: (unassigned) => Kengo Hobo (hobo-kengo)

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

Title:
  500 Error is returned when specifying string that is partial matched
  to "application/json" as format of HTTP header.

Status in neutron:
  New

Bug description:
  Currently, 'get_content_type' method in neutron/wsgi.py checks
  specified format by 'in' statement.
  Thus, string that is partial matched to 'application/json' is judged as valid.
  However, we cannot find valid serializer from the format.

  request
  ===========================
  ubuntu@neutron-ml2:/opt/stack/neutron$ curl -g -i -X GET http://172.16.1.29:9696/v2.0/networks -H "X-Auth-Token: $TOKEN" -H "Content-type: ppli"
  HTTP/1.1 500 Internal Server Error
  Content-Length: 114
  Content-Type: text/plain; charset=UTF-8
  X-Openstack-Request-Id: req-c82ae85b-dbec-49ae-ad1f-d1104c437acd
  Date: Fri, 12 Aug 2016 03:18:14 GMT

  500 Internal Server Error

  The server has either erred or is incapable of performing the requested operation.
  =============================

  trace in neutron-server
  =============================
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors Traceback (most recent call last):
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/oslo_middleware/catch_errors.py", line 38, in __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     response = req.get_response(self.application)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1299, in send
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     application, catch_exc_info=False)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1263, in call_application
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     app_iter = application(self.environ, start_response)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     resp = self.call_func(req, *args, **self.kwargs)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     return self.func(req, *args, **kwargs)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/keystonemiddleware/auth_token/__init__.py", line 331, in
   __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     response = req.get_response(self._app)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1299, in send
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     application, catch_exc_info=False)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1263, in call_application
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     app_iter = application(self.environ, start_response)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     return resp(environ, start_response)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     return resp(environ, start_response)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/routes/middleware.py", line 141, in __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     response = self.app(environ, start_response)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     return resp(environ, start_response)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     return resp(environ, start_response)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/routes/middleware.py", line 141, in __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     response = self.app(environ, start_response)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     return resp(environ, start_response)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     resp = self.call_func(req, *args, **self.kwargs)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     return self.func(req, *args, **kwargs)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/opt/stack/neutron/neutron/api/v2/resource.py", line 97, in resource
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     body = serializer.serialize(result)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors AttributeError: 'NoneType' object has no attribute 'serialize'
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors
  2016-08-12 03:18:14.262 13757 INFO neutron.wsgi [req-c82ae85b-dbec-49ae-ad1f-d1104c437acd b3ec23ec52144d7e96696abef028a5b0 7dbb594bc59546f6b26ad73da253c90a - - -] 172.16.1.29 - - [12/Aug/2016 03:18:14] "GET /v2.0/networks HTTP/1.1" 500 317 0.680435
  ===============================

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


Follow ups