ajayvembu commented on code in PR #15869:
URL: https://github.com/apache/iceberg/pull/15869#discussion_r3164809987
##########
azure/src/main/java/org/apache/iceberg/azure/adlsv2/ADLSFileIO.java:
##########
@@ -134,6 +155,7 @@ DataLakeFileSystemClient client(ADLSLocation location) {
synchronized (this) {
if (clientCache == null) {
clientCache = Maps.newConcurrentMap();
+ scheduleCredentialRefresh();
Review Comment:
I noticed a potential race condition here with the background timers. When
the credentials refresh, the cache is nullified. The next time client(location)
is called, it will rebuild the cache and blindly call
scheduleCredentialRefresh() again, even if a timer was already scheduled by the
background timer thread. This might lead to exponential timer threads being
spawned over the life time of a long running Flink job. We probably need a
check here like if (refreshFuture == null || refreshFuture.isDone()) before
scheduling invoking scheduleCredentialRefresh();
```
DataLakeFileSystemClient client(ADLSLocation location) {
if (clientCache == null) {
synchronized (this) {
if (clientCache == null) {
clientCache = Maps.newConcurrentMap();
if (refreshFuture == null || refreshFuture.isCancelled() ||
refreshFuture.isDone()) {
scheduleCredentialRefresh();
}
}
}
}
String cacheKey = location.host() + "/" +
location.container().orElse("");
return clientCache.computeIfAbsent(cacheKey, k -> buildClient(location));
}
```
--
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]