Repository navigation
Possible missed FlushTo dispatch when slice ID is allocated asynchronously #7427
njutli
started this conversation in
Show and tell
Replies: 1 comment 1 reply
|
Thanks for the analysis. You are right that this race condition exists, and we may consider a more fundamental fix later by assigning and setting slice IDs atomically. Regarding your patch, our tests on the main branch show that the improvement is not significant. For now, we recommend upgrading JuiceFS to the latest version directly. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
While running randwrite performance tests on JuiceFS v1.3.1 with 256 KiB block size and --max-fuse-io 256K, we observed throughput dropping from ~1900 to ~560 MiB/s. After investigation, we suspect the root cause is in pkg/vfs/writer.go: prepareID runs as a goroutine and is blocked by the same fileWriter mutex held by writeChunk, so s.id is always 0 when write checks s.id > 0 — FlushTo is skipped, and SetID later does not revisit the missed dispatch.
On v1.3.1 this causes a visible throughput collapse due to buffer throttle self-lock. On main the same race code exists but doesn't cause a visible collapse — likely because the commitThread lock management changes allow faster fallback drainage.
We've prepared a minimal fix (7 lines, preserving the async design) with deterministic regression tests. Not sure if this is already known or being worked on — would appreciate any feedback.
Details: https://github.com/njutli/bug-report/tree/main/juicefs-vfs-flush-dispatch-race
All reactions