error 400 message is being truncated

Bug #1335807 reported by Removed by request
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Sirushti Murugesan
python-heatclient
Invalid
Low
Neetu Jain

Bug Description

error 400 messages are being truncated.

Running a command via CLI that will result in a 400 response code (malformed) will be truncated:
ERROR: The server could not comply with the request since

The error with --debug:

DEBUG (connectionpool:295) "POST /v1/5cf47dbd372e48f796cd9d59fee1a1ed/stacks HTTP/1.1" 400 283

HTTP/1.1 400 Bad Request
date: Mon, 30 Jun 2014 09:46:08 GMT
content-length: 283
content-type: application/json; charset=UTF-8

{"explanation": "The server could not comply with the request since\r\nit is either malformed or otherwise incorrect.\r\n", "code": 400, "error": {"message": "The server could not comply with the request since\r", "traceback": null, "type": "HTTPBadRequest"}, "title": "Bad Request"}

DEBUG (http:122)
HTTP/1.1 400 Bad Request
date: Mon, 30 Jun 2014 09:46:08 GMT
content-length: 283
content-type: application/json; charset=UTF-8

{"explanation": "The server could not comply with the request since\r\nit is either malformed or otherwise incorrect.\r\n", "code": 400, "error": {"message": "The server could not comply with the request since\r", "traceback": null, "type": "HTTPBadRequest"}, "title": "Bad Request"}

Traceback (most recent call last):
  File "/usr/bin/heat", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/heatclient/shell.py", line 432, in main
    HeatShell().main(args)
  File "/usr/lib/python2.7/site-packages/heatclient/shell.py", line 388, in main
    args.func(client, args)
  File "/usr/lib/python2.7/site-packages/heatclient/v1/shell.py", line 111, in do_stack_create
    hc.stacks.create(**fields)
  File "/usr/lib/python2.7/site-packages/heatclient/v1/stacks.py", line 119, in create
    data=kwargs, headers=headers)
  File "/usr/lib/python2.7/site-packages/heatclient/common/http.py", line 235, in json_request
    resp = self._http_request(url, method, **kwargs)
  File "/usr/lib/python2.7/site-packages/heatclient/common/http.py", line 196, in _http_request
    raise exc.from_response(resp)
heatclient.exc.HTTPBadRequest: ERROR: The server could not comply with the request since

Revision history for this message
Removed by request (removed3381998) wrote :

Forgot to mention, this is tested with:
python-heatclient-0.2.9-1.el7ost.noarch

Revision history for this message
Sirushti Murugesan (sirushtim) wrote :

So I did some debugging. The fault middleware seems to truncate messages based on the newline character.

Revision history for this message
Sirushti Murugesan (sirushtim) wrote :

Which means a message like "The server could not comply with the request since\r\nit is either malformed or otherwise incorrect.\r\n" will get truncated to "The server could not comply with the request since\r" as seen above.

Changed in heat:
assignee: nobody → Sirushti Murugesan (sirushtim)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

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

Changed in heat:
status: New → In Progress
Changed in heat:
importance: Undecided → Medium
status: In Progress → Triaged
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/104068
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=240468e9ecbac3fc1045f36b0da5eb93d9c9055d
Submitter: Jenkins
Branch: master

commit 240468e9ecbac3fc1045f36b0da5eb93d9c9055d
Author: Sirushti Murugesan <email address hidden>
Date: Wed Jul 2 01:31:49 2014 +0530

    Avoid truncating API Response

    Removes unnecessary escape characters from an exception message so that
    it does not get truncated by the fault middleware in the wsgi pipeline.

    Closes-Bug: #1335807
    Change-Id: I20281042e617199b1f5a0507c56adca6a6dc601f

Changed in heat:
status: Triaged → Fix Committed
Changed in heat:
milestone: none → juno-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: juno-2 → 2014.2
Zane Bitter (zaneb)
tags: added: icehouse-backport-potential
Changed in python-heatclient:
assignee: nobody → Jillala Srinivas Reddy (srinivasreddy-j-o)
Changed in python-heatclient:
status: New → In Progress
Changed in python-heatclient:
importance: Undecided → Low
Changed in python-heatclient:
assignee: Jillala Srinivas Reddy (srinivasreddy-j-o) → nobody
Revision history for this message
Neetu Jain (nutshi) wrote :

 fix done in Heat should solve the issue in python client as well ..right ?

Changed in python-heatclient:
assignee: nobody → Neetu Jain (nutshi)
Revision history for this message
Neetu Jain (nutshi) wrote :

please correct me if i am wrong but i think this bug is not applicable for python-heatclient.
I looked into the code as well.
Should i go ahead and mark it closed/fixed/N/A ?

Changed in python-heatclient:
status: In Progress → Invalid
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.