Project

General

Profile

Actions

Bug #21636

closed

keepstore S3 driver gets TokenExpiry errors when using automatic credentials / IAMRole feature

Added by Tom Clegg about 1 month ago. Updated 23 days ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
Keep
Story points:
0.5
Release relationship:
Auto

Description

We should be using the ExpiryWindow feature in the AWS SDK to avoid this.

We should also return 5xx instead of 404 if we get a TokenExpiry error while trying to read/write a block, so the client can retry.


Subtasks 2 (0 open2 closed)

Task #21637: Review 21636-s3-token-expiryResolvedTom Clegg04/05/2024Actions
Task #21641: Review 21636-s3-token-expiry-2.7ResolvedTom Clegg04/05/2024Actions
Actions #2

Updated by Brett Smith 27 days ago

I don't want to bikeshed this, but I am curious what the rationale is for setting ExpiryWindow to 1 minute. Given that the current behavior we're seeing suggests the expiry is ~24 hours, I probably would've set it on the order of 10-30 minutes: long enough to provide confidence that even painfully slow cloud API calls will have a valid token for their entire lifecycle, without excessive token cycling. But I'm not going to insist on that, especially if you've got basically any explanation for this value.

Am I following right that the reason the main branch only gets a test for returning 5xx, and no corresponding code changes, is because the keepstore rewrite already did that?

Thanks.

Actions #3

Updated by Tom Clegg 26 days ago

Brett Smith wrote in #note-2:

...rationale is for setting ExpiryWindow to 1 minute...

The SDK examples and defaults in other SDKs were 10-15 seconds and I thought that seemed too short. I've now looked further and found that the minimum session time is 15 minutes, and new credentials are documented to be available "at least 5 minutes" before the old ones expire, so I've updated to 5 minutes and added that doc link in a comment.

Am I following right that the reason the main branch only gets a test for returning 5xx, and no corresponding code changes, is because the keepstore rewrite already did that?

Yes, that's right.

Actions #4

Updated by Tom Clegg 26 days ago

  • Status changed from In Progress to Resolved
Actions #5

Updated by Peter Amstutz 26 days ago

Tom Clegg wrote in #note-3:

The SDK examples and defaults in other SDKs were 10-15 seconds and I thought that seemed too short. I've now looked further and found that the minimum session time is 15 minutes, and new credentials are documented to be available "at least 5 minutes" before the old ones expire, so I've updated to 5 minutes and added that doc link in a comment.

Hopefully it doesn't introduce a new race condition where credentials are available exactly at the 5 minute mark and the code tries to refresh it too soon...

Actions #6

Updated by Tom Clegg 24 days ago

Based on my reading of the aws-sdk-go-v2 code, if we refresh too soon, that just means we get credentials that expire in 5 minutes, which therefore get used only once for the current call, and then we refresh again next time.

Actions #7

Updated by Peter Amstutz 24 days ago

Tom Clegg wrote in #note-6:

Based on my reading of the aws-sdk-go-v2 code, if we refresh too soon, that just means we get credentials that expire in 5 minutes, which therefore get used only once for the current call, and then we refresh again next time.

So we probably get the old credentials back in that case and we end up having to refresh again anyway but it is unlikely to break?

Actions #8

Updated by Tom Clegg 24 days ago

Peter Amstutz wrote in #note-7:

So we probably get the old credentials back in that case and we end up having to refresh again anyway but it is unlikely to break?

Yes.

Actions

Also available in: Atom PDF