-
Notifications
You must be signed in to change notification settings - Fork 5.6k
wasm: fix multiple bug of vm key and plugin key calculation #46893
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
Open
wbpcode
wants to merge
3
commits into
envoyproxy:main
Choose a base branch
from
wbpcode:dev-unify-filter-factories-wasm
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+454
−170
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
7 changes: 7 additions & 0 deletions
7
changelogs/current/bug_fixes/wasm__vm-key-derived-from-vm-config.rst
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| Fixed a bug where Wasm plugins whose :ref:`VM configurations | ||
| <envoy_v3_api_msg_extensions.wasm.v3.VmConfig>` differed could still share a single Wasm VM, and so | ||
| silently run with the VM configuration of whichever plugin happened to be configured first. The | ||
| :ref:`runtime <envoy_v3_api_field_extensions.wasm.v3.VmConfig.runtime>` and the :ref:`capability | ||
| restrictions <envoy_v3_api_field_extensions.wasm.v3.VmConfig.capability_restriction_config>` are now | ||
| part of the VM identity, alongside the ``vm_id``, the ``configuration``, the ``code`` and the | ||
| ``environment_variables``, so plugins differing in either of them no longer share a VM. |
7 changes: 7 additions & 0 deletions
7
changelogs/current/deprecated/wasm__plugin-level-capability-restriction.rst
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| The :ref:`PluginConfig.capability_restriction_config | ||
| <envoy_v3_api_field_extensions.wasm.v3.PluginConfig.capability_restriction_config>` field is | ||
| deprecated in favor of the new :ref:`VmConfig.capability_restriction_config | ||
| <envoy_v3_api_field_extensions.wasm.v3.VmConfig.capability_restriction_config>` field. The | ||
| restrictions are applied when the Wasm VM is created and are shared by every plugin running in that | ||
| VM, so they are a property of the VM rather than of an individual plugin. The deprecated field keeps | ||
| working: when it is set and the VM level field is not, it is used to populate the VM level one. |
7 changes: 7 additions & 0 deletions
7
.../current/minor_behavior_changes/wasm__plugin-key-derived-from-plugin-config.rst
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| The identity of a Wasm plugin (which plugin configurations share a single root context and | ||
| thread-local plugin instance inside a Wasm VM) is now derived from the whole | ||
| :ref:`plugin configuration <envoy_v3_api_msg_extensions.wasm.v3.PluginConfig>` instead of from the | ||
| plugin name and the traffic direction of the listener the plugin was configured on. Configurations | ||
| that differ in any field other than :ref:`vm_config | ||
| <envoy_v3_api_field_extensions.wasm.v3.PluginConfig.vm_config>` no longer share an instance, and | ||
| identical configurations now share one regardless of the traffic direction they are configured on. | ||
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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 think instance sharing was intended because the same VM could receive multiple calls for on_configure. Are you sure this is safe to merge?
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.
Yeah, it's safe. Note, we still shared plugin instance and VM instance if they have exactly same configuration. In our previous implementation, there actually a bug that result in unexpected instance be shared and finally result in unexpected behavior.
For example, in the previous implementation, two plugin configurations with different
allow_on_headers_stop_iterationwill hit same cache and only the first one's flag will take effects which is wrong.