Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[misc] Show suggestion when locking metadata.lock fails #6919

Merged
merged 1 commit into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions taichi/cache/gfx/cache_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ CacheManager::CacheManager(Params &&init_params)
if (exists && lock_with_file(lock_path)) {
auto _ = make_cleanup([&lock_path]() {
if (!unlock_with_file(lock_path)) {
TI_WARN("Unlock {} failed", lock_path);
TI_WARN(
"Unlock {} failed. You can remove this .lock file manually and "
"try again.",
lock_path);
}
});
gfx::AotModuleParams params;
Expand Down Expand Up @@ -172,7 +175,10 @@ void CacheManager::dump_with_merging() const {
if (lock_with_file(lock_path)) {
auto _ = make_cleanup([&lock_path]() {
if (!unlock_with_file(lock_path)) {
TI_WARN("Unlock {} failed", lock_path);
TI_WARN(
"Unlock {} failed. You can remove this .lock file manually and "
"try again.",
lock_path);
}
});

Expand Down
19 changes: 15 additions & 4 deletions taichi/runtime/llvm/llvm_offline_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,17 @@ bool LlvmOfflineCacheFileReader::load_meta_data(
if (lock_with_file(lock_path)) {
auto _ = make_cleanup([&lock_path]() {
if (!unlock_with_file(lock_path)) {
TI_WARN("Unlock {} failed", lock_path);
TI_WARN(
"Unlock {} failed. You can remove this .lock file manually and try "
"again.",
lock_path);
}
});
return Error::kNoError == load_metadata_with_checking(data, tcb_path);
}
TI_WARN("Lock {} failed", lock_path);
TI_WARN(
"Lock {} failed. You can remove this .lock file manually and try again.",
lock_path);
return false;
}

Expand Down Expand Up @@ -313,12 +318,18 @@ void LlvmOfflineCacheFileWriter::dump(const std::string &path,
// metadata file format to reduce overhead.
std::string lock_path = taichi::join_path(path, kMetadataFileLockName);
if (!lock_with_file(lock_path)) {
TI_WARN("Lock {} failed", lock_path);
TI_WARN(
"Lock {} failed. You can remove this .lock file manually and try "
"again.",
lock_path);
return;
}
auto _ = make_cleanup([&lock_path]() {
if (!unlock_with_file(lock_path)) {
TI_WARN("Unlock {} failed", lock_path);
TI_WARN(
"Unlock {} failed. You can remove this .lock file manually and try "
"again.",
lock_path);
}
});

Expand Down
5 changes: 4 additions & 1 deletion taichi/util/lock.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ inline bool lock_with_file(const std::string &path,
inline RaiiCleanup make_unlocker(const std::string &path) {
return make_cleanup([&path]() {
if (!unlock_with_file(path)) {
TI_WARN("Unlock {} failed", path);
TI_WARN(
"Unlock {} failed. You can remove this .lock file manually and try "
"again.",
path);
}
});
}
Expand Down
10 changes: 8 additions & 2 deletions taichi/util/offline_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,19 @@ class CacheCleaner {
std::string lock_path =
taichi::join_path(path, config.metadata_lock_name);
if (!lock_with_file(lock_path)) {
TI_WARN("Lock {} failed", lock_path);
TI_WARN(
"Lock {} failed. You can remove this .lock file manually and try "
"again.",
lock_path);
return;
}
auto _ = make_cleanup([&lock_path]() {
TI_DEBUG("Stop cleaning cache");
if (!unlock_with_file(lock_path)) {
TI_WARN("Unlock {} failed", lock_path);
TI_WARN(
"Unlock {} failed. You can remove this .lock file manually and "
"try again.",
lock_path);
}
});
TI_DEBUG("Start cleaning cache");
Expand Down