Skip to content

A goroutine leak in thanos/internal/cortex/util/services /basic_service.go #8178

Open
@xuxiaofan1203

Description

@xuxiaofan1203

When runningFn is called, the goroutine is blocked.

if b.runningFn != nil {
err = b.runningFn(b.serviceContext)
}

The b.serviceCancel() can awaken the blocked goroutine. However, because the goroutine has blocked at runningFn. So the statement can't get executed, resulting in the gouroutine leak.

How to fix the bug:
I provide a solution that involves calling runningFn in a new goroutine to ensure the execution of serviceCancel(), as follows.

go func() {
      err = b.runningFn(b.serviceContext) 
}()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions