Skip to content

Connection leak in Redis pub/sub adapter #2915

@ehaynes99

Description

@ehaynes99

Component(s)

router

Component version

dfd3089

wgc version

0.120.0

controlplane version

cloud

router version

dfd3089

What happened?

Redis EDFS pub/sub adapter leaks one connection per subscription. On teardown it calls only sub.PUnsubscribe(ctx, ...) and never sub.Close(), so the dedicated pub/sub connection is never released. cleanup() runs from the <-ctx.Done() branches and passes the already-cancelled context, so the unsubscribe itself fails with context canceled ("failed to unsubscribe" is logged).

Fix: defer sub.Close() in the subscription goroutine and remove the explicit PUnsubscribe (closing the PubSub unsubscribes server-side).

Image

Environment information

Environment

OS: gcr.io/distroless/static-debian12:latest
Package Manager: N/A
Compiler(if manually compiled): FROM --platform=$BUILDPLATFORM golang:1.25 AS builder

Router configuration

Router execution config

Log output

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions