onepasswordsdk: cached SDK client is never recreated after an unrecoverable WASM error, all ExternalSecrets stay NotReady until pod restart

Author: dyegoeCreated Sep 9, 2026Updated Sep 22, 2026
Labelskind/bugarea/1password

Describe the bug

The onepasswordsdk provider caches the 1Password SDK client per store (providers/v1/onepasswordsdk/provider.go, NewClient) keyed on the store's resourceVersion, and returns the cached client on every reconcile:

go
if cachedClient, ok := p.clientCache.Get(store.GetObjectMeta().ResourceVersion, key); ok {
    return cachedClient, nil
}
...
p.clientCache.Add(store.GetObjectMeta().ResourceVersion, key, sc)

Nothing ever evicts that entry on error. The 1Password SDK (onepassword-sdk-go v0.4.1, WASM core via extism/wazero) has a failure mode where a transient network error inside a host function leaves the WASM instance permanently broken: every later call fails with wasm error: out of bounds memory access (upstream report: 1Password/onepassword-sdk-go#288). Because ESO keeps handing out the same client, every ExternalSecret backed by that ClusterSecretStore fails on every reconcile, forever, while the ClusterSecretStore itself kept reporting Valid throughout (so its validation apparently doesn't exercise the wedged client).

In my cluster this took all 20 ExternalSecrets to Ready=False for ~30 hours after a CoreDNS blip that lasted under a minute. The only fixes were restarting the controller pod or touching the ClusterSecretStore so its resourceVersion changed (which creates a new client but leaks the old one in the LRU).

Timeline from the controller logs:

  • 05:15:29Z to 05:15:53Z: CoreDNS returns SERVFAIL for my.1password.com (its own logs confirm it, for this pod's A/AAAA lookups and other external names in the same window). All 20 ExternalSecrets happened to refresh in that window, and each failed once, wrapped as a WASM host-function panic:

    error processing spec.dataFrom[0].extract, err: failed to list items: failed to list items:
    Get "https://my.1password.com/api/v1/vault/<id>/items/overviews?": dial tcp: lookup my.1password.com
    on 10.96.0.10:53: server misbehaving (recovered by wazero)
    wasm stack trace:
            extism:host/env.http_request(i64,i64) i64
            ...
  • 05:15:53Z, 40 ms after the last DNS error: first permanent failure, then identical on every reconcile (~170/h) until restart. No further DNS errors were logged after 05:15:53Z:

    error processing spec.dataFrom[0].extract, err: failed to list items: failed to list items:
    wasm error: out of bounds memory access
    wasm stack trace:
            op_extism_core.wasm._ZN8dlmalloc8dlmalloc17Dlmalloc$LT$A$GT$6malloc17h44b8dc71ab434912E(i32) i32
            op_extism_core.wasm._ZN10extism_pdk6extism10load_input17h1fed4249c383a9e7E(i32)
            op_extism_core.wasm.invoke() i32
  • Controller memory (container_memory_working_set_bytes) was flat at ~207 MiB for days, then grew to ~440 MiB over the day it spent in the error loop. The chart ships no memory limit and no liveness probe by default, so nothing self-healed.

To Reproduce

  1. ESO v2.10.0 (Helm chart 2.10.0), Kubernetes v1.37.0, Talos Linux v1.14.0, onepasswordSDK provider with a service-account token. Store:

    yaml
    apiVersion: external-secrets.io/v1
    kind: ClusterSecretStore
    metadata:
      name: onepassword
    spec:
      provider:
        onepasswordSDK:
          vault: Kubernetes
          auth:
            serviceAccountSecretRef:
              name: onepassword-sa-token
              key: token
              namespace: external-secrets
          cache:
            ttl: 5m
            maxSize: 100

    and any ExternalSecret using dataFrom: [{extract: {key: <item title>}}] (title lookup goes through Items().List(), which is the call that fails).

  2. Make my.1password.com unresolvable from the controller pod for one reconcile (e.g. break CoreDNS briefly, or a NetworkPolicy that drops DNS for a minute), then restore it.

  3. Watch every ExternalSecret on the store go SecretSyncedError with the out of bounds memory access error and stay there. kubectl -n external-secrets rollout restart deploy/external-secrets fixes it immediately; nothing short of that (or a store edit) does.

I have not yet reproduced step 2 deliberately; the above is what happened in production and matches the code path.

Expected behavior

The provider should not keep serving a client that can never succeed again. Options, from smallest to largest:

  • On an error from the SDK that identifies a WASM runtime trap (the extism/wazero error, or its wasm error: / (recovered by wazero) text), remove the cache entry so the next reconcile builds a fresh client. One reconcile fails, the next one works.
  • More generally, evict the cached client after N consecutive failures for the same store, so any future "client is dead" failure mode is bounded to a few reconcile intervals instead of "until someone restarts the pod".
  • Longer term, once the SDK exposes Client.Close (1Password/onepassword-sdk-go#280), close the old client when evicting so its WASM memory is released rather than leaked in the LRU.

The ClusterSecretStore status should ideally also stop reporting Valid when every call through its client is failing, but that is secondary.

Screenshots

n/a. Log excerpts and the Prometheus memory series available on request.

Additional context

  • The root cause is in the SDK (a recovered panic in the http_request host function corrupts the WASM instance, 1Password/onepassword-sdk-go#288). This issue is about ESO's resilience to that: the provider has no path to recover from a permanently broken client, which turned a sub-minute DNS blip into a 30-hour outage of every secret in the cluster.
  • Dependency versions from providers/v1/onepasswordsdk/go.mod at v2.10.0: onepassword-sdk-go v0.4.1, extism/go-sdk v1.7.1, wazero v1.12.0.

Source: external-secrets/external-secrets