S3 backend: when a txaws operation gets an error response, include the full request URI and response body in the exception message, and maybe trigger an incident #1589
Labels
No Label
0.2.0
0.3.0
0.4.0
0.5.0
0.5.1
0.6.0
0.6.1
0.7.0
0.8.0
0.9.0
1.0.0
1.1.0
1.10.0
1.10.1
1.10.2
1.10a2
1.11.0
1.12.0
1.12.1
1.13.0
1.14.0
1.15.0
1.15.1
1.2.0
1.3.0
1.4.1
1.5.0
1.6.0
1.6.1
1.7.0
1.7.1
1.7β
1.8.0
1.8.1
1.8.2
1.8.3
1.8β
1.9.0
1.9.0-s3branch
1.9.0a1
1.9.0a2
1.9.0b1
1.9.1
1.9.2
1.9.2a1
LeastAuthority.com automation
blocker
cannot reproduce
cloud-branch
code
code-dirnodes
code-encoding
code-frontend
code-frontend-cli
code-frontend-ftp-sftp
code-frontend-magic-folder
code-frontend-web
code-mutable
code-network
code-nodeadmin
code-peerselection
code-storage
contrib
critical
defect
dev-infrastructure
documentation
duplicate
enhancement
fixed
invalid
major
minor
n/a
normal
operational
packaging
somebody else's problem
supercritical
task
trivial
unknown
was already fixed
website
wontfix
worksforme
No Milestone
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Reference: tahoe-lafs/trac-2024-07-25#1589
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The exception message shouldn't include secrets (AWS secret key, user token or product token), or data, but the request URI and the body of error responses are short enough to include in full. In particular the response code, which txaws currently drops, would be useful. We don't send any caps in S3 requests.
It would also be useful to trigger an incident for errors that we don't understand or haven't seen before (probably based on the HTTP response code).
S3 backend: when a txaws operation gets an error response, include the full request URI and response body in the exception messageto S3 backend: when a txaws operation gets an error response, include the full request URI and response body in the exception message, and maybe trigger an incidenttxaws is preserving the
xml_bytes
,status
, andresponse
in the args of theS3Error
object (so we don't need a txaws patch), but they are not being included in the stringified form of the exception (line 58 of txaws/exception.py).So, we need an errback, probably after each operation in source:ticket999-S3-backend/src/allmydata/storage/backends/s3/s3_bucket.py, that extracts this information, logs it, and raises another exception that includes it in the error message.
Attachment fix-1589.darcs.patch (62005 bytes) added
Make S3 error tracebacks include the status code and response, and trigger an incident. fixes #1589
On line 313 of the patch, the error string should be:
"was supposed to raise TahoeS3Error, not get %r"
patch review:
I guess it is redundant but not harmful to say that class
S3Bucket
implements(IS3Bucket)
, since it now subclassesS3BucketMixin
whichimplements(IS3Bucket)
. I would tend to err on the side of removing that declaration from classS3Bucket
, but I could go either way.Why do we need both the
f.trap(self.S3Error)
and theexcept self.S3Error
? Don't those both mean the same thing -- one for twisted Failure instances and the other for Python Error instances? Don't we know which of those two types we might encounter there?Other than that, I saw no problems with it.
Replying to zooko:
S3BucketMixin
doesn't actually implementS3Bucket
(and shouldn't, since it only implements one helper method).The intention is to preserve the exception traceback. The
trap
call does so when the exception is not aself.S3Error
(because it's preserving the sameFailure
), and theexcept
clause does so (using the 3-arg form ofraise
) when it is. Theexcept
clause depends on the exception object being anS3Error
orMockS3Error
. I don't know of any other way to preserve the traceback than to raise and catchf.value
.(I attempted to just change the behaviour of stringification by setting
f.value.__str__
rather than using a different exception class, but was stymied by what I consider to be a bug in CPython --str(x)
is equivalent tox.__class__.__str__(x)
and not tox.__str__()
as the documentation implies, so setting__str__
on an instance does not work.)The other alternative would be to change
AWSError.__str__
in txaws. That might be more elegant, but I would prefer to minimize the changes in our txaws fork.This is ready to push to the ticket999-S3-backend branch, but I'm going to delay that until I also push the patch on #1678.
The attached code is related to issues documented in ticket #1590. In particular, that ticket notes the need for more explicit handling/reporting of error information generated by the txaws S3 client's transactions with AWS S3 buckets.
Replying to zancas:
Actually it only improves the logging related to #1590.
This was fixed in [5548/ticket999-S3-backend] and improved most recently in [5647/ticket999-S3-backend].
Milestone renamed
renaming milestone