-
Notifications
You must be signed in to change notification settings - Fork 116
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
SNOW-829468: Add null checks before accessing connection config during chunk downloading #821
Conversation
} | ||
|
||
func (sc *snowflakeConn) stopHeartBeat() { | ||
if !sc.isClientSessionKeepAliveEnabled() { | ||
if sc.cfg != nil && !sc.isClientSessionKeepAliveEnabled() { |
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.
again why checks for sc.cfg != nil?
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.
same as above.
move sc.rest nil check
4e39ad3
to
a06a3e7
Compare
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
Description
When a connection is cancelled, it is cleaned up by the cleanup() function. This sets the sc.cfg and sc.rest to nil. It could happen that a chunk is downloaded before cancel but decoded after. As seen in customer issue https://github.com/snowflakedb/snowflake-sdks-drivers-issues-teamwork/issues/420
This PR is to add checks where the sc.cfg and sc.rest are accessed in this scenario to avoid nil pointer dereference during chunk downloading if the connection is cancelled.
Checklist
make fmt
to fix inconsistent formatsmake lint
to get lint errors and fix all of them