Skip to content

Splunk Observability scaler: Close() does not tear down SignalFlow client #8099

Description

@js4683

Report

pkg/scalers/splunk_observability_scaler.go Close() is return nil. NewSplunkObservabilityScaler creates a long-lived *signalflow.Client (websocket + several goroutines) and never closes it.

KEDA calls Scaler.Close() from ScalersCache.Close, refreshScaler, and the builder error path. Each close currently leaks the SignalFlow client until the operator process exits.

This is not a request to add a KEDA-owned reconnect/rebuild loop. signalflow-client-go/v2@v2.3.0 already reconnects (wsConn.Run, reconnectDelay = 5s). A local probe after KillExistingConnections() showed later getQueryResult calls succeeding on the same client (~8s then ~3s).

I want to implement Close() so it calls apiClient.Close() exactly once, serialize it against in-flight getQueryResult (library Close() + a later Execute panics with send on closed channel; a second Client.Close() panics with cannot close client more than once), and add unit tests for teardown + library reconnect.

Known leftover after a correct apiClient.Close(): one bufferMessages goroutine blocked sending on the unused Info channel (KEDA never reads comp.Info()). That is a library limitation; I am not proposing to drain Info/Events in this issue.

Expected Behavior

Scaler.Close() tears down the SignalFlow client. A second Close() is a no-op. getQueryResult after close returns an error, not a panic. A websocket drop does not permanently disable the scaler (library reconnect).

Actual Behavior

Close() is a no-op. After one query, 10 SignalFlow goroutines remain. They survive Close().

Steps to Reproduce the Problem

  1. Construct splunkObservabilityScaler with signalflow.NewRunningFakeBackend().Client().
  2. Call getQueryResult once.
  3. Count goroutines whose stacks contain signalflow-client-go (0 before, 10 after).
  4. Call Close().
  5. Count again — still 10.

Logs from KEDA operator

n/a — reproduced in unit tests against FakeBackend

KEDA Version

Other (main / current scaler as of 2026-08-29)

Kubernetes Version

Other

Platform

Any

Scaler Details

Splunk Observability (SignalFx)

Would you be open to contributing a fix?

Yes

Anything else?

Separate from #8097 / #8098 (aggregators). Please assign me if this is accepted and I will open one PR: implement Close(), lock it against queries, unit-test teardown + reconnect. No changelog (release notes are automated). No keda-docs change (not user-facing metadata).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    To Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions