data unavaibility for non-ascii metadata, after python3 upgrade
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Object Storage (swift) |
Fix Released
|
High
|
Tim Burke |
Bug Description
Hello,
Context/
Swift (2.29) platform is running with python2.
A user has uploaded an object with non-ascii metadata:
curl -X PUT -H "x-object-
On object-server side, python2, there is no issue:
curl -g -I -XHEAD "http://
* About to connect() to 128.66.0.1 port 6001 (#0)
* Trying 128.66.0.1...
* connected
* Connected to 128.66.0.1 (128.66.0.1) port 6001 (#0)
> HEAD /disk-02-
> User-Agent: curl/7.26.0
> Host: 128.66.0.1:6001
> Accept: */*
>
* additional stuff not fine transfer.c:1042: 0 0
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Content-Length: 0
Content-Length: 0
< X-Backend-
X-Backend-
< Content-Type: text/plain
Content-Type: text/plain
< X-Object-
X-Object-
After switching to python3, the object-server does not answer anymore, for this specific object:
curl -g -I -XHEAD "http://
* About to connect() to 128.66.0.1 port 6001 (#0)
* Trying 128.66.0.1...
* connected
* Connected to 128.66.0.1 (128.66.0.1) port 6001 (#0)
> HEAD /disk-02-
> User-Agent: curl/7.26.0
> Host: 128.66.0.1:6001
> Accept: */*
>
* additional stuff not fine transfer.c:1042: 0 0
* Empty reply from server
* Connection #0 to host 128.66.0.1 left intact
curl: (52) Empty reply from server
* Closing connection #0
No stack-trace and 200 OK in logs.
Changed in swift: | |
status: | Confirmed → In Progress |
After digging, we believe that the issue comes from https:/ /opendev. org/openstack/ swift/src/ commit/ 9a1bfb8975fb131 5fb417161a2865b 6bb4760415/ swift/obj/ diskfile. py#L181- L185 where the string encoded in latin1 with python2 is decoded in utf8 with surrogateescape, generating a "�".
Then the object-server does not answer because "six.b" (https:/ /six.readthedoc s.io/#six. b) fails in eventlet/wsgi https:/ /github. com/eventlet/ eventlet/ blob/6893078d04 fa5d46b53269691 202e0f709be905a /eventlet/ wsgi.py# L498
and eventlet enforces latin1/iso-8859-1 when writing answers to wsgi /github. com/eventlet/ eventlet/ blob/6893078d04 fa5d46b53269691 202e0f709be905a /eventlet/ green/http/ server. py#L333 /github. com/eventlet/ eventlet/ blob/6893078d04 fa5d46b53269691 202e0f709be905a /eventlet/ green/http/ server. py#L564
https:/
https:/
---
For now, as a workaround, we are thinking to patch diskfile: https:/ /opendev. org/openstack/ swift/src/ commit/ 9a1bfb8975fb131 5fb417161a2865b 6bb4760415/ swift/obj/ diskfile. py#L181- L185 /opendev. org/openstack/ swift/src/ commit/ 9a1bfb8975fb131 5fb417161a2865b 6bb4760415/ swift/obj/ ssync_sender. py#L471- L473
and ssync_sender: https:/
What do you think?