-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Labels
Description
When runningFn is called, the goroutine is blocked.
thanos/internal/cortex/util/services/basic_service.go
Lines 192 to 194 in da855a1
| 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.
| b.serviceCancel() |
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)
}()
Reactions are currently unavailable