Repository navigation
Prevent cache entry timeout overrides from leaking - #9433
Conversation
Cache._purge_by_timeout decided each entry's expiry from a single local variable seeded once per category. An entry's own timeout overwrote it and the value was never reset for the next entry, so a per-entry timeout leaked sideways: entries stored after an overridden entry in the same category expired on the wrong schedule, including entries with no timeout at all. Reset the effective timeout per entry, falling back to the category's current timeout (which the lag-compensation branch may have doubled). Signed-off-by: Charan Rathore <[email protected]>
|
Thanks for the PR. I confirmed the new test fails on master and passes with the fix. A few things need fixing:
Also, none of the 12 |
Signed-off-by: Charan Rathore <[email protected]>
|
Thanks @ElliotGarbus - all four addressed:
And understood on selection: user-reported issues or the 3.0 list from here. |
|
@kuzeyron Ready to merge |
|
@kuzeyron I'd keep the explicit |
|
Thanks @kuzeyron for the merge, and @ElliotGarbus for the careful review. Signed-off-by: Charan Rathore [email protected] |
|
Successfully created backport PR for |
Closes #9431
Cache._purge_by_timeoutdecides each entry's expiry from a singletimeoutlocal that is seeded once per category and overwritten by any entry's own timeout, but never reset for the next entry. Because dict iteration is insertion order, a per-entry timeout leaks sideways onto whatever was stored after it in the same category: an entry withtimeout=10makes every later entry in that category expire on the same 10 second schedule, even when the entry and the category asked for no timeout at all. The leak only occurs for categories registered withtimeout=None- entries in a timed category always carry their own timeout (Cache.append()storestimeout or cat['timeout']), so that scenario is not affected (corrected after review, see #9431).The fix resets the effective timeout per entry, falling back to the category's current timeout (which the lag-compensation branch may have doubled), instead of carrying the previous entry's value forward.
Test evidence: a stub-harness regression test (monkeypatched clock) shows RED before the patch and GREEN after. The test covers the failing insertion order (timed entry before the untimed one); the reverse order never leaked, on master or with the fix. The full Kivy test suite needs the graphics build, so CI coverage applies here.