500 error when filtering on non-ASCII 'name' value

Bug #1733500 reported by weikeyou
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Invalid
Undecided
Aniketh Girish

Bug Description

When use curl to test image-show interface with Chinese characters, the service return "500 Internal Server Error",and raise error in the api log .For example,

execute the following command:
curl -g -i -X GET http://10.43.203.5:9292/v2/images?name='测试' -H "X-Auth-Token: fe6f6f1688b64d119b89cb8f0e7d3304"

2017-11-21 13:40:42.814 7793 INFO eventlet.wsgi.server [req-179356e7-9aa0-4d23-9f82-6a8d043978b5 - - - - -] Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/eventlet/wsgi.py", line 481, in handle_one_response
    result = self.application(self.environ, start_response)
  File "/usr/lib/python2.7/site-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/site-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/oslo_middleware/base.py", line 126, in __call__
    response = req.get_response(self.application)
  File "/usr/lib/python2.7/site-packages/webob/request.py", line 1317, in send
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/site-packages/webob/request.py", line 1281, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/site-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/site-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/oslo_middleware/base.py", line 126, in __call__
    response = req.get_response(self.application)
  File "/usr/lib/python2.7/site-packages/webob/request.py", line 1317, in send
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/site-packages/webob/request.py", line 1281, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/site-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/site-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/glance/common/wsgi.py", line 602, in __call__
    response = req.get_response(self.application)
  File "/usr/lib/python2.7/site-packages/webob/request.py", line 1317, in send
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/site-packages/webob/request.py", line 1281, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/site-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/site-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/osprofiler/web.py", line 108, in __call__
    return request.get_response(self.application)
  File "/usr/lib/python2.7/site-packages/webob/request.py", line 1317, in send
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/site-packages/webob/request.py", line 1281, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/site-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/site-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/keystonemiddleware/auth_token/__init__.py", line 467, in __call__
    response = req.get_response(self._app)
  File "/usr/lib/python2.7/site-packages/webob/request.py", line 1317, in send
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/site-packages/webob/request.py", line 1281, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/site-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/site-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/glance/common/wsgi.py", line 602, in __call__
    response = req.get_response(self.application)
  File "/usr/lib/python2.7/site-packages/webob/request.py", line 1317, in send
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/site-packages/webob/request.py", line 1281, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/site-packages/paste/urlmap.py", line 205, in __call__
    return app(environ, start_response)
  File "/usr/lib/python2.7/site-packages/webob/dec.py", line 144, in __call__
    return resp(environ, start_response)
  File "/usr/lib/python2.7/site-packages/routes/middleware.py", line 131, in __call__
    response = self.app(environ, start_response)
  File "/usr/lib/python2.7/site-packages/webob/dec.py", line 144, in __call__
    return resp(environ, start_response)
  File "/usr/lib/python2.7/site-packages/webob/dec.py", line 144, in __call__
    return resp(environ, start_response)
TypeError: 'dict' object is not callable

2017-11-21 13:40:42.815 7793 INFO eventlet.wsgi.server [req-179356e7-9aa0-4d23-9f82-6a8d043978b5 - - - - -] 10.43.203.5 - - [21/Nov/2017 13:40:42] "GET /v2/images?name=测试 HTTP/1.1" 500 139 0.484846

weikeyou (weikeyou)
Changed in glance:
assignee: nobody → weikeyou (weikeyou)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

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

Changed in glance:
status: New → In Progress
Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote : Re: image-show interface with Chinese characters return 500 Internal Server Error

Please provide more information. I'm not seeing this behavior in master:

$ curl -s -X POST -H "x-auth-token: $TK" -d '{"name": "瞰形像案卷實驗"}' "$GLANCE/v2/images"
{"status": "queued", "name": "瞰形像案卷實驗", "tags": [], "container_format": null, "created_at": "2018-01-07T22:03:57Z", "size": null, "disk_format": null, "updated_at": "2018-01-07T22:03:57Z", "visibility": "shared", "self": "/v2/images/2ad71d70-9708-421c-8da3-eec88fcc1e63", "min_disk": 0, "protected": false, "id": "2ad71d70-9708-421c-8da3-eec88fcc1e63", "file": "/v2/images/2ad71d70-9708-421c-8da3-eec88fcc1e63/file", "checksum": null, "owner": "f31e7c0b0d46418390768b9d250421e7", "virtual_size": null, "min_ram": 0, "schema": "/v2/schemas/image"}

$ curl -X GET -H "x-auth-token: $TK" "$GLANCE/v2/images?name=瞰形像案卷實驗"
{"images": [{"status": "queued", "name": "瞰形像案卷實驗", "tags": [], "container_format": null, "created_at": "2018-01-07T22:03:57Z", "size": null, "disk_format": null, "updated_at": "2018-01-07T22:03:57Z", "visibility": "shared", "self": "/v2/images/2ad71d70-9708-421c-8da3-eec88fcc1e63", "min_disk": 0, "protected": false, "id": "2ad71d70-9708-421c-8da3-eec88fcc1e63", "file": "/v2/images/2ad71d70-9708-421c-8da3-eec88fcc1e63/file", "checksum": null, "owner": "f31e7c0b0d46418390768b9d250421e7", "virtual_size": null, "min_ram": 0, "schema": "/v2/schemas/image"}], "schema": "/v2/schemas/images", "first": "/v2/images?name=%E7%9E%B0%E5%BD%A2%E5%83%8F%E6%A1%88%E5%8D%B7%E5%AF%A6%E9%A9%97"}

Additionally, I believe according to RFC 3986, the non-ASCII characters are supposed to be URL-encoded (see the value for the "first" element in the image-show response). In any case, I'm not seeing the 500.

Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

Also tried this in an old ocata devstack (doesn't use uwsgi) with pike code, don't see the behavior there either:

$ curl -X POST -H "x-auth-token: $TK" -d '{"name":"瞰形像案卷實驗"}' http://localhost:9292/v2/images
{"status": "queued", "name": "瞰形像案卷實驗", "tags": [], "container_format": null, "created_at": "2018-01-07T22:17:59Z", "size": null, "disk_format": null, "updated_at": "2018-01-07T22:17:59Z", "visibility": "shared", "self": "/v2/images/23fdfc89-7e19-4efa-a130-f01c49b73bce", "min_disk": 0, "protected": false, "id": "23fdfc89-7e19-4efa-a130-f01c49b73bce", "file": "/v2/images/23fdfc89-7e19-4efa-a130-f01c49b73bce/file", "checksum": null, "owner": "25ef0baf2a6a4e2c9e714d745921b566", "virtual_size": null, "min_ram": 0, "schema": "/v2/schemas/image"}

$ curl -X GET -H "x-auth-token: $TK" "http://localhost:9292/v2/images?name=瞰形像案卷實驗"
{"images": [{"status": "queued", "name": "瞰形像案卷實驗", "tags": [], "container_format": null, "created_at": "2018-01-07T22:17:59Z", "size": null, "disk_format": null, "updated_at": "2018-01-07T22:17:59Z", "visibility": "shared", "self": "/v2/images/23fdfc89-7e19-4efa-a130-f01c49b73bce", "min_disk": 0, "protected": false, "id": "23fdfc89-7e19-4efa-a130-f01c49b73bce", "file": "/v2/images/23fdfc89-7e19-4efa-a130-f01c49b73bce/file", "checksum": null, "owner": "25ef0baf2a6a4e2c9e714d745921b566", "virtual_size": null, "min_ram": 0, "schema": "/v2/schemas/image"}], "schema": "/v2/schemas/images", "first": "/v2/images?name=%E7%9E%B0%E5%BD%A2%E5%83%8F%E6%A1%88%E5%8D%B7%E5%AF%A6%E9%A9%97"}

Changed in glance:
status: In Progress → Incomplete
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on glance (master)

Change abandoned by weikeyou (<email address hidden>) on branch: master
Review: https://review.openstack.org/528459

Changed in glance:
assignee: weikeyou (weikeyou) → Aniketh Girish (aniketh01)
Changed in glance:
status: Incomplete → Invalid
Revision history for this message
Aniketh Girish (aniketh01) wrote : Re: image-show interface with Chinese characters return 500 Internal Server Error

Tested out with both curl and devstack. Neither am I able to find such an abnormality. Hence, this is an invalid bug report.

curl -X POST -H "x-auth-token: $TK" -d '{"name":"卷實驗"}' http://192.168.122.166/image
{"versions": [{"status": "CURRENT", "id": "v2.5", "links": [{"href": "http://192.168.122.166/image/v2/", "rel": "self"}]}, {"status": "SUPPORTED", "id": "v2.4", "links": [{"href": "http://192.168.122.166/image/v2/", "rel": "self"}]}, {"status": "SUPPORTED", "id": "v2.3", "links": [{"href": "http://192.168.122.166/image/v2/", "rel": "self"}]}, {"status": "SUPPORTED", "id": "v2.2", "links": [{"href": "http://192.168.122.166/image/v2/", "rel": "self"}]}, {"status": "SUPPORTED", "id": "v2.1", "links": [{"href": "http://192.168.122.166/image/v2/", "rel": "self"}]}, {"status": "SUPPORTED", "id": "v2.0", "links": [{"href": "http://192.168.122.166/image/v2/", "rel": "self"}]}]}

summary: - image-show interface with Chinese characters return 500 Internal Server
- Error
+ 500 error when filtering on non-ASCII 'name' value
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.