-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
rpc: correctly check for nil before cast #100296
Conversation
It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR? 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
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.
LGTM
@@ -2715,13 +2715,14 @@ func (rpcCtx *Context) loadOrCreateConnAttempt( | |||
select { | |||
case <-previousAttempt.initialHeartbeatDone: | |||
// The connection attempt was completed, return the outcome of it. | |||
err := previousAttempt.err.Load().(error) |
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.
slight preference for just changing this to err, _ := previousAttempt.err.Load().(error)
, but only slight. This could still panic if somehow err.Load() had a non-nil, non-error value
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.
changed
As part of the fix of cockroachdb#99104, a cast without a nil check was introduced. This PR addresses that by only casting if it is known to be not nil. Epic: none Fixes: cockroachdb#100275 Release note: None
2cdcd4f
to
46feb6b
Compare
bors r=ajwerner |
Build succeeded: |
does this need to be backported? |
It's included in #100238, the backport of the original change. |
As part of the fix of #99104, a cast without a nil check was introduced. This PR addresses that by only casting if it is known to be not nil.
Epic: none
Fixes: #100275
Release note: None