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

Fetching IMDSv2 token should have timeout for read #104244

Closed
ywangd opened this issue Jan 11, 2024 · 1 comment · Fixed by #104253 or #104407
Closed

Fetching IMDSv2 token should have timeout for read #104244

ywangd opened this issue Jan 11, 2024 · 1 comment · Fixed by #104253 or #104407
Labels
:Distributed/Discovery-Plugins Anything related to our integration plugins with EC2, GCP and Azure >enhancement Team:Distributed Meta label for distributed team

Comments

@ywangd
Copy link
Member

ywangd commented Jan 11, 2024

We configure connectTimeout for fetching token from IMDSv2's token API.

However, we do not have timeout for reading from the connection. Therefore, the read can get stuck* indefinitely

Since we rely on error or empty respnose from the token API to fallback to IMDSv1 (#84410), stucking at reading prevents the fallback mechanism to work.

[*] One reason for read to stuck is that the request needs more than 1 hop https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-metadata-v2-how-it-works.html

@ywangd ywangd added >enhancement :Distributed/Discovery-Plugins Anything related to our integration plugins with EC2, GCP and Azure labels Jan 11, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Meta label for distributed team label Jan 11, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

arteam added a commit that referenced this issue Jan 16, 2024
Use the timeout set by AWS_METADATA_SERVICE_TIMEOUT environment variable both as connect and read timeout analogous to the AWS SDK.

See https://docs.aws.amazon.com/sdkref/latest/guide/feature-ec2-instance-metadata.html

Resolves #104244
arteam added a commit to arteam/elasticsearch that referenced this issue Jan 16, 2024
Use the timeout set by AWS_METADATA_SERVICE_TIMEOUT environment variable both as connect and read timeout analogous to the AWS SDK.

See https://docs.aws.amazon.com/sdkref/latest/guide/feature-ec2-instance-metadata.html

Resolves elastic#104244
costin pushed a commit to costin/elasticsearch that referenced this issue Jan 17, 2024
Use the timeout set by AWS_METADATA_SERVICE_TIMEOUT environment variable both as connect and read timeout analogous to the AWS SDK.

See https://docs.aws.amazon.com/sdkref/latest/guide/feature-ec2-instance-metadata.html

Resolves elastic#104244
jedrazb pushed a commit to jedrazb/elasticsearch that referenced this issue Jan 17, 2024
Use the timeout set by AWS_METADATA_SERVICE_TIMEOUT environment variable both as connect and read timeout analogous to the AWS SDK.

See https://docs.aws.amazon.com/sdkref/latest/guide/feature-ec2-instance-metadata.html

Resolves elastic#104244
arteam added a commit that referenced this issue Jan 17, 2024
Resubmit of #104397 without setting AWS_METADATA_SERVICE_TIMEOUT randomly in the build.

```
    Use the timeout set by AWS_METADATA_SERVICE_TIMEOUT environment variable both as connect and read timeout analogous to the AWS SDK.
    See https://docs.aws.amazon.com/sdkref/latest/guide/feature-ec2-instance-metadata.html
```

Resolves #104244
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed/Discovery-Plugins Anything related to our integration plugins with EC2, GCP and Azure >enhancement Team:Distributed Meta label for distributed team
Projects
None yet
2 participants