-
Notifications
You must be signed in to change notification settings - Fork 651
otelgrpc: Fix data race in stats handlers when processing messages received and sent metrics #4577
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
naphatkrit
commented
Nov 13, 2023
``` WARNING: DATA RACE Read at 0x00c000bef1d8 by goroutine 890: go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc.(*config).handleRPC() /go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/[email protected]/stats_handler.go:199 +0x190b go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc.(*clientHandler).HandleRPC() /go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/[email protected]/stats_handler.go:124 +0x65 google.golang.org/grpc.(*csAttempt).finish() /go/pkg/mod/google.golang.org/[email protected]/stream.go:1171 +0x650 google.golang.org/grpc.(*clientStream).finish() /go/pkg/mod/google.golang.org/[email protected]/stream.go:988 +0x34b google.golang.org/grpc.(*clientStream).RecvMsg() /go/pkg/mod/google.golang.org/[email protected]/stream.go:940 +0x2d2 github.com/prodvana/prodvana-public/go/prodvana-sdk/proto/prodvana/agent.(*agentInteractionProxyAPIServerClient).Recv() /code/go-sdk/proto/prodvana/agent/agent_interaction_grpc.pb.go:181 +0x67 prodvana/grpc/connwrapper.ConnectConnAndStreamingServer[...].func2.2() grpc/connwrapper/conn.go:141 +0xbc ```
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.
Please add a test to highlight the panic you are resolving and prevent regressions.
oh it's not a panic, it's a data race that we caught in our internal integration tests. do you have tests that would catch data races today? |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #4577 +/- ##
=====================================
Coverage 80.8% 80.9%
=====================================
Files 150 150
Lines 10371 10342 -29
=====================================
- Hits 8387 8369 -18
+ Misses 1840 1831 -9
+ Partials 144 142 -2
|
That is my ask. Please add tests to validate this fix. |
@MrAlias updated |
instrumentation/google.golang.org/grpc/otelgrpc/stats_handler_test.go
Outdated
Show resolved
Hide resolved
instrumentation/google.golang.org/grpc/otelgrpc/test/grpc_stats_handler_test.go
Outdated
Show resolved
Hide resolved
instrumentation/google.golang.org/grpc/otelgrpc/test/grpc_stats_handler_test.go
Outdated
Show resolved
Hide resolved
Co-authored-by: Robert Pająk <[email protected]>
Can you please fix the build (running
|
I wasn't able to run
I was able to fix the import manually though. |
This is strange. You can try running The CI is still reporting an issue:
|
Figured it out - I had an incomplete go.work file I had to add to teach my editor about the various go modules in the repo. Removing it allowed |
@naphatkrit Thank you very much for your contribution ❤️ |
Thanks for all the help! |