[
https://issues.apache.org/jira/browse/LIBCLOUD-935?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16152982#comment-16152982
]
Zachary Buhman edited comment on LIBCLOUD-935 at 9/4/17 11:44 PM:
------------------------------------------------------------------
This seems obviously wrong:
https://github.com/apache/libcloud/blob/trunk/libcloud/storage/base.py#L615
For the {{stream}} case, the stream iterator is used twice, once by
{{connection.request}}, and again by {{_hash_buffered_stream}}. The second
iteration results in an empty hash value.
The original exception:
{noformat}
ObjectHashMismatchError: <ObjectHashMismatchError in
<libcloud.storage.drivers.cloudfiles.CloudFilesStorageDriver object at
0x7f83a4706e10>, value=MD5 hash checksum does not match
(expected=d41d8cd98f00b204e9800998ecf8427e,
actual=97a1d69438dd1ab096bbc22de9701826), object =
76cdda2d39904fe1b7aac19226e46819.png>
{noformat}
The "expected" value {{d41d8cd98f00b204e9800998ecf8427e}} comes from
effectively doing:
{code:none}
>>> h = hashlib.md5()
>>> h.update(b'')
>>> h.hexdigest()
'd41d8cd98f00b204e9800998ecf8427e'
{code}
was (Author: buhman):
This seems obviously wrong:
https://github.com/apache/libcloud/blob/trunk/libcloud/storage/base.py#L615
For the {{stream}} case, the stream iterator is used twice, once by
{{connection.request}}, and again by {{_hash_buffered_stream}}. The second
iteration results in an empty hash value.
The original exception:
{noformat}
ObjectHashMismatchError: <ObjectHashMismatchError in
<libcloud.storage.drivers.cloudfiles.CloudFilesStorageDriver object at
0x7f83a4706e10>, value=MD5 hash checksum does not match
(expected=d41d8cd98f00b204e9800998ecf8427e,
actual=97a1d69438dd1ab096bbc22de9701826), object =
76cdda2d39904fe1b7aac19226e46819.png>
{noformat}
The "expected" value {{d41d8cd98f00b204e9800998ecf8427e}} comes from
effectively doing:
{code:python}
>>> h = hashlib.md5()
>>> h.update(b'')
>>> h.hexdigest()
'd41d8cd98f00b204e9800998ecf8427e'
{code}
> ObjectHashMismatchError while uploading the object to Swift using
> "upload_object_via_stream" method
> ---------------------------------------------------------------------------------------------------
>
> Key: LIBCLOUD-935
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-935
> Project: Libcloud
> Issue Type: Bug
> Components: Storage
> Environment: Apache LibCloud version 2.0.0
> Reporter: HCLTech-SSW
>
> Getting the error "ObjectHashMismatchError" while uploading the object to
> swift using "upload_object_via_stream" method.
> If uploading the object using "upload_object" there is no error occurred
> like "ObjectHashMismatchError".
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)