Skip to content

Commit

Permalink
Fix data race in cache eviction path (#11193)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #11193

The cache entry init code path (thread) logs an error message with cache entry size when allocation fails.
This happens after it releases the cache entry which could be race with cache eviction code path which clears
to zero. The fix is to print out the allocated pages instead of bytes in cache error message to prevent.

Reviewed By: kevinwilfong, zacw7

Differential Revision: D64014938

fbshipit-source-id: d752c6bf13e404c9a3553dd548795ec5534e961b
  • Loading branch information
xiaoxmeng authored and facebook-github-bot committed Oct 8, 2024
1 parent 74c2133 commit 640592d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions velox/common/caching/AsyncDataCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ void AsyncDataCacheEntry::initialize(FileCacheKey key) {
// No memory to cover 'this'.
release();
VELOX_CACHE_ERROR(fmt::format(
"Failed to allocate {} bytes for cache: {}",
size_,
"Failed to allocate {} pages for cache: {}",
sizePages,
cache->allocator()->getAndClearFailureMessage()));
}
}
Expand Down

0 comments on commit 640592d

Please sign in to comment.