Break WASIp3 HTTP server ownership cycle - #3704
Merged
fibonacci1729 merged 1 commit intoSep 1, 2026
Merged
Conversation
Signed-off-by: carsonfarmer <carson.farmer@gmail.com> Co-authored-by: Codex <noreply@openai.com>
carsonfarmer
force-pushed
the
codex/fix-wasip3-http-server-cycle
branch
from
August 31, 2026 22:17
77b1db7 to
ea32a8e
Compare
Collaborator
|
@carsonfarmer Thanks for the report and the PR. It looks good to my inexpert eye, but I've flagged a couple of knowledgeable folks for a review. For our guidance, how urgent is this for you? And would you require it in a release, or do you pin to a SHA? |
Contributor
Author
|
I'm just pinning to sha, so no rush on this honestly. |
dicej
approved these changes
Sep 1, 2026
dicej
left a comment
Contributor
There was a problem hiding this comment.
Thanks so much for catching, fixing, and adding a test for this, @carsonfarmer!
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.
Fixes #3703.
The WASIp3 handler state stored a strong reference to
HttpServer. The server also owns that handler state. After the first WASIp3 request, these references kept each other alive and prevented the server and its application state from being released.This change stores a weak reference in the handler state. Spin upgrades it while it creates a new WASIp3 worker. If the server is already gone, worker creation returns an error.
The regression test sends two single-use WASIp3 requests. It then drops the in-process server and verifies that the server was released. The test failed on upstream
mainbefore the production change and passes with this change.Active workers can still keep the server alive until they end. This change only removes the permanent server-to-handler-to-server reference cycle.
No dependencies or services were added.
Tests
make lintmake buildcargo test -p spin-trigger-http --no-fail-fast -- --nocapturecargo test --test integration wasi_http_p3 -- --nocapturecargo test --test integration wasip3_handler_does_not_retain_http_server -- --nocapture