Repository navigation
Description
Description:
With mergeGateways: true, an extension server policy (a kind listed in extensionManager.policyResources) that targets one Gateway is attached to the listeners of every Gateway in the GatewayClass.
Expected: the policy attaches only to the target Gateway's listeners, or only to the listener named by sectionName.
What happens instead:
- Without
sectionName, the policy is attached to every Gateway's listeners. - With
sectionName, it is attached to every Gateway's listener of that name. The policy is also reportedAcceptedwhen only another Gateway has a listener with that name. - An
HTTPListenerpost-hook can receive other Gateways' policies. - The number of attachments grows as policies × listeners. Up to v1.9.1, each attachment becomes a full copy of the policy in every stored copy of the IR. On
main, after perf: store extension server resources centrally #10071, each attachment is a short reference, but the count is the same.
Cause: translateExtServerPolicyForGateway loops over every listener in the IR of the Gateway's IR key (code on main). With mergeGateways, that key is the GatewayClass, so the loop covers every Gateway. The sectionName check compares only the last segment of the IR listener name.
What we measured on a copy of a fleet with a few hundred merged Gateways (766 listeners) and about 100 Gateway-targeted policies, with an extension server that returns the resources unchanged, three runs each:
| v1.7.4 | v1.7.4 with the fix | main 0dab73f |
main with the fix |
|
|---|---|---|---|---|
| listener attachments | 79,664 | 267 | 79,664 | 267 |
| of them on another Gateway's listener | 79,397 | 0 | 79,397 | 0 |
| controller live heap at rest | 912 MiB | 71 MiB | 74 MiB | 69 MiB |
Attachments were counted on main; the v1.7.4 runs used the same objects. The live heap peak after a policy change was about 1.1 GiB on v1.7.4 and about 0.1 GiB on main.
On v1.7.4, 90% of the heap at rest is runtime.DeepCopyJSONValue, under watchable.(*Map).Store, ir.(*Xds).DeepCopyInto, ir.(*CoreListenerDetails).DeepCopyInto and ir.(*UnstructuredRef).DeepCopyInto.
On main, #10071 makes each attachment a reference with no object, so the memory is small. The wrong attachments remain.
Repro steps:
- A GatewayClass whose EnvoyProxy sets
mergeGateways: true. - Two Gateways in that class,
gateway-aandgateway-b, each with listenershttpandhttps. - An extension manager with a policy kind in
policyResources, and one policy that targetsgateway-a. - Translate. The IR listeners of
gateway-bcarry the policy inExtensionRefs.
The linked PR adds this as a test. Without the fix, gateway-b/http and gateway-b/https carry both policies.
Environment:
Envoy Gateway v1.1.0 (#3371) through v1.9.1, and main at 0dab73f.
Logs:
No error is logged. The attachments show in the IR, and the cost shows in a heap profile.
Activity
github-actions commentedon Oct 24, 2026
This issue has been automatically marked as stale because it has not had activity in the last 30 days.
zirain commentedon Nov 4, 2026
@vvoytovych can you check if this's fixed as part of #10062?
vvoytovych commentedon Nov 9, 2026
Yes, #10062 fixed this (7c22fe11): with
mergeGateways, an extension server policy now attaches only to its target Gateway's listeners.#10379 adds the one case its test does not cover: two merged Gateways with same-named listeners, and a policy that targets one of them by
sectionName. It closes this issue when it merges.zirain commentedon Nov 9, 2026
@vvoytovych FYI, I also created #10535 for v1.9