Skip to content

rgw: chunk encoding fixes - #35350

Closed
mdw-at-linuxbox wants to merge 5 commits into
ceph:mainfrom
mdw-at-linuxbox:wip-master-rgw-chunkfix
Closed

mdw-at-linuxbox wants to merge 5 commits into
ceph:mainfrom
mdw-at-linuxbox:wip-master-rgw-chunkfix

Conversation

@mdw-at-linuxbox

Copy link
Copy Markdown
Contributor

This is a set of fixes related to transfer-encoding: chunked, which are ready to review.

DNM - pending civetweb changes.
This includes fixes to civetweb - I'll make a separate PR for that to merge into our civetweb repo. That will need to be completed, and this PR will need to be updated to reflect that.

This PR mainly addresses civetweb - although some of the fixes also apply to beast.

I don't have any test logic here - most of the problems arise only with esoteric client software. Most client frameworks (such as boto3) are simply not designed to exercise the edge cases this PR addresses.

This PR addresses these 2 related PR's,
https://tracker.ceph.com/issues/45789
https://tracker.ceph.com/issues/45790

@mattbenjamin mattbenjamin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks very promising; is beast work in progress?

Comment thread .gitmodules Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, well as you specify, we can't merge this--is there civetweb change proposed in a PR as well?

@mdw-at-linuxbox

Copy link
Copy Markdown
Contributor Author

Yes, the parallel civetweb fix is:
ceph/civetweb#35
Once that's in, I can update this to match.

@mdw-at-linuxbox

Copy link
Copy Markdown
Contributor Author

I want to address beast too -- but that will probably be a separate PR (unless this is still pending...)

@mdw-at-linuxbox

Copy link
Copy Markdown
Contributor Author

"make check" failed due to the civetweb submodule change - to be expected.

@theanalyst

Copy link
Copy Markdown
Member

Is there a need to implement the send_close methods individually by the frontends, can't we just implement a ClientIO::send_close() which sends the HTTP close similar to how we do 100/continues for all the frontends.

@batrick batrick added the rgw label Jun 15, 2020
@mdw-at-linuxbox
mdw-at-linuxbox force-pushed the wip-master-rgw-chunkfix branch from fe620b9 to e2c8ea7 Compare July 24, 2020 21:29
@mdw-at-linuxbox

Copy link
Copy Markdown
Contributor Author

I have pushed an updated set of commits for this. I left off the "boto2" and "transfer-encoding/content-length" conflict fixes - I'll have separate PR's for that. This should just be the "safe" non-controversial changes.

Note this still reuqires a civetweb update. This time I pushed the commits to ceph's civetweb; that means this should pass - but the civetweb fixes should still be commited to ceph-master for the sake of everyone's sanity.

@mdw-at-linuxbox

Copy link
Copy Markdown
Contributor Author

"send_close" is a bad name for that logic. It implies an immediancy of operation that is in fact incorrect. It is necessary to close the connection after sending the error response, which is quite a different thing.

As it stands, all of the logic that decides to do "set-must-close" is contained within the frontend, so I didn't see any reason to add it to the generic interface. If there's a good reason for the rest of rgw to know about it, then I don't see a reason not to do this, but I don't quite know what "set-must-close" actually means for fcgi or for nfs.

@mdw-at-linuxbox

Copy link
Copy Markdown
Contributor Author

For beast - this does fix one beast specific thing (set-must-close) - but all the code is in rgw; no beast changes required.

@mdw-at-linuxbox
mdw-at-linuxbox force-pushed the wip-master-rgw-chunkfix branch from e2c8ea7 to 80e85d7 Compare July 28, 2020 19:25
@mdw-at-linuxbox

Copy link
Copy Markdown
Contributor Author

I may have botched the civetweb changes - I missed one commit for sure ,but I may have other problems.

@mdw-at-linuxbox
mdw-at-linuxbox force-pushed the wip-master-rgw-chunkfix branch from 80e85d7 to 44de124 Compare July 28, 2020 21:37
@mdw-at-linuxbox

Copy link
Copy Markdown
Contributor Author

I fixed my botched refactor. This should build now.

@stale

stale Bot commented Sep 27, 2020

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@stale stale Bot added the stale label Sep 27, 2020
@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@stale stale Bot removed the stale label Jan 25, 2021
@mkogan1

mkogan1 commented Jan 25, 2021

Copy link
Copy Markdown
Contributor

a note about commit e7b4863 -
leaving META_MAX_SIZE = 256
and changing
if (stream_pos >= ChunkMeta::META_MAX_SIZE && is_signature_mismatched()) {
to
if (is_signature_mismatched() && stream_pos >= ChunkMeta::META_MAX_SIZE) {
also works, but preferred to stay on the safe side for downstream cherry-pick sake.

@mattbenjamin

Copy link
Copy Markdown
Contributor

@mdw-at-linuxbox mark says this needs a rebase, and notes we couldn't merge because no teuthology run was done; what about the related PRs? What should be on master and pacific?

@mkogan1
mkogan1 force-pushed the wip-master-rgw-chunkfix branch from e7b4863 to 578d74d Compare February 10, 2021 16:35
@mkogan1

mkogan1 commented Feb 10, 2021

Copy link
Copy Markdown
Contributor

@mkogan1

mkogan1 commented Feb 14, 2021 •

Copy link
Copy Markdown
Contributor

one of the tempest tests (create_object_with_transfer_encoding) has failed:
image
log:
http://qa-proxy.ceph.com/teuthology/mkogan-2021-02-10_16:29:19-rgw-wip-master-rgw-chunkfix-distro-basic-smithi/5873300/teuthology.log

excerpt:

2021-02-13T20:50:11.457 INFO:teuthology.orchestra.run.smithi044.stdout:{2} tempest.api.object_storage.test_object_services.ObjectTest.test_copy_object_2d_way [0.032060s] ... ok                                                                    
2021-02-13T20:50:11.524 INFO:teuthology.orchestra.run.smithi044.stdout:{2} tempest.api.object_storage.test_object_services.ObjectTest.test_copy_object_across_containers [0.067243s] ... ok                                                         
2021-02-13T20:50:11.559 INFO:teuthology.orchestra.run.smithi044.stdout:{2} tempest.api.object_storage.test_object_services.ObjectTest.test_copy_object_in_same_container [0.034154s] ... ok                                                         
2021-02-13T20:50:11.590 INFO:teuthology.orchestra.run.smithi044.stdout:{2} tempest.api.object_storage.test_object_services.ObjectTest.test_copy_object_to_itself [0.030793s] ... ok                                                                 
2021-02-13T20:50:11.623 INFO:teuthology.orchestra.run.smithi044.stdout:{2} tempest.api.object_storage.test_object_services.ObjectTest.test_copy_object_with_x_fresh_metadata [0.032606s] ... ok                                                     
2021-02-13T20:50:11.651 INFO:teuthology.orchestra.run.smithi044.stdout:{2} tempest.api.object_storage.test_object_services.ObjectTest.test_copy_object_with_x_object_meta [0.027272s] ... ok                                                        
2021-02-13T20:50:11.677 INFO:teuthology.orchestra.run.smithi044.stdout:{2} tempest.api.object_storage.test_object_services.ObjectTest.test_copy_object_with_x_object_metakey [0.026345s] ... ok                                                     
2021-02-13T20:50:11.701 INFO:teuthology.orchestra.run.smithi044.stdout:{2} tempest.api.object_storage.test_object_services.ObjectTest.test_create_object [0.022932s] ... ok                                                                         
2021-02-13T20:50:11.716 INFO:teuthology.orchestra.run.smithi044.stdout:{2} tempest.api.object_storage.test_object_services.ObjectTest.test_create_object_with_content_disposition [0.015189s] ... ok                                                
2021-02-13T20:50:11.729 INFO:teuthology.orchestra.run.smithi044.stdout:{2} tempest.api.object_storage.test_object_services.ObjectTest.test_create_object_with_content_encoding [0.013100s] ... ok                                                   
2021-02-13T20:50:11.745 INFO:teuthology.orchestra.run.smithi044.stdout:{2} tempest.api.object_storage.test_object_services.ObjectTest.test_create_object_with_etag [0.015405s] ... ok                                                               
2021-02-13T20:50:11.758 INFO:teuthology.orchestra.run.smithi044.stdout:{2} tempest.api.object_storage.test_object_services.ObjectTest.test_create_object_with_expect_continue [0.012725s] ... ok                                                    
2021-02-13T20:50:11.764 INFO:teuthology.orchestra.run.smithi044.stdout:{2} tempest.api.object_storage.test_object_services.ObjectTest.test_create_object_with_transfer_encoding [0.004742s] ... FAILED                                              
2021-02-13T20:50:11.764 INFO:teuthology.orchestra.run.smithi044.stdout:                                                                                                                                                                             
2021-02-13T20:50:11.764 INFO:teuthology.orchestra.run.smithi044.stdout:Captured traceback:                                                                                                                                                          
2021-02-13T20:50:11.764 INFO:teuthology.orchestra.run.smithi044.stdout:~~~~~~~~~~~~~~~~~~~                                                                                                                                                          
2021-02-13T20:50:11.764 INFO:teuthology.orchestra.run.smithi044.stdout:    Traceback (most recent call last):                                                                                                                                       
2021-02-13T20:50:11.764 INFO:teuthology.orchestra.run.smithi044.stdout:                                                                                                                                                                             
2021-02-13T20:50:11.765 INFO:teuthology.orchestra.run.smithi044.stdout:      File "/home/ubuntu/cephtest/tempest/tempest/api/object_storage/test_object_services.py", line 189, in test_create_object_with_transfer_encoding                        
2021-02-13T20:50:11.765 INFO:teuthology.orchestra.run.smithi044.stdout:    resp, _ = self.object_client.create_object(                                                                                                                              
2021-02-13T20:50:11.765 INFO:teuthology.orchestra.run.smithi044.stdout:                                                                                                                                                                             
2021-02-13T20:50:11.765 INFO:teuthology.orchestra.run.smithi044.stdout:      File "/home/ubuntu/cephtest/tempest/tempest/lib/services/object_storage/object_client.py", line 41, in create_object                                                   
2021-02-13T20:50:11.765 INFO:teuthology.orchestra.run.smithi044.stdout:    resp, body = self.put(url, data, headers, chunked=chunked)                                                                                                               
2021-02-13T20:50:11.765 INFO:teuthology.orchestra.run.smithi044.stdout:                                                                                                                                                                             
2021-02-13T20:50:11.765 INFO:teuthology.orchestra.run.smithi044.stdout:      File "/home/ubuntu/cephtest/tempest/tempest/lib/common/rest_client.py", line 347, in put                                                                               
2021-02-13T20:50:11.765 INFO:teuthology.orchestra.run.smithi044.stdout:    return self.request('PUT', url, extra_headers, headers, body, chunked)                                                                                                   
2021-02-13T20:50:11.765 INFO:teuthology.orchestra.run.smithi044.stdout:                                                                                                                                                                             
2021-02-13T20:50:11.765 INFO:teuthology.orchestra.run.smithi044.stdout:      File "/home/ubuntu/cephtest/tempest/tempest/lib/common/rest_client.py", line 687, in request                                                                           
2021-02-13T20:50:11.765 INFO:teuthology.orchestra.run.smithi044.stdout:    self._error_checker(resp, resp_body)                                                                                                                                     
2021-02-13T20:50:11.765 INFO:teuthology.orchestra.run.smithi044.stdout:                                                                                                                                                                             
2021-02-13T20:50:11.766 INFO:teuthology.orchestra.run.smithi044.stdout:      File "/home/ubuntu/cephtest/tempest/tempest/lib/common/rest_client.py", line 798, in _error_checker                                                                    
2021-02-13T20:50:11.766 INFO:teuthology.orchestra.run.smithi044.stdout:    raise exceptions.BadRequest(resp_body, resp=resp)                                                                                                                        
2021-02-13T20:50:11.766 INFO:teuthology.orchestra.run.smithi044.stdout:                                                                                                                                                                             
2021-02-13T20:50:11.766 INFO:teuthology.orchestra.run.smithi044.stdout:    tempest.lib.exceptions.BadRequest: Bad request                                                                                                                           
2021-02-13T20:50:11.766 INFO:teuthology.orchestra.run.smithi044.stdout:Details: b''                                                                                                                                                                 
2021-02-13T20:50:11.766 INFO:teuthology.orchestra.run.smithi044.stdout:                                                                                                                                                                             
2021-02-13T20:50:11.766 INFO:teuthology.orchestra.run.smithi044.stdout:                                                                                                                                                                             
2021-02-13T20:50:11.766 INFO:teuthology.orchestra.run.smithi044.stdout:Captured pythonlogging:                                                                                                                                                      
2021-02-13T20:50:11.766 INFO:teuthology.orchestra.run.smithi044.stdout:~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                      
2021-02-13T20:50:11.766 INFO:teuthology.orchestra.run.smithi044.stdout:    2021-02-13 20:50:11,762 26254 INFO     [tempest.lib.common.rest_client] Request (ObjectTest:test_create_object_with_transfer_encoding): 400 PUT http://smithi044.front.se
2021-02-13T20:50:11.767 INFO:teuthology.orchestra.run.smithi044.stdout:2021-02-13 20:50:11,762 26254 WARNING  [tempest.lib.common.rest_client] status >= 400 response with empty body                                                               
2021-02-13T20:50:11.767 INFO:teuthology.orchestra.run.smithi044.stdout:                                                                                                                                                                             
2021-02-13T20:50:11.789 INFO:teuthology.orchestra.run.smithi044.stdout:{2} tempest.api.object_storage.test_object_services.ObjectTest.test_create_object_with_x_fresh_metadata [0.025827s] ... ok                                                   
2021-02-13T20:50:11.805 INFO:teuthology.orchestra.run.smithi044.stdout:{2} tempest.api.object_storage.test_object_services.ObjectTest.test_create_object_with_x_object_meta [0.015416s] ... ok                                                      
2021-02-13T20:50:11.821 INFO:teuthology.orchestra.run.smithi044.stdout:{2} tempest.api.object_storage.test_object_services.ObjectTest.test_create_object_with_x_object_metakey [0.015799s] ... ok                                                   
2021-02-13T20:50:11.856 INFO:teuthology.orchestra.run.smithi044.stdout:{2} tempest.api.object_storage.test_object_services.ObjectTest.test_create_object_with_x_remove_object_meta [0.034204s] ... ok                                               

@mkogan1

mkogan1 commented Mar 2, 2021

Copy link
Copy Markdown
Contributor

@mdw-at-linuxbox please note the teuthology results above,
the test_create_object_with_transfer_encoding has returned FAILED

@mdw-at-linuxbox
mdw-at-linuxbox force-pushed the wip-master-rgw-chunkfix branch from 578d74d to 356699a Compare May 13, 2021 17:16
@mdw-at-linuxbox

Copy link
Copy Markdown
Contributor Author

I pushed a new version of this patch. This should address the "kafka cammel connector" problem in a more comprehensive sense. It will need more testing.

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@mdw-at-linuxbox

Copy link
Copy Markdown
Contributor Author

I've been exploring the tempest failure with my latest version. So far, I've failed to recreate it. Examining teuthology failures, it looks like this may be specific to ubuntu and the beast front-end, which I have not yet tried. Also, my last set of commits here failed to build in ceph-ci; hopefully a rebase which i have to do anyways will fix that.

For chunked transfers, the "content-length" field is not required
and should not be specified by the client.  That means that it is
not correct to always require that the content-length field be
supplied.

Fixes: https://tracker.ceph.com/issues/45789

Signed-off-by: Marcus Watts <[email protected]>
s3 clients *should* provide an x-amz-decoded-content-length field
when they use transport-encoding: chunked.  Some clients do not.
With swift we already allow chunked uploads that do not specify the
content length in advance.   This commit adds similar support
for s3.  Known client affected by this: boto2.

Fixes: https://tracker.ceph.com/issues/45789

Signed-off-by: Marcus Watts <[email protected]>
The existing logic for chunk headers assumes there will be ony one field
specified for chunk header, and that that field will be named will be
"chunk-signature".  RFC 2616/7230 make it clear it's possible to put
other fields there, so there may be S3 clients now or in the future that
do so.  Additionally Amazon could in the future extend S3 to make use of
this feature of the protocol.

This patch adds more robust parsing of the fields in the chunk header.
It should be capable of handling a more diverse mix of present and
future clients.

Fixes: https://tracker.ceph.com/issues/45790

Signed-off-by: Marcus Watts <[email protected]>
With transfer-encoding: chunked, it is possible for bad data
to cause a the body read to fail early.  If this happens, the
input pointer will be left pointing to the middle of the data
that could not be consumed, which will cause subsequent attempts
to read a request on this connection to see the wrong data.
This is not useful, and it can lead to worse problems.

The only safe recovery choice is to close the connection
after issuing an error message.  This commit adds support to do this.

Fixes: https://tracker.ceph.com/issues/45789

Signed-off-by: Marcus Watts <[email protected]>
Future proofing exercise.

Chunked headers include support for multiple field values, but
only one is currently defined.  The existing logic assumed only
that one field (signature=64 bytes) existed, so read into a
fixed size buffer for this and otherwise depended on that fixed size.

This new logic attempts to more carefully read a chunk header
that might contain other field names, and should no longer be
assuming chunked headers are a fixed size; rather it should only
require that chunk headers contain at least the signature,
and are not too big (1024 byte limit seems plenty generous.)

Signed-off-by: Marcus Watts <[email protected]>
@mdw-at-linuxbox

Copy link
Copy Markdown
Contributor Author

I've pushed a new version of this. This contains the chunkfix code, rebased to the latest master (as of a week ago or so). The most significant change is that civetweb is gone - so this PR no longer contains the civetweb specific bits. A backport effort would need to re-acquire those bits. Even without civetweb, some of the fixes here (especially bc3967a) are important.

I pushed this exact version through ceph-ci and teuthology. See http://pulpito.front.sepia.ceph.com:80/mwatts-2021-05-20_01:33:51-rgw-mdw-master-chunkfix-8-distro-basic-smithi/
and for just the tempest test (fails, but see next paragraph) http://pulpito.front.sepia.ceph.com:80/mwatts-2021-05-20_01:52:25-rgw:tempest-mdw-master-chunkfix-8-distro-basic-smithi/

The teuthology problem turns out to be a tempest problem - it was specifying "transfer-encoding: chunked" twice. The test is currently (recently?) disabled in tempest - https://bugs.launchpad.net/tempest/+bug/1905432 Also this behavior was showing up in ceph without this fix -https://tracker.ceph.com/issues/49747 I'm not sure why ceph was behaving differently on ubuntu, but since the logic for that is contained entirely within beast, I think this behavior is entirely outside the scope of this fix. If it remains a problem it could be within scope for chunkfix phase 2 which already includes beast patches.

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@djgalloway
djgalloway changed the base branch from master to main July 9, 2022 00:00
@github-actions

github-actions Bot commented Sep 7, 2022

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@github-actions github-actions Bot added the stale label Sep 7, 2022
@github-actions

Copy link
Copy Markdown

This pull request has been automatically closed because there has been no activity for 90 days. Please feel free to reopen this pull request (or open a new one) if the proposed change is still appropriate. Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants