aws / aws/aws-sdk-java-v2

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

Aperta
#6,550 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
feature-request needs-triage
Lingua principale
Java
Stelle
2.6k
Fork
1k
Merge medio
2g 9h
PR unite (30g)
51

Descrizione

### 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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Iniziare tracciando i percorsi di risoluzione della regione gestita dall’SDK e di costruzione dell’endpoint AWS descritti nell’issue, riproducendo la regione nulla a partire dall’ambiente o dagli input di ~/.aws/config. Verificare che un endpoint AWS con una regione nulla fallisca prima della prima chiamata remota e segnali il problema di risoluzione, invece di costruire un nome host null.amazonaws.com.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
aws, java
Ambito
backend, cloud
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.