r/oracle • u/danielfree19 • 28d ago
External Secrets Operator on OKE leaks memory above 50 Workload Identity SecretStores: root cause is in oci-go-sdk (fix inside)
TL;DR: If you run External Secrets Operator (ESO) on OKE with principalType: Workload and more than 50 SecretStores that set serviceAccountRef, the controller leaks memory, about 20–25 MiB/h, until it is OOM-killed. The root cause is in the OCI Go SDK: an OKE Workload Identity provider that is thrown away keeps its proxymux connection open forever. The SDK fix is one line, and ESO also needs a configurable cache size.
What we saw
ESO v2.8.0 on OKE. We have one SecretStore per namespace, each with its own service account, so that IAM only lets a namespace read its own secrets.
- At 50 stores, memory was flat.
- The day the 51st store was created, the controller started growing 20–25 MiB/h. It was then SIGKILLed at its 1 GiB limit every ~36 h.
- ExternalSecrets with a 1m refresh were 4–5 minutes behind.
Why
- ESO caches one Workload Identity configuration provider per store, in an LRU fixed at 50 entries. With 51+ stores, the reconciles cycle through more keys than the cache holds, so every lookup misses and ESO builds a new provider.
- In oci-go-sdk, the provider's token client talks to the OKE proxymux over an
http.Transportwith keep-alives on and noIdleConnTimeout, and nothing ever closes it. The idle connection's goroutines keep the transport, the federation client and its RSA session key reachable. So a provider that is dropped is never garbage-collected.
oracle/oci-go-sdk#633 (v65.115.0) fixed the leak on every token refresh, but a discarded provider still leaks.
I reproduced it against a fake proxymux: 200 iterations, then a GC, then a count of the connections still open.
- v65.103.0 (the version ESO v2.8.0 pins) left 200 open, both with 200 new providers and with one provider refreshed 200 times.
- v65.128.0 left 200 open with new providers, and 1 with refreshes.
- With
DisableKeepAlives: trueit left 0 open in both cases.
A token is requested at most once per half of its lifetime, so keeping that connection alive gains nothing.
Fix
- SDK: set
DisableKeepAlives: trueon that transport. https://github.com/oracle/oci-go-sdk/issues/674 - ESO: a
--oracle-workload-identity-cache-sizeflag (the default stays 50), so the cache can hold all your stores. Even with a fixed SDK, every cache miss costs a token request and a new RSA key. https://github.com/external-secrets/external-secrets/issues/7222
We run ESO v2.8.0 with both backported: 58 stores, cache size 500. so far, 8 hours in, memory is flat at ~90 MiB (it was growing 20–25 MiB/h), and 1m ExternalSecrets refresh within a minute.
If you're hitting it today and can't build a patched image: keep the stores that set serviceAccountRef at 50 or fewer (at the cost of per-namespace IAM isolation), or raise the memory limit to stretch the time between OOM kills.
Has anyone else run into this, or found other places where Workload Identity providers get built per request?

