serialize_args throws UnicodeError when message contains non-ascii characters

Bug #1493947 reported by Matt Rabe
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Matt Rabe

Bug Description

The EventReporter attempts to serialize exception messages and raises another error in doing so if the message contains non-ascii characters, masking the original exception.

   File "/usr/lib/python2.7/dist-packages/nova/exception.py", line 89, in wrapped
     payload)
   File "/usr/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 119, in __exit__
     six.reraise(self.type_, self.value, self.tb)
   File "/usr/lib/python2.7/dist-packages/nova/exception.py", line 72, in wrapped
     return f(self, context, *args, **kw)
   File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 349, in decorated_function
     LOG.warning(msg, e, instance_uuid=instance_uuid)
   File "/usr/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 119, in __exit__
     six.reraise(self.type_, self.value, self.tb)
   File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 320, in decorated_function
     return function(self, context, *args, **kwargs)
   File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 399, in decorated_function
     return function(self, context, *args, **kwargs)
   File "/usr/lib/python2.7/dist-packages/nova/compute/utils.py", line 492, in __exit__
     exc_tb=exc_tb, want_result=False)
   File "/usr/lib/python2.7/dist-packages/nova/objects/base.py", line 487, in wrapper
     kwargs[k] = str(v)
   File "/usr/lib/python2.7/dist-packages/oslo_i18n/_message.py", line 167, in __str__
     raise UnicodeError(msg)
 UnicodeError: Message objects do not support str() because they may contain non-ascii characters. Please use unicode() or translate() instead.

Found in Liberty

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

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

Changed in nova:
assignee: nobody → Matt Rabe (mdrabe)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit c4d30dbdc50309c5f95eb630840c3c32b4e96c8f
Author: Matt Rabe <email address hidden>
Date: Wed Sep 9 20:29:57 2015 +0200

    Use six.text_type instead of str in serialize_args

    The EventReporter serializes any exception messages in
    the event of a failure. If the message contains non-ascii
    characters the string translation throws another exception
    masking the original.

    Change-Id: I13d277b803bcbcf010d42bbebe7eea61642be21a
    Closes-Bug: #1493947

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