-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
Component(s)
processor/isolationforest
What happened?
Description
The isolation forest processor creates background goroutines for model updates but fails to properly clean them up during test execution, causing goleak to detect goroutine leaks. While the processor functionality works correctly, the test suite fails due to improper resource cleanup.
The leaked goroutines are from modelUpdateLoop method which runs in the background for periodic model updates. The processor's Shutdown() method doesn't properly wait for these goroutines to terminate before returning.
Steps to Reproduce
-
Navigate to the isolation forest processor directory:
bash
cd processor/isolationforestprocessor -
Run the test suite with goleak enabled:
bash
go test -v ./...
Observe that individual tests pass but the overall suite fails due to goroutine leaks
Expected Result
- All tests should pass without any goroutine leaks
- The test suite should complete successfully with exit code 0
- goleak should not detect any leaked goroutines after test completion
- Background modelUpdateLoop goroutines should be properly terminated during processor shutdown
Actual Result
PASS
coverage: 69.6% of statements
goleak: Errors on successful test run: found unexpected goroutines:
[Goroutine 116 in state select, with github.com/open-telemetry/opentelemetry-collector-contrib/processor/isolationforestprocessor.(*isolationForestProcessor).modelUpdateLoop on top of the stack:
github.com/open-telemetry/opentelemetry-collector-contrib/processor/isolationforestprocessor.(*isolationForestProcessor).modelUpdateLoop(...)
/home/venu/opentelemetry-collector-contrib/processor/isolationforestprocessor/processor.go:137
created by github.com/open-telemetry/opentelemetry-collector-contrib/processor/isolationforestprocessor.newIsolationForestProcessor in goroutine 115
/home/venu/opentelemetry-collector-contrib/processor/isolationforestprocessor/processor.go:106 +0x787
Goroutine 118 in state select, with github.com/open-telemetry/opentelemetry-collector-contrib/processor/isolationforestprocessor.(*isolationForestProcessor).modelUpdateLoop on top of the stack:
github.com/open-telemetry/opentelemetry-collector-contrib/processor/isolationforestprocessor.(*isolationForestProcessor).modelUpdateLoop(...)
/home/venu/opentelemetry-collector-contrib/processor/isolationforestprocessor/processor.go:137
created by github.com/open-telemetry/opentelemetry-collector-contrib/processor/isolationforestprocessor.newIsolationForestProcessor in goroutine 117
/home/venu/opentelemetry-collector-contrib/processor/isolationforestprocessor/processor.go:106 +0x787
... (additional similar goroutines)
]
exit status 1
FAIL github.com/open-telemetry/opentelemetry-collector-contrib/processor/isolationforestprocessor 0.551s
Collector version
0.135.0
Environment information
Environment
OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")
OpenTelemetry Collector configuration
Log output
Additional context
No response
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.