We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 075fe28 commit c2fef63Copy full SHA for c2fef63
sycl/source/detail/persistent_device_code_cache.cpp
@@ -239,9 +239,19 @@ void PersistentDeviceCodeCache::repopulateCacheSizeFile(
239
continue;
240
} else {
241
// Calculate the size of the cache directory.
242
- // During directory size calculation, do not add anything
243
- // in the cache. Otherwise, we'll get a std::fs_error.
244
- size_t CacheSize = getDirectorySize(CacheRoot);
+ size_t CacheSize = 0;
+
+ // getDirectorySize can throw if any new file is created or removed
245
+ // in the cache by some other process. Retry in that case.
246
+ while (true) {
247
+ try {
248
+ CacheSize = getDirectorySize(CacheRoot);
249
+ break;
250
+ } catch (...) {
251
+ CacheSize = 0;
252
+ continue;
253
+ }
254
255
256
std::ofstream FileStream{CacheSizeFile};
257
FileStream << CacheSize;
0 commit comments