Repository navigation
rgw: DoS when QuotaExceeded - #58378
Conversation
Signed-off-by: Artem Vasilev <[email protected]>
| // bytes before reading the next | ||
| while (!expect_continue && !parser.is_done()) { | ||
| static std::array<char, 1024> discard_buffer; | ||
| static std::array<char, 1024*1024> discard_buffer; |
There was a problem hiding this comment.
since this is a static array, i think it's fine to make it larger without worrying about stack overflows 👍
but if there's a lot more data to transfer, it might be better to close the connection so the client won't have to send it all. there's a parser.content_length_remaining() function that may help us make that decision (unless the request is using chunked transfer encoding). what do you think? cc @mkogan1
There was a problem hiding this comment.
I like this idea. I will try to make an update to this PR.
There was a problem hiding this comment.
Using the generic aws_sdk_s3 for rust I get a misleading error in this case:
2024-07-02T07:59:35.203879Z ERROR upload simple file failed __self.name="yyukgfvxrcutsuwqsgwnqvsmuxahvntt" __self.size=26214400 e=DispatchFailure(DispatchFailure { source: ConnectorError { kind: Io, source: hyper::Error(BodyWrite, Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }), connection: Unknown } })
Probably not the best way to communicate with the user. Maybe this can be hidden behind the config option. With the increased buffer size RGW can discard 10Gb/s of data so I personally would leave this option disabled anyway.
There was a problem hiding this comment.
ok, i'd assumed that the disconnect would cause the client to retry instead of returning an error. but we've already responded with an http error, and we don't want the client to retry this request, so that makes sense. thanks for testing this! i think we should probably just drop that change
There was a problem hiding this comment.
Ok, reverted that commit.
There was a problem hiding this comment.
thanks. i added the needs-qa label so we can get started with testing. but i'd prefer if you remove the second commit and its revert from this branch before we merge
c0508bf to
86b6567
Compare
af13ac8 to
d702c39
Compare
|
jenkins test make check |
1. The upstream fix is ceph#58378 2. Also fix a build error after https://git.source.akamai.com/projects/STORAGEENG/repos/ceph/pull-requests/147/overview
…xceeded Merge in STORAGEENG/ceph from bugfix/CEPH-377-upstream-fix-rgw-dos-when-quotaexceeded to aka_version_18.2.1 * commit '8545ef7a31f7e5d27303f99795d6389cc71e29d6': CEPH-377 Take upstream fix for QoS when QuotaExceeded 1. The upstream fix is ceph#58378 2. Also fix a build error after https://git.source.akamai.com/projects/STORAGEENG/repos/ceph/pull-requests/147/overview
Hi, we have encountered a problem where one of our internal users reached their bucket quota. This caused a Denial of Service (DoS) on all RGW instances in the installation.
How to reproduce:
Why does it happens
When the quota is reached, the RGW quickly returns from the
process_requestmethod, but it still needs to dump all the data present in the socket. It does this in a loop, but only drains 1 KiB per read. The CPU starts spending all its time on context switches.How to fix
We can increase the buffer size to a larger value. I have checked and found that a 1 MiB buffer is sufficient, and it works fine on a local machine with 65k packets.
This fix can be easily backported to older versions.
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windowsjenkins test rook e2e