Open
Description
openedon Jan 26, 2024
I'm working on enabling goleak checks in another project (context here: open-telemetry/opentelemetry-collector-contrib#30438), and a leak has been detected in this package.
Goleak output:
goleak: Errors on successful test run: found unexpected goroutines:
[Goroutine 26 in state chan receive, with github.com/microsoft/ApplicationInsights-Go/appinsights.(*throttleManager).Stop on top of the stack:
github.com/microsoft/ApplicationInsights-Go/appinsights.(*throttleManager).Stop(0xc000136768)
/Users/crobert/go/pkg/mod/github.com/microsoft/!application!insights-!go@v0.4.4/appinsights/throttle.go:65 +0xdf
github.com/microsoft/ApplicationInsights-Go/appinsights.(*inMemoryChannelState).stop(0xc0003aa050)
/Users/crobert/go/pkg/mod/github.com/microsoft/!application!insights-!go@v0.4.4/appinsights/inmemorychannel.go:360 +0xd8
github.com/microsoft/ApplicationInsights-Go/appinsights.(*InMemoryChannel).acceptLoop(0xc0004069c0)
/Users/crobert/go/pkg/mod/github.com/microsoft/!application!insights-!go@v0.4.4/appinsights/inmemorychannel.go:149 +0x46
created by github.com/microsoft/ApplicationInsights-Go/appinsights.NewInMemoryChannel in goroutine 24
/Users/crobert/go/pkg/mod/github.com/microsoft/!application!insights-!go@v0.4.4/appinsights/inmemorychannel.go:59 +0x2a5
]
From what I can tell, throttleManager.Stop()
is blocking while waiting for a message to be sent on the result
channel. However, in the problem method waitForThrottle()
, the other running goroutine does not send a message to msg.result
when the message with stop: true
is sent to the msg
channel. This means the stop operation is sent successfully, but since there's nothing sent to the result
channel, it blocks forever in Stop()
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels