Skip to content

CRITICAL: Goroutine leak in lifecycle_worker - missing wg.Done() #674

Description

@poyrazK

Why is this an issue?

In internal/workers/lifecycle_worker.go:41-45, the startup goroutine does not call wg.Done(), causing a goroutine leak and incorrect wait group counting.

What is causing it?

wg.Add(1)         // line 41
go func() {
    defer wg.Done()  // MISSING - no wg.Done() here
    w.processRules(ctx)
}()

defer wg.Done() is missing inside the goroutine. Only defer wg.Done() in Run() exits when the main function exits, not when processRules completes.

How can it be solved?

Add defer wg.Done() inside the goroutine:

go func() {
    defer wg.Done()
    w.processRules(ctx)
}()

Category

  • Small
  • Medium
  • Large

Severity

  • Low
  • Medium
  • High
  • Critical

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions