Stream: git-wasmtime

Topic: wasmtime / PR #14805 wasmtime-cache: Compute cleanup thre...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 11:03):

clippytool opened PR #14805 from clippytool:cache-cleanup-threshold-overflow to bytecodealliance:main:

Fixes https://github.com/bytecodealliance/wasmtime/issues/14804

CacheConfig::validate bounds the two *-limit-percent-if-deleting settings to
0-100, but nothing bounds file-count-soft-limit and
files-total-size-soft-limit, which are plain u64 values. The cleanup task
computed the deletion threshold as
limit.checked_mul(percent as u64).unwrap() / 100, so a valid configuration
such as file-count-soft-limit = "18446744073709551615" with 70% panics with
called Option::unwrap() on a None value as soon as the first cleanup runs. The
panic is on the cache worker thread, so the CLI keeps running with a
permanently dead cache worker.

This computes the percentage without widening the type and without overflowing
any intermediate: value / 100 * percent + (value % 100) * percent / 100 is
exactly floor(value * percent / 100), and neither term exceeds value for
percent <= 100. Large soft limits stay usable as an "effectively unlimited"
setting, so no new bound is added to the validation.

Tests:

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 11:03):

clippytool requested dicej for a review on PR #14805.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 11:03):

clippytool requested wasmtime-core-reviewers for a review on PR #14805.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 16:04):

:thumbs_up: dicej submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 16:04):

:speech_balloon: dicej created PR review comment:

Nit: more parenthesis here would make this expression easier to read (e.g. to emphasize that it's (value / 100) * percent ... rather than value / (100 * percent) ...), rather than rely on implicit operator precedence and associativity.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 20:23):

clippytool updated PR #14805.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 20:25):

:memo: clippytool submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 20:25):

:speech_balloon: clippytool created PR review comment:

Good point, done in 305c0ee — both the expression and the formula in the doc
comment now spell out the grouping:

(value / 100) * percent + ((value % 100) * percent) / 100

No behavior change; cargo test -p wasmtime-internal-cache still passes
(24 lib + 1 integration test).

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 21:59):

dicej added PR #14805 wasmtime-cache: Compute cleanup thresholds without overflowing to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 22:38):

:check: dicej merged PR #14805.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 22:38):

dicej removed PR #14805 wasmtime-cache: Compute cleanup thresholds without overflowing from the merge queue.


Last updated: Oct 31 2026 at 23:03 UTC