-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[chore][pkg/stanza] Fixed goleak failures of regex_parser benchmarks #43213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome thanks!
Thank you for your contribution @gnak-yar! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey. If you are getting started contributing, you can also join the CNCF Slack channel #opentelemetry-new-contributors to ask for guidance and get help. |
…pen-telemetry#43213) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Another fix for open-telemetry#43044. This error is not reported in the issue. ``` goos: darwin goarch: arm64 pkg: github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex cpu: Apple M4 Max BenchmarkParseNoCache-14 15130 78689 ns/op BenchmarkParseWithMemoryCache-14 59836 19746 ns/op BenchmarkParseWithMemoryCacheFullByOne-14 53994 20786 ns/op BenchmarkParseWithMemoryCacheFullBy10-14 38668 30696 ns/op BenchmarkParseWithMemoryCacheFullBy50-14 20751 57883 ns/op BenchmarkParseWithMemoryCacheFullBy90-14 15634 75974 ns/op BenchmarkParseWithMemoryCacheFullBy99-14 14929 79251 ns/op BenchmarkParseNoCacheOneFile-14 663885 1735 ns/op BenchmarkParseWithMemoryCacheOneFile-14 91589362 13.04 ns/op PASS goleak: Errors on successful test run: found unexpected goroutines: [Goroutine 26460181 in state select, with github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1.1 on top of the stack: github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1.1() /Users/ray.kang/github.com/gnak-yar/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex/cache.go:171 +0x94 created by github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1 in goroutine 26461891 /Users/ray.kang/github.com/gnak-yar/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex/cache.go:165 +0x60 Goroutine 10525566 in state select, with github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1.1 on top of the stack: github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1.1() /Users/ray.kang/github.com/gnak-yar/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex/cache.go:171 +0x94 created by github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1 in goroutine 9517088 /Users/ray.kang/github.com/gnak-yar/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex/cache.go:165 +0x60 Goroutine 9526274 in state select, with github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1.1 on top of the stack: github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1.1() /Users/ray.kang/github.com/gnak-yar/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex/cache.go:171 +0x94 created by github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1 in goroutine 9517088 /Users/ray.kang/github.com/gnak-yar/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex/cache.go:165 +0x60 Goroutine 26472023 in state select, with github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1.1 on top of the stack: github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1.1() /Users/ray.kang/github.com/gnak-yar/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex/cache.go:171 +0x94 created by github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1 in goroutine 26461891 ... ``` Similarly to open-telemetry#43117, the goleak errors occur because `regex.Parser` does not stop. Stopping a parser silences the error. Applied table-driven approach as the related benchmarks look very similar. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#43044 <!--Describe what testing was performed and which tests were added.--> #### Testing ```sh cd pkg/stanza/operator/parser/regex go test -bench='Parser' ``` Co-authored-by: Andrzej Stencel <[email protected]>
…pen-telemetry#43213) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Another fix for open-telemetry#43044. This error is not reported in the issue. ``` goos: darwin goarch: arm64 pkg: github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex cpu: Apple M4 Max BenchmarkParseNoCache-14 15130 78689 ns/op BenchmarkParseWithMemoryCache-14 59836 19746 ns/op BenchmarkParseWithMemoryCacheFullByOne-14 53994 20786 ns/op BenchmarkParseWithMemoryCacheFullBy10-14 38668 30696 ns/op BenchmarkParseWithMemoryCacheFullBy50-14 20751 57883 ns/op BenchmarkParseWithMemoryCacheFullBy90-14 15634 75974 ns/op BenchmarkParseWithMemoryCacheFullBy99-14 14929 79251 ns/op BenchmarkParseNoCacheOneFile-14 663885 1735 ns/op BenchmarkParseWithMemoryCacheOneFile-14 91589362 13.04 ns/op PASS goleak: Errors on successful test run: found unexpected goroutines: [Goroutine 26460181 in state select, with github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1.1 on top of the stack: github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1.1() /Users/ray.kang/github.com/gnak-yar/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex/cache.go:171 +0x94 created by github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1 in goroutine 26461891 /Users/ray.kang/github.com/gnak-yar/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex/cache.go:165 +0x60 Goroutine 10525566 in state select, with github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1.1 on top of the stack: github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1.1() /Users/ray.kang/github.com/gnak-yar/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex/cache.go:171 +0x94 created by github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1 in goroutine 9517088 /Users/ray.kang/github.com/gnak-yar/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex/cache.go:165 +0x60 Goroutine 9526274 in state select, with github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1.1 on top of the stack: github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1.1() /Users/ray.kang/github.com/gnak-yar/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex/cache.go:171 +0x94 created by github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1 in goroutine 9517088 /Users/ray.kang/github.com/gnak-yar/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex/cache.go:165 +0x60 Goroutine 26472023 in state select, with github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1.1 on top of the stack: github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1.1() /Users/ray.kang/github.com/gnak-yar/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex/cache.go:171 +0x94 created by github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/regex.(*atomicLimiter).init.func1 in goroutine 26461891 ... ``` Similarly to open-telemetry#43117, the goleak errors occur because `regex.Parser` does not stop. Stopping a parser silences the error. Applied table-driven approach as the related benchmarks look very similar. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#43044 <!--Describe what testing was performed and which tests were added.--> #### Testing ```sh cd pkg/stanza/operator/parser/regex go test -bench='Parser' ``` Co-authored-by: Andrzej Stencel <[email protected]>
Description
Another fix for #43044. This error is not reported in the issue.
Similarly to #43117, the goleak errors occur because
regex.Parser
does not stop. Stopping a parser silences the error.Applied table-driven approach as the related benchmarks look very similar.
Link to tracking issue
Fixes
#43044
Testing