Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgw: handle old clients with transfer-encoding: chunked. #50235

Merged
merged 1 commit into from Apr 7, 2023

Conversation

mkogan1
Copy link
Contributor

@mkogan1 mkogan1 commented Feb 23, 2023

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
Resolves: rhbz#2152801

Signed-off-by: Marcus Watts mwatts@redhat.com

= = = = = 8< = = = = =

Additional details from the BZ:
Description of problem:

  • Cu is getting error 411, missing content length error for PutObject operations for clients accessing via aws-sdk
    Cu confirmed following implementation details:
library is '@aws-sdk/client-s3' with the version 3.54.0
they use it in javascript (node)
specific request type is PutObject with a stream, the content I can't give but it happens for any file from their testing, but please try various of object sizes.
The exact error is: "MissigContentLength: UnknownError"

Cu script:

import fs from 'fs';
import { Readable } from 'stream';

import { S3, PutObjectCommandInput, PutObjectCommandOutput } from '@aws-sdk/client-s3';
import { SdkStream } from '@aws-sdk/types';

const file = fs.createReadStream('/file/path')


const s3client = new S3({
	region: 's3Region',
	tls: true,
	forcePathStyle: true
	credentials: {
		accessKeyId: 'access key',
		secretAccessKey: 'secret key'
	},
	endpoint: 'endpoint'
});


const params: PutObjectCommandInput = {
	Bucket: bucket,
	Key: key,
	Body: file
};

const upload: PutObjectCommandOutput = await s3client.putObject(params, {});

return upload;

Contribution Guidelines

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows

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
Resolves: rhbz#2152801

Signed-off-by: Marcus Watts <mwatts@redhat.com>
@cbodley
Copy link
Contributor

cbodley commented Feb 23, 2023

if there's a reproducer for this, can we please turn it into a s3test case? if boto2 is required, we still have some boto2 tests under s3tests/

mkogan1 added a commit to mkogan1/s3-tests that referenced this pull request Mar 7, 2023
Before the RGW fix PR was responding with 411 instead of 200

RGW fix PR: ceph/ceph#50235

Signed-off-by: Mark Kogan <mkogan@redhat.com>
@mkogan1
Copy link
Contributor Author

mkogan1 commented Mar 7, 2023

if there's a reproducer for this, can we please turn it into a s3test case? if boto2 is required, we still have some boto2 tests under s3tests/

@cbodley added s3test PR: ceph/s3-tests#501

@mkogan1
Copy link
Contributor Author

mkogan1 commented Mar 7, 2023

jenkins test make check

@cbodley
Copy link
Contributor

cbodley commented Mar 7, 2023

we'll need to make sure this gets run against a suite-branch that modifies qa/rgw/s3tests-branch.yaml to point at your mkogan1:wip-chunked-trans-enc s3test branch

@mkogan1
Copy link
Contributor Author

mkogan1 commented Mar 7, 2023

jenkins test api

@ivancich ivancich added the wip-eric-testing-1 for ivancich testing label Mar 15, 2023
@mkogan1
Copy link
Contributor Author

mkogan1 commented Mar 16, 2023

@ivancich sorry, currently it will fail wip-eric-testing-1
https://github.com/ceph/java_s3tests/blob/81319fea9d8be9b8083723dd74ee59ff94f0351e/src/test/java/ObjectTest.java#L472
because there are test changes, working on testing per instructions in #50235 (comment) above

Copy link
Contributor

@mattbenjamin mattbenjamin left a comment

Choose a reason for hiding this comment

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

marcus says sounds plausible, he will review

@mkogan1
Copy link
Contributor Author

mkogan1 commented Mar 20, 2023

added java_s3test PR: ceph/java_s3tests#13

mkogan1 added a commit to mkogan1/java_s3tests that referenced this pull request Mar 20, 2023
following ceph PR ceph/ceph#50235
it was found that the test 'object create w/negative content length, fails'
test falsely fails on object PUT with chunked transfer encoding
and does not attempts to create an object with a negative content length
for details referring to discussion on: ceph#13

Signed-off-by: Mark Kogan <mkogan@redhat.com>
cbodley pushed a commit to ceph/java_s3tests that referenced this pull request Mar 20, 2023
following ceph PR ceph/ceph#50235
it was found that the test 'object create w/negative content length, fails'
test falsely fails on object PUT with chunked transfer encoding
and does not attempts to create an object with a negative content length
for details referring to discussion on: #13

Signed-off-by: Mark Kogan <mkogan@redhat.com>
(cherry picked from commit d625bfa)
cbodley pushed a commit to ceph/java_s3tests that referenced this pull request Mar 20, 2023
following ceph PR ceph/ceph#50235
it was found that the test 'object create w/negative content length, fails'
test falsely fails on object PUT with chunked transfer encoding
and does not attempts to create an object with a negative content length
for details referring to discussion on: #13

Signed-off-by: Mark Kogan <mkogan@redhat.com>
(cherry picked from commit d625bfa)
@ivancich
Copy link
Member

In my QA branch all my rgw/verify jobs fail due to this:

2023-03-20T03:40:41.347 INFO:teuthology.orchestra.run.smithi033.stdout:suite > Object tests > ObjectTest.testObjectCreateBadContentlengthNegative FAILED
2023-03-20T03:40:41.348 INFO:teuthology.orchestra.run.smithi033.stdout:    java.lang.AssertionError at ObjectTest.java:472

Of the 4 PRs on the branch, this seems the most likely to involve this. I'm verifying.

@cbodley
Copy link
Contributor

cbodley commented Mar 20, 2023

thanks @ivancich. this was expected, yeah:

@ivancich sorry, currently it will fail wip-eric-testing-1 https://github.com/ceph/java_s3tests/blob/81319fea9d8be9b8083723dd74ee59ff94f0351e/src/test/java/ObjectTest.java#L472 because there are test changes, working on testing per instructions in #50235 (comment) above

@ivancich
Copy link
Member

thanks @ivancich. this was expected, yeah:

@ivancich sorry, currently it will fail wip-eric-testing-1 https://github.com/ceph/java_s3tests/blob/81319fea9d8be9b8083723dd74ee59ff94f0351e/src/test/java/ObjectTest.java#L472 because there are test changes, working on testing per instructions in #50235 (comment) above

Sorry, I missed that comment directed at me above. How would you like me to handle QA then -- pull this PR out of the QA run or count this as a pass?

@mkogan1
Copy link
Contributor Author

mkogan1 commented Mar 21, 2023

thanks @ivancich. this was expected, yeah:

@ivancich sorry, currently it will fail wip-eric-testing-1 https://github.com/ceph/java_s3tests/blob/81319fea9d8be9b8083723dd74ee59ff94f0351e/src/test/java/ObjectTest.java#L472 because there are test changes, working on testing per instructions in #50235 (comment) above

Sorry, I missed that comment directed at me above. How would you like me to handle QA then -- pull this PR out of the QA run or count this as a pass?

following this ceph/java_s3tests#14 merging it should be OK to test again and it should pass now

@mkogan1
Copy link
Contributor Author

mkogan1 commented Mar 21, 2023

@cbodley
this PR passed teuthology rgw:verify suite & --limit 10 and a suite-repo&branch
with the explicit additional s3test for this scenario from: ceph/s3-tests#501

https://pulpito.ceph.com/mkogan-2023-03-21_13:51:47-rgw:verify-wip-chuncked-put-i04-distro-default-smithi/ -->
http://qa-proxy.ceph.com/teuthology/mkogan-2023-03-21_13:51:47-rgw:verify-wip-chuncked-put-i04-distro-default-smithi/7215297/teuthology.log : test_object_write_with_chunked_transfer_encoding PASSED [ 36%]

2023-03-21T14:25:08.794 INFO:teuthology.orchestra.run.smithi149.stdout:s3tests_boto3/functional/test_s3.py::test_object_write_with_chunked_transfer_encoding PASSED [ 36%]   

is rgw:verify suite & --limit 10 enough or should I submit full rgw:verify or rgw?

@ivancich
sorry if you already submitted your teuthology runs, the s3tests with not failed because of this PR after ceph/java_s3tests#14 but without ceph/s3-tests#501 (which has not merged yet) they also do not verify this PR correctness

@mkogan1
Copy link
Contributor Author

mkogan1 commented Mar 21, 2023

jenkins test windows

@mkogan1
Copy link
Contributor Author

mkogan1 commented Mar 21, 2023

jenkins test make check arm64

@cbodley
Copy link
Contributor

cbodley commented Mar 21, 2023

is rgw:verify suite & --limit 10 enough or should I submit full rgw:verify or rgw?

please run the whole rgw suite. we run s3tests in other subsuites like rgw/multifs, rgw/sts, rgw/crypt, etc

@mdw-at-linuxbox
Copy link
Contributor

Looks fine - only thing I can see is do you really still want to call this "rgw/civetweb"?

Copy link
Contributor

@mdw-at-linuxbox mdw-at-linuxbox left a comment

Choose a reason for hiding this comment

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

Looks fine (other than calling it a "civetweb" change)

@mkogan1 mkogan1 changed the title rgw/civetweb: handle old clients with transfer-encoding: chunked. rgw: handle old clients with transfer-encoding: chunked. Mar 22, 2023
@mkogan1
Copy link
Contributor Author

mkogan1 commented Mar 22, 2023

Looks fine - only thing I can see is do you really still want to call this "rgw/civetweb"?

thank you, changed the PR title, preferred to leave the commit title to keep track all the way back when searching the commit history of various old release branches by commit tile

@mkogan1
Copy link
Contributor Author

mkogan1 commented Mar 22, 2023

jenkins test make check arm64

@mkogan1
Copy link
Contributor Author

mkogan1 commented Mar 22, 2023

@ivancich
Copy link
Member

I think we should wait until this passes the rgw upgrade suite.

@cbodley
Copy link
Contributor

cbodley commented Mar 23, 2023

I think we should wait until this passes the rgw upgrade suite.

we're waiting on Mark's results, which are running against the new test case in ceph/s3-tests#501

@ivancich
Copy link
Member

I think we should wait until this passes the rgw upgrade suite.

we're waiting on Mark's results, which are running against the new test case in ceph/s3-tests#501

OK, then I'll pull this off of my QA run and won't merge.

@ivancich ivancich removed the wip-eric-testing-1 for ivancich testing label Mar 23, 2023
@mkogan1
Copy link
Contributor Author

mkogan1 commented Mar 27, 2023

@cbodley @ivancich ACK
a full rgw suite run with the new test_object_write_with_chunked_transfer_encoding test (ceph/s3-tests#501)
has completed successfully below, none of the failures is related to the new test
https://pulpito.ceph.com/mkogan-2023-03-21_16:00:08-rgw-wip-chuncked-put-i04-distro-default-smithi/
for representative example: http://qa-proxy.ceph.com/teuthology/mkogan-2023-03-21_16:00:08-rgw-wip-chuncked-put-i04-distro-default-smithi/7215423/teuthology.log :
2023-03-24T11:02:22.344 INFO:teuthology.orchestra.run.smithi026.stdout:s3tests_boto3/functional/test_s3.py::test_object_write_with_chunked_transfer_encoding PASSED [ 36%]

@mkogan1
Copy link
Contributor Author

mkogan1 commented Apr 4, 2023

@cbodley @ivancich ACK a full rgw suite run with the new test_object_write_with_chunked_transfer_encoding test (ceph/s3-tests#501) has completed successfully below, none of the failures is related to the new test https://pulpito.ceph.com/mkogan-2023-03-21_16:00:08-rgw-wip-chuncked-put-i04-distro-default-smithi/ for representative example: http://qa-proxy.ceph.com/teuthology/mkogan-2023-03-21_16:00:08-rgw-wip-chuncked-put-i04-distro-default-smithi/7215423/teuthology.log : 2023-03-24T11:02:22.344 INFO:teuthology.orchestra.run.smithi026.stdout:s3tests_boto3/functional/test_s3.py::test_object_write_with_chunked_transfer_encoding PASSED [ 36%]

@cbodley may please ask to take another look when there's time, any additional tests?

@cbodley cbodley merged commit 1509b58 into ceph:main Apr 7, 2023
14 of 19 checks passed
cbodley pushed a commit to ceph/s3-tests that referenced this pull request Apr 7, 2023
Before the RGW fix PR was responding with 411 instead of 200

RGW fix PR: ceph/ceph#50235

Signed-off-by: Mark Kogan <mkogan@redhat.com>
(cherry picked from commit 13a9bfc)
yuvalif pushed a commit to yuvalif/ceph that referenced this pull request Apr 30, 2023
rgw: handle old clients with transfer-encoding: chunked.

Reviewed-by: Casey Bodley <cbodley@redhat.com>
Reviewed-by: Marcus Watts <mwatts@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants