tests: fix flaky WATCHed-key-expired EXEC test under Valgrind - #4441
tests: fix flaky WATCHed-key-expired EXEC test under Valgrind#4441Xsidz wants to merge 1 commit into
Conversation
Under Valgrind the server processes commands 100–1000x slower than normal. The test sets a key with a 50 ms TTL and then immediately WATCHes it. If Valgrind's overhead causes the WATCH to be processed more than 50 ms after the SET, keyIsExpired() fires inside watchForKey() and marks the key as "already expired when WATCHed" (wk->expired = 1). isWatchedKeyExpired() then skips the key (line 457: "if (wk->expired) continue"), so EXEC commits instead of aborting, and the test fails. Scale the TTL (50 ms → 5 s) and the wait (100 ms → 10 s) when running under Valgrind so that the WATCH is always processed before the TTL elapses and the wait is always long enough for expiry to occur before EXEC. Fixes valkey-io#4407 Signed-off-by: Siddhesh Kabra <siddhesh.kabraa@gmail.com> Signed-off-by: Xsidz <siddhesh.kabraa@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe WATCH expiration regression test now uses longer TTL and wait durations under Valgrind. Non-Valgrind runs retain the existing durations. ChangesWATCH expiration regression test
Estimated code review effort: 2 (Simple) | ~5 minutes Merge Risk: ⚪ Minimal · up to This PR adjusts test timing for Valgrind environments without changing production behavior; no actionable merge-blocking risk remains. Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
WATCHed key in another slot that expired aborts EXECtest when running under Valgrind.Root cause
Under Valgrind the server processes commands 100–1000x slower than
normal. The test sets a key with a 50 ms TTL and immediately WATCHes
it. If Valgrind's overhead causes WATCH to be processed more than 50 ms
after SET,
keyIsExpired()fires insidewatchForKey()and marks thekey as "already expired when WATCHed" (
wk->expired = 1).isWatchedKeyExpired()then skips the key (if (wk->expired) continue—
multi.c:457), so EXEC commits instead of aborting and the assertionassert_equal {} $replyfails.The same CI run that triggered issues #4435/#4436 also triggered this
failure three times consecutively on
test-valgrind-test-clusterandtest-valgrind-no-malloc-usable-size-test-cluster.Fix
Use
$::valgrind(already available in the test framework) to scalethe TTL (50 ms → 5 s) and the wait (100 ms → 10 s) so that:
Valgrind.
Test plan
./runtest-cluster --single tests/unit/cluster/misc.tclpasses locally (non-Valgrind)Fixes #4407
Signed-off-by: Siddhesh Kabra siddhesh.kabraa@gmail.com