fix: wasm remote code fetch race writing negative cache entry - #46674
Open
eformat wants to merge 1 commit into
Open
fix: wasm remote code fetch race writing negative cache entry#46674eformat wants to merge 1 commit into
eformat wants to merge 1 commit into
Conversation
eformat
had a problem deploying
to
external-contributors
August 12, 2026 22:28 — with
GitHub Actions
Error
|
Hi @eformat, welcome and thank you for your contribution. We will try to review your Pull Request as quickly as possible. In the meantime, please take a look at the contribution guidelines if you have not done so already. |
Signed-off-by: Mike Hepburn <eformat@gmail.com>
eformat
force-pushed
the
wasm-thread-load-fix
branch
from
August 12, 2026 22:29
61bf740 to
74dc928
Compare
eformat
requested a deployment
to
external-contributors
August 12, 2026 22:29 — with
GitHub Actions
Waiting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
● Problem
When multiple Envoy worker threads simultaneously call createWasm() for a remote wasm plugin, Thread A starts the
HTTP fetch and marks the cache entry in_progress = true. Threads B–N find the entry in_progress, call cb(nullptr)
to signal failure, then fall through (missing return) to the code.empty() block. There, they write a negative cache
entry (TTL=10s) and start competing fetch attempts. Thread A's successful download is now racing against a
poisoned negative cache. For the next 10 seconds, any new call to createWasm() hits RemoteLoadCacheNegativeHit and
immediately fails, holding all wasm-filtered requests for up to 10 seconds before fail_open releases them.
● Fix
Add return false immediately after cb(nullptr) in the in_progress branch. Threads B–N still signal failure to the
plugin (allowing fail_open to pass the request through), but they no longer fall through to write the negative
cache entry or start duplicate fetches. Thread A's download completes uncontested, populates the cache as a
successful hit, and all subsequent requests resolve instantly.
● Impact