ilidemi opened a new issue, #2264: URL: https://github.com/apache/iceberg-go/issues/2264
### Apache Iceberg version main (development) ### Please describe the bug 🐞 `Oauth2AuthManager.AuthHeaderWithContext` checks `ctx.Err()` once and then calls `tokenSource.Token()` synchronously. When the cached token has expired and the token endpoint stalls, the caller blocks until the token-refresh client's `Timeout` fires (60s by default), regardless of its own, shorter deadline or cancellation. `sessionTransport` calls this before the request ever reaches the transport, so a request deadline bounds the request but not the authentication step in front of it. Concurrent callers make it worse. `oauth2.ReuseTokenSource` serializes `Token()` under a mutex and does not remember failures, so N callers waiting on a stalled endpoint each run their own full-timeout attempt in turn. The last one is released after roughly N × 60s. This was identified earlier, during review of #1655 (https://github.com/apache/iceberg-go/pull/1655#discussion_r3737958963), where the suggested fix was to thread the context through auth retrieval, including the built-in OAuth refresh. The 60s client `Timeout` landed as the fallback bound; the context-aware path still cannot interrupt a refresh in progress. **Expected:** a caller whose context is done stops waiting, and concurrent callers share a single in-flight refresh. The refresh itself may keep running, bounded by the client `Timeout`, and its result should serve later callers. **Reproduce:** build an `Oauth2AuthManager` from a `clientcredentials.Config` whose token endpoint never responds, then call `AuthHeaderWithContext` with a 50ms deadline. The call does not return until the 60s client timeout. With five concurrent callers against a token source that counts `Token()` calls, five calls are made instead of one. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
