From 99e1ba793afc2708e74aaa69bc14938dbc64894d Mon Sep 17 00:00:00 2001 From: Nathan Fudenberg Date: Thu, 2 Jan 2025 13:38:25 -0500 Subject: [PATCH] [1.18] log leak backport (#10545) Co-authored-by: Yuval Kohavi --- changelog/v1.18.3/memleak.yaml | 5 +++++ projects/gloo/pkg/syncer/setup/setup_syncer.go | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 changelog/v1.18.3/memleak.yaml diff --git a/changelog/v1.18.3/memleak.yaml b/changelog/v1.18.3/memleak.yaml new file mode 100644 index 00000000000..567d9d149f1 --- /dev/null +++ b/changelog/v1.18.3/memleak.yaml @@ -0,0 +1,5 @@ +changelog: + - type: FIX + issueLink: https://github.com/solo-io/solo-projects/issues/7573 + description: >- + Fix a memory leaking a log name. diff --git a/projects/gloo/pkg/syncer/setup/setup_syncer.go b/projects/gloo/pkg/syncer/setup/setup_syncer.go index e3281df2906..71c352142a0 100644 --- a/projects/gloo/pkg/syncer/setup/setup_syncer.go +++ b/projects/gloo/pkg/syncer/setup/setup_syncer.go @@ -1375,15 +1375,15 @@ func runQueue(ctx context.Context, proxyReconcileQueue ggv2utils.AsyncQueue[gloo // the proxy type key/value must stay in sync with the one defined in projects/gateway2/translator/gateway_translator.go utils.ProxyTypeKey: utils.GatewayApiProxyValue, } + ctx = contextutils.WithLogger(ctx, "proxyCache") + logger := contextutils.LoggerFrom(ctx) + proxyReconciler := gloov1.NewProxyReconciler(proxyClient, statusutils.NewNoOpStatusClient()) for { proxyList, err := proxyReconcileQueue.Dequeue(ctx) if err != nil { return } - ctx = contextutils.WithLogger(ctx, "proxyCache") - logger := contextutils.LoggerFrom(ctx) - // Proxy CR is located in the writeNamespace, which may be different from the originating Gateway CR err = proxyReconciler.Reconcile( writeNamespace,