Bug 1281940
Summary: | Unicode decoding and encoding errors when mixing unicode and utf8 encoded strings | ||
---|---|---|---|
Product: | [oVirt] vdsm | Reporter: | Nir Soffer <nsoffer> |
Component: | Core | Assignee: | Nir Soffer <nsoffer> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | Gonza <grafuls> |
Severity: | high | Docs Contact: | |
Priority: | unspecified | ||
Version: | 4.17.11 | CC: | bugs, danken, nsoffer, oourfali, pkliczew, rmcswain, sbonazzo, ybronhei, ylavi |
Target Milestone: | ovirt-3.6.2 | Flags: | oourfali:
ovirt-3.6.z?
rule-engine: planning_ack? oourfali: devel_ack+ pstehlik: testing_ack+ |
Target Release: | 4.17.16 | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2016-02-18 11:10:10 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | Infra | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 1260131 |
Description
Nir Soffer
2015-11-13 21:00:41 UTC
Setting severity to high since this can fail some flows when non-ascii values are sent from engine. Changing component to core, since jsonrpc is not the root cause, it just happens when using it instead of xmlrpc. Nir, can I assign to you? Should it be on post? Taken (In reply to Nir Soffer from comment #3) > Taken Thanks. Highly appreciated! (In reply to Nir Soffer from comment #1) > Setting severity to high since this can fail some flows when non-ascii > values are sent from engine. This seems the underlying bug: Engine sending unadorned binary data as strings violates jsonrpc spec. If we take the suggested patch as a stop-gap measure to avoid a 3.6 regression, we should include a logging mechanism to catch such cases and fix them in Engine. (In reply to Dan Kenigsberg from comment #5) > (In reply to Nir Soffer from comment #1) > > Setting severity to high since this can fail some flows when non-ascii > > values are sent from engine. > > This seems the underlying bug: Engine sending unadorned binary data as > strings violates jsonrpc spec. JSON string is unicode [1] - can you show where the jsonrpc spec [2] forbids unicode strings? Also vdsm schema does not mention anything about unicode values. If we forbid them it should be documented. > If we take the suggested patch as a stop-gap > measure to avoid a 3.6 regression, we should include a logging mechanism > to catch such cases and fix them in Engine. Warning about unicode values is expensive, requires recursive search in arguments dict in jsonrpc, and manual checking of the argument in xmlrpc. We can enhance the password protection code to warn about unicode values. But I think we better spend time on useful features and handle this in the schema. [1] http://www.json.org/ [2] http://www.jsonrpc.org/specification We are investigating a different direction, that will allow using the built-in json library safely, and be more compatible with Python 3. String to use the json built-in library expose this issue, but it is not the root cause. The root cause is mixing unicode and utf8 encoded strings, while python default encoding in Python 2 is ascii. Each time a string is encoded using str() or decoded using unicode() or x.decode() without specifying the encoding, python default to 'ascii'. It seems that changing the default encoding is a quick fix avoiding these issues, until vdsm is fixed to never mix unicode and encoded strings. Missing backport to 3.6 branch, moving to post Nir - what's the status of this one? (In reply to Oved Ourfali from comment #11) > Nir - what's the status of this one? Fixed in master. This fix is required for supporting non-ascii vm name, but libvirt does does not support it yet. See https://gerrit.ovirt.org/48570 Do you want to backport it? Okay. Moving to 3.6.3, hoping this will get into libvirt by then. If you can backport the merged patch that would be great. (In reply to Oved Ourfali from comment #13) > Okay. Moving to 3.6.3, hoping this will get into libvirt by then. If bug 1285720 is resolved, this fix is good enough to allow vms with non-acsii names. > If you can backport the merged patch that would be great. Patch is ready for merging to 3.6. Verified with: vdsm-4.17.18-0.el7ev.noarch From vdsm log: Thread-47::INFO::2016-01-21 13:04:06,489::logUtils::48::dispatcher::(wrapper) Run and protect: connectStoragePool(spUUID='00000001-0001-0001-0001-0000000001a8', hostID=1, msdUUID='ad2d4bfe-5683-4d40-84e1-80522e030890', masterVersion=1, domainsMap={'ad2d4bfe-5683-4d40-84e1-80522e030890': 'active'}, options=None) |