-
Notifications
You must be signed in to change notification settings - Fork 73
Description
Describe the feature
We had some DB connections fail after when using this driver and IAM authentication. This was fixed by 2.1.2 and newer via #456 and #457.
But I don't think this code path should have triggered at all, because tokens should be refreshed in time.
In the logs, we still see a few "pam_authenticate failed: Permission denied" every hour. This will be very confusing when diagnosing other issues. I also expect
Use Case
No unnecessary reconnects, stable latency. No confusing log messages about expired token.
Proposed Solution
I would expect there to be a small grace period to prevent "TOCTTOU" race conditions, where the client code thinks it is valid when checking it, but the token is invalid when the server side receives and validates it.
This code uses exactly 900 seconds as a default. Subtracting somewhere between 2-30 seconds should be enough.
This should also improve P99 latencies.
You could also consider background refreshes, but I'm not sure if that's a good idea, it certainly adds complexity.
Other Information
No response
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
The AWS Advanced JDBC Driver version used
2.1.2+
JDK version used
17
Operating System and version
bottlerocket