-
Couldn't load subscription status.
- Fork 66
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What happened in your environment?
ICacheStore *ICachePool::open(std::string_view filename, int flags, mode_t mode) {
// ...
auto len = this->fn_trans_func(filename, store_name, sizeof(store_name));
std::string_view store_sv = len ? std::string_view(store_name, len) : filename;
auto ctor = [&]() -> ICacheStore * {
// ...
cache_store->set_src_name(filename);
// ...
};
auto store = cast(m_stores)->acquire(store_sv, ctor);
if (store) {
auto cnt = store->ref_.fetch_add(1, std::memory_order_relaxed);
if (cnt)
cast(m_stores)->release(store_sv);
}
return store;
}
If we call cached_fs->open("/foo/sha256:111") and cached_fs->open("/bar/sha256:111") in sequence, both files will refill from /foo/sha256:111. Which means if repository foo is deleted at some point, all requests to the layer sha256:111 will fail. Furthermore, if retries occur frequently, failures may persist indefinitely. (m_stores keeps for 10 seconds).
What did you expect to happen?
The request to /bar/sha256:111 should succeed or succeed after a retry period.
How can we reproduce it?
Add following lines at this unit test, which can be used to verify this issue.
TEST(CachedFS, fn_trans_func) {
// ...
EXPECT_STREQ("/path_aaa/sha256:test", cs1->get_src_name().data());
EXPECT_STREQ("/path_bbb/sha256:test", cs2->get_src_name().data());
}
What is the version of your Overlaybd?
v1.0.16
What is your OS environment?
any
Are you willing to submit PRs to fix it?
- Yes, I am willing to fix it.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working