vfs/cache: Fix TestTieredCache_Concurrent data race with promoteToFast #21
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
maintipa2ac13d317d6(merge of disk insertBatch fix via #19/#20) fails CI run 1152 undergo test -raceinvfs/cache.Disk package is green. This is a separate race.
Failure (CI #1152)
TestTieredCache_Concurrent— DATA RACETestTieredCache_PromotionFallback— race detected (likely cross-talk / same root)Race report sketch:
vfs/memory.(*memoryWriteCloser).Closeatmemory.go:178from test goroutinecache_test.go:117(TestTieredCache_Concurrent.func1)(*TieredCache).promoteToFastatcache.go:194fromOpenbackground promote (cache.go:85)So promote reads memory buffer/state while a writer Close mutates it (or the reverse: concurrent Close vs promote copy).
Wanted
TieredCachepromote path (and/or memory WriteCloser lifetime) so Close cannot race promoteToFast.go test -racegreen for./vfs/cache(and full./...).go test -race -count=20 -shuffle=on ./vfs/cachelocally green.develop. Commit stylearea: Imperative summary. Do not merge yourself.#21in the PR body (Gitea closes issues on any#Nin merge text). Link this issue with a full URL if you mention it.Out of scope
Revert
Normal
git revertof the PR commit(s). No DB.Next action: Ash owns one PR (develop → then main). Main tip red on CI run 1152 (
TestTieredCache_ConcurrentClose vspromoteToFastrace). Prove withgo test -race -count=20 -shuffle=on ./vfs/cache. Do not merge yourself.