Skip to content

if region resolves to "null" and endpoint == aws then fail fast #6550

@steveloughran

Description

@steveloughran

Describe the feature

If the SDK region resolution process ever ends up with "null.amazonaws.com" then the caller will get an unknown host exception whenever the first remote call is made. By which time it's hard to work out where that "null" string got in.

Proposed: fail fast

Use Case

SDK-managed region resolution outside EC2 is playing up in forked processes, and I end up with stack traces

java.net.UnknownHostException: getFileStatus on s3a://stevel-london/test/ITestS3ACommitterMRJob-execute-magic/_SUCCESS: software.amazon.awssdk.core.exception.SdkClientException: Received an UnknownHostException when attempting to interact with a service. See cause for the exact endpoint that is failing to resolve. If this is happening on an endpoint that previously worked, there may be a network connectivity issue or your DNS cache could be storing endpoints for too long.:    software.amazon.awssdk.core.exception.SdkClientException: Received an UnknownHostException when attempting to interact with a service. See cause for the exact endpoint that is failing to resolve. If this is happening on an endpoint that previously worked, there may be a network connectivity issue or your DNS cache could be storing endpoints for too long.: stevel-london.s3.null.amazonaws.com

this helpful message is in fact misleading; the issue is that "null.amazonaws.com" isn't and is unlikely to ever be an aws region. And the root cause of that is somehow from env var or ~/.aws/config lookup the region become null; this wasn't picked up as a resolution failure, but instead propagated to hostname construction.

No idea about how that is happening: that's my problem

Proposed Solution

Proposed

  • if the resolved region is ever null and the endpoint is under amazonaws.com: fail fast
  • if the string value of the resolved region is null, the same.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS Java SDK version used

2.29.52

JDK version used

not clear. maybe java17, maybe java 8.

Operating System and version

macos

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestA feature should be added or improved.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions