fix: preserve stream service plugin context#13402
Merged
nic-6443 merged 2 commits intoMay 21, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes stream plugin context handling when a stream route references a Service. APISIX already computes a merged stream_route&service context for such routes, but the context used for plugin LRU cache keys was later overwritten with route-only values, causing stale service plugin configs to persist until route change or worker restart.
Changes:
- Preserve the existing
api_ctx.conf_type/conf_version/conf_idfor service-backed stream routes by only setting the route-only context when it hasn’t already been set. - Add a regression test ensuring service plugin configuration updates take effect for stream routes referencing a service.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
apisix/init.lua |
Avoids overwriting api_ctx.conf_* so stream plugin cache keys reflect route+service context when applicable. |
t/stream-plugin/syslog.t |
Adds a new test validating syslog plugin config changes on a Service are picked up by a stream route using service_id. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
nic-6443
requested review from
AlinsRan,
bzp2010,
membphis,
moonming and
shreemaan-abhishek
May 21, 2026 02:48
membphis
approved these changes
May 21, 2026
AlinsRan
approved these changes
May 21, 2026
shreemaan-abhishek
approved these changes
May 21, 2026
wistefan
pushed a commit
to wistefan/apisix
that referenced
this pull request
Jun 16, 2026
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.
When a stream route references a service, APISIX already builds a merged stream route and records a
stream_route&servicecontext. That context was then overwritten with route-only values before plugin execution, so plugin-level caches could keep using the old service plugin config until the route changed or the worker restarted.This keeps the service-aware context for stream routes backed by a service, while preserving the existing route-only context for standalone stream routes.