Potential codec errors during rescheduling operations

Bug #1359427 reported by Joe Cropper
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Joe Cropper

Bug Description

In the compute manager's 'retry' logic (i.e., handling RescheduledException) in _build_and_run_instance, it has a catch-all case for all exceptions and sets reason=str(e). This works well in most cases, but for cases in which lower level code may generate locale-specific messages, it's possible to see the "UnicodeEncodeError: 'ascii' codec can't encode character..." error, which ultimately masks the message in the compute logs, etc.

It also means the instance won't be rescheduled as it fails with an error similar to...

WARNING nova.compute.manager [req-7fe662b1-c947-4303-b43f-114fbdafe875 None] [instance: 333474eb-dd07-4e05-b920-787da0fd5b32] Unexpected build failure, not rescheduling build.
(i.e., as a result of the UnicodeEncodeError previously mentioned)

The simple solution is to use six.text_type(e) instead of str(e).

Tags: compute i18n
Joe Cropper (jwcroppe)
Changed in nova:
assignee: nobody → Joe Cropper (jwcroppe)
description: updated
Joe Cropper (jwcroppe)
description: updated
Joe Cropper (jwcroppe)
description: updated
Joe Cropper (jwcroppe)
Changed in nova:
status: New → In Progress
Matt Riedemann (mriedem)
tags: added: compute i18n
Joe Cropper (jwcroppe)
description: updated
Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :

Looks like the review is this one - https://review.openstack.org/#/c/115846/

Changed in nova:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/115846
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=9f1f9a8b6fadbba2eb6733e0f13b727f14a52a3f
Submitter: Jenkins
Branch: master

commit 9f1f9a8b6fadbba2eb6733e0f13b727f14a52a3f
Author: Joe Cropper <email address hidden>
Date: Wed Aug 20 21:18:17 2014 -0500

    Handle non-ascii characters in spawn exception msg

    If a compute driver's spawn function returns an exception whose text
    has any non-ascii characters (e.g., for globalization), the compute
    manager's "reschedule logic" doesn't handle it properly as it runs
    the text through the str() function, which causes UnicodeEncodeError
    exceptions.

    This simply sends the exception text through six.text_type so as to
    no longer blow up and proceed with rescheduling as intended.

    Closes-Bug: #1359427

    Change-Id: I3fef783feffbe99c6971543c881e3fce2b60693b

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → juno-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-3 → 2014.2
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.