You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
During the static analysis was found possible mistake:
After having been compared to a nil value at stream.go:1029, pointer 'cs.attempt' is passed in call to function 'grpc.clientStream.Trailer' at stream.go:1053, where it is dereferenced at stream.go:858.
Thanks for raising this issue and bringing it to our attention. The static analysis you're using might be flagging a false positive here.
Let's break down why:
cs.attempt initialization: The cs.attempt field is initially nil, but it's populated within the newClientStreamWithParams function before being used in any critical operations.
Guaranteed non-nil in Trailer(): The Trailer() method is called only after the stream is considered finished, either successfully or due to an error. By this point, cs.attempt is guaranteed to be non-nil. This is ensured because:
A successful stream creation would have assigned a value to cs.attempt.
An error during stream creation would lead to the finish method being called, which handles the case of cs.attempt potentially being nil.
finish() method's safeguard: The finish() method itself includes a check (if cs.attempt != nil) to prevent nil pointer dereferences in scenarios where the stream might not have been fully established.
If you can provide a minimal, reproducible example that demonstrates the issue, that would be even more helpful in diagnosing the problem.
purnesh42H
added
the
Area: Client
Includes Channel/Subchannel/Streams, Connectivity States, RPC Retries, Dial/Call Options and more.
label
Oct 29, 2024
Hello!
During the static analysis was found possible mistake:
version of gRPC: master
version of Go: go version go1.22.4 linux/amd64
operating system: Linux debian 10
The text was updated successfully, but these errors were encountered: