Skip to content

Hub.Close() only closes h.done without closing client.send channels leaking all writer goroutines #7042

@aashu2006

Description

@aashu2006

User Request

Type: bug
Target: Console Application
Submitted by: @aashu2006
Console Request ID: 7e4b28df-cb91-4ea0-bbb8-2104b33c8003

Description

What happened:
In pkg/api/handlers/websocket.go:176-180, Hub.Close() only closes h.done causing Hub.Run() to return. But Run() is the only path that closes client.send channels via the unregister case. When Run exits, no client.send channel is closed, so every writer goroutine blocks forever on <-client.send until TCP connections are forcibly closed.

What I expected:
Before closing h.done, Hub.Close() should iterate h.clients under h.mu.Lock() and close every client.send channel to unblock writer goroutines immediately.

Steps to reproduce:

  1. Connect multiple WebSocket clients
  2. Call Hub.Close()
  3. Observe writer goroutines remain blocked until TCP connections are forcibly closed

This issue was automatically created from the KubeStellar Console.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-fix-requestedai-processingAI is currently processing this issuekind/bugCategorizes issue or PR as related to a bug.triage/acceptedIndicates an issue or PR is ready to be actively worked on.triage/neededNeeds triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions