-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(wasm): do not call attach() on re-entrancy #12402
Conversation
e4e9770
to
379e9ba
Compare
fcfd6be
to
aa8b8a1
Compare
aa8b8a1
to
ae76e6c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still a bit surprised that calling proxy_wasm.start
a second time works (i.e. that the last bit doesn't need to be inside the if
block as well), but the changes done here definitely don't hurt, so if you managed to test this manually and get an improvement in behavior with this branch as-is, it's an LGTM from me!
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin release/3.4.x
git worktree add -d .worktree/backport-12402-to-release/3.4.x origin/release/3.4.x
cd .worktree/backport-12402-to-release/3.4.x
git switch --create backport-12402-to-release/3.4.x
git cherry-pick -x 4d03ca45edfa54c76e5d2d4271892f37b7524ddd |
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin release/3.5.x
git worktree add -d .worktree/backport-12402-to-release/3.5.x origin/release/3.5.x
cd .worktree/backport-12402-to-release/3.5.x
git switch --create backport-12402-to-release/3.5.x
git cherry-pick -x 4d03ca45edfa54c76e5d2d4271892f37b7524ddd |
(cherry picked from commit 4d03ca4)
Successfully created cherry-pick PR for |
Successfully created backport PR for |
(cherry picked from commit 4d03ca4)
(cherry picked from commit 4d03ca4)
(cherry picked from commit 4d03ca4) Co-authored-by: Michael Martin <[email protected]>
Calling |
Summary
kong.runloop.wasm.attach()
may be called more than once when filters utilize thedispatch_http_call
proxy-wasm SDK function. Previously this was assumed to be false, which can yield errors like this one:This adds a
ngx.ctx
check and avoids callingproxy_wasm.attach()
in this case.Unfortunately it is incredibly non-trivial to add a test case for this at the moment, but the behavior change/correctness has been validated by hand.
Checklist
changelog/unreleased/kong
orskip-changelog
label added on PR if changelog is unnecessary. README.mdThere is a user-facing docs PRIssue reference
KAG-3603