ceilometer.api.middleware improperly sets an integer Content-Length header

Bug #1306963 reported by Ryan Petrello
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
High
Ryan Petrello
Icehouse
Won't Fix
Undecided
Unassigned

Bug Description

Ceilometer's error message parsing middleware calculates the custom error message length and sets an appropriate Content-Length header. It does this, however, by setting an integer value for the header, not a string.

Some pure Python WSGI servers in particular aren't strict and violate the WSGI specification by automatically converting the value to a string. Apache, however, does not. This results in an error when running ceilometer behind Apache for e.g., 404 errors:

[Tue Apr 08 22:45:18 2014] [error] [client 127.0.0.1] mod_wsgi (pid=21955): Exception occurred processing WSGI script '/some/path/ceilometer/api/app.wsgi'.
[Tue Apr 08 22:45:18 2014] [error] [client 127.0.0.1] TypeError: expected byte string object for header value, value of type int found

Revision history for this message
Ryan Petrello (ryan-petrello) wrote :

This came about as a result of a Pecan bug report on our mailing list:

https://groups.google.com/forum/#!msg/pecan-dev/Y275PSiMR3I/NdEdzS1sSdgJ

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

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

Changed in ceilometer:
assignee: nobody → Ryan Petrello (ryan-petrello)
status: New → In Progress
Changed in ceilometer:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (master)

Reviewed: https://review.openstack.org/87084
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=381d9ba941e93386000dd29b9426358efb7713f7
Submitter: Jenkins
Branch: master

commit 381d9ba941e93386000dd29b9426358efb7713f7
Author: Ryan Petrello <email address hidden>
Date: Sat Apr 12 08:00:33 2014 -0700

    Fix a response header bug in the error middleware

    Coerce the Content-Length of the custom error message to a string, not an
    integer. Some pure Python WSGI servers aren't strict and violate the WSGI
    specification by automatically converting the value to a string. Apache,
    however, *is* strict, and considers this a 500 Internal Error

    Fixes bug 1306963

    Change-Id: I9b82ceee096b00c21c3b230dc67701bc40629968

Changed in ceilometer:
status: In Progress → Fix Committed
Eoghan Glynn (eglynn)
Changed in ceilometer:
milestone: none → juno-1
Thierry Carrez (ttx)
Changed in ceilometer:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ceilometer (stable/icehouse)

Fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/126441

Thierry Carrez (ttx)
Changed in ceilometer:
milestone: juno-1 → 2014.2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (stable/icehouse)

Reviewed: https://review.openstack.org/126441
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=2a546acf22bc99c61277c370baa8a773baf3f68d
Submitter: Jenkins
Branch: stable/icehouse

commit 2a546acf22bc99c61277c370baa8a773baf3f68d
Author: Ryan Petrello <email address hidden>
Date: Sat Apr 12 08:00:33 2014 -0700

    Fix a response header bug in the error middleware

    Coerce the Content-Length of the custom error message to a string, not an
    integer. Some pure Python WSGI servers aren't strict and violate the WSGI
    specification by automatically converting the value to a string. Apache,
    however, *is* strict, and considers this a 500 Internal Error

    Fixes bug 1306963

    Change-Id: I9b82ceee096b00c21c3b230dc67701bc40629968
    (cherry picked from commit 381d9ba941e93386000dd29b9426358efb7713f7)

tags: added: in-stable-icehouse
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.