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

chore: refine error msg of aws sdk #11288

Merged
merged 5 commits into from
Jul 31, 2023
Merged

chore: refine error msg of aws sdk #11288

merged 5 commits into from
Jul 31, 2023

Conversation

xxchan
Copy link
Member

@xxchan xxchan commented Jul 27, 2023

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

#10993

example: (It's a little verbose and contains duplicated information, but at least provides the context)

Previously it's only ObjectStore(service error, #11198 improved a little bit (I didn't notice it), but I think this PR is more informative.

thread 'risingwave-main' panicked at 'called `Result::unwrap()` on an `Err` value: ObjectStore(s3 error: service error: unhandled error: unhandled error: Error { code: "PermanentRedirect", message: "The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.", s3_extended_request_id: "JBUS/ZK8NmPTgYdyfHblXQNwXWQJ/UWl6tXLaXRj+PaifWAnD9n/co08sMUijKa5FBxlUrcmDW4=", aws_request_id: "02H6QKP9NP8Y2HAR" } (ServiceError(ServiceError { source: Unhandled(Unhandled { source: ErrorMetadata { code: Some("PermanentRedirect"), message: Some("The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint."), extras: Some({"s3_extended_request_id": "JBUS/ZK8NmPTgYdyfHblXQNwXWQJ/UWl6tXLaXRj+PaifWAnD9n/co08sMUijKa5FBxlUrcmDW4=", "aws_request_id": "02H6QKP9NP8Y2HAR"}) }, meta: ErrorMetadata { code: Some("PermanentRedirect"), message: Some("The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint."), extras: Some({"s3_extended_request_id": "JBUS/ZK8NmPTgYdyfHblXQNwXWQJ/UWl6tXLaXRj+PaifWAnD9n/co08sMUijKa5FBxlUrcmDW4=", "aws_request_id": "02H6QKP9NP8Y2HAR"}) } }), raw: Response { inner: Response { status: 301, version: HTTP/1.1, headers: {"x-amz-bucket-region": "us-east-1", "x-amz-request-id": "02H6QKP9NP8Y2HAR", "x-amz-id-2": "JBUS/ZK8NmPTgYdyfHblXQNwXWQJ/UWl6tXLaXRj+PaifWAnD9n/co08sMUijKa5FBxlUrcmDW4=", "content-type": "application/xml", "transfer-encoding": "chunked", "date": "Thu, 27 Jul 2023 22:22:17 GMT", "server": "AmazonS3"}, body: SdkBody { inner: Once(Some(b"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>PermanentRedirect</Code><Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message><Endpoint>s3.amazonaws.com</Endpoint><Bucket>test-bucket</Bucket><RequestId>02H6QKP9NP8Y2HAR</RequestId><HostId>JBUS/ZK8NmPTgYdyfHblXQNwXWQJ/UWl6tXLaXRj+PaifWAnD9n/co08sMUijKa5FBxlUrcmDW4=</HostId></Error>")), retryable: true } }, properties: SharedPropertyBag(Mutex { data: PropertyBag { contents: ["aws_credential_types::cache::SharedCredentialsCache", "aws_sig_auth::signer::OperationSigningConfig", "aws_smithy_http::operation::Metadata", "aws_types::SigningService", "aws_types::region::Region", "aws_http::user_agent::AwsUserAgent", "aws_smithy_types::endpoint::Endpoint", "aws_sig_auth::middleware::Signature", "aws_smithy_http::connection::CaptureSmithyConnection", "aws_credential_types::credentials_impl::Credentials", "aws_sdk_s3::endpoint::Params", "aws_types::region::SigningRegion", "alloc::vec::Vec<http::version::Version>"] }, poisoned: false, .. }) } }))
  backtrace of `ObjectError`:
   0: std::backtrace_rs::backtrace::libunwind::trace

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR contains user-facing changes.
Click here for Documentation

Types of user-facing changes

Please keep the types that apply to your changes, and remove the others.

  • Installation and deployment
  • Connector (sources & sinks)
  • SQL commands, functions, and operators
  • RisingWave cluster configuration changes
  • Other (please specify in the release note below)

Release note

@codecov
Copy link

codecov bot commented Jul 27, 2023

Codecov Report

Merging #11288 (90ed2cf) into main (37565e5) will decrease coverage by 0.01%.
The diff coverage is 50.00%.

@@            Coverage Diff             @@
##             main   #11288      +/-   ##
==========================================
- Coverage   69.77%   69.77%   -0.01%     
==========================================
  Files        1359     1359              
  Lines      225184   225178       -6     
==========================================
- Hits       157125   157118       -7     
- Misses      68059    68060       +1     
Flag Coverage Δ
rust 69.77% <50.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
src/connector/src/source/kinesis/source/reader.rs 0.00% <ø> (ø)
src/meta/src/error.rs 17.07% <0.00%> (ø)
src/object_store/src/object/error.rs 47.05% <ø> (ø)
src/meta/src/hummock/manager/mod.rs 62.98% <100.00%> (+0.13%) ⬆️

... and 5 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Ok(metadata) => metadata,
Err(_) => {
return Err(ObjectError::internal(
"Fail to access remote object storage,
Copy link
Contributor

Choose a reason for hiding this comment

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

Here we want to see this error message every time meta fails to access object storage, and not only aws s3, but also gcs, oss...
So maybe we can not limite it to only aws error.

Copy link
Member Author

@xxchan xxchan Jul 28, 2023

Choose a reason for hiding this comment

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

It's not limited to AWS error. Here we just propagate the error, so the message is completely decided by the error itself.

The problem is AWS error's Display, which is fixed by this PR.

e.g., this is the panic msg of gcs (opendal)

thread 'risingwave-main' panicked at 'called `Result::unwrap()` on an `Err` value: ObjectStore(Unexpected (temporary) at Pager::next, context: { called: reqsign::LoadCredential, service: gcs, path: hummock_001/cluster_id/ } => loading credential to sign http request, source: error sending request for url (http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token?scopes=https://www.googleapis.com/auth/devstorage.read_write): error trying to connect: dns error: failed to lookup address information: nodename nor servname provided, or not known
  backtrace of `ObjectError`:

BTW, opendal even has other logging

2023-07-28T12:56:18.140486+02:00 ERROR opendal::services: service=gcs operation=list path=hummock_001/cluster_id/ -> failed: Unexpected (temporary) at Pager::next => loading credential to sign http request

Context:
    called: reqsign::LoadCredential
    service: gcs
    path: hummock_001/cluster_id/

Source: error sending request for url (http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token?scopes=https://www.googleapis.com/auth/devstorage.read_write): error trying to connect: dns error: failed to lookup address information: nodename nor servname provided, or not known

Caused by:
    0: error trying to connect: dns error: failed to lookup address information: nodename nor servname provided, or not known
    1: dns error: failed to lookup address information: nodename nor servname provided, or not known
    2: failed to lookup address information: nodename nor servname provided, or not known

Stack backtrace:
   0: std::backtrace_rs::backtrace::libunwind::trace

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm also comfortable to add more error message here, or panic directly. But we should at least also provide the original error message, which turns out to be very informative.

And personally I think "please check if your Access Key and Secret Key are configured correctly" is not always true and can be misleading, so I removed it.

@xxchan xxchan requested a review from wcy-fdu July 28, 2023 11:03
@wcy-fdu wcy-fdu requested review from wcy-fdu and zwang28 July 31, 2023 07:25
Copy link
Contributor

@zwang28 zwang28 left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

@xxchan xxchan added this pull request to the merge queue Jul 31, 2023
Merged via the queue into main with commit cf13f7a Jul 31, 2023
@xxchan xxchan deleted the xxchan/err branch July 31, 2023 10:51
xxchan added a commit that referenced this pull request Jul 31, 2023
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.

3 participants