Skip to content
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

Merged
merged 2 commits into from
Jun 15, 2023

Conversation

sfc-gh-ext-simba-lb
Copy link
Contributor

@sfc-gh-ext-simba-lb sfc-gh-ext-simba-lb commented Jun 13, 2023

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

  • Code compiles correctly
  • Run make fmt to fix inconsistent formats
  • Run make lint to get lint errors and fix all of them
  • Created tests which fail without the change (if possible)
  • All tests passing
  • Extended the README / documentation, if necessary

@sfc-gh-ext-simba-lb sfc-gh-ext-simba-lb marked this pull request as ready for review June 13, 2023 22:30
@sfc-gh-ext-simba-lb sfc-gh-ext-simba-lb requested a review from a team as a code owner June 13, 2023 22:30
}

func (sc *snowflakeConn) stopHeartBeat() {
if !sc.isClientSessionKeepAliveEnabled() {
if sc.cfg != nil && !sc.isClientSessionKeepAliveEnabled() {
Copy link
Collaborator

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above.

chunk_downloader.go Show resolved Hide resolved
connection_util.go Show resolved Hide resolved
connection_util.go Show resolved Hide resolved
Copy link
Collaborator

@sfc-gh-igarish sfc-gh-igarish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sfc-gh-ext-simba-lb sfc-gh-ext-simba-lb merged commit 121c43a into master Jun 15, 2023
23 checks passed
@sfc-gh-ext-simba-lb sfc-gh-ext-simba-lb deleted the addNullChecksForConnectionConfig branch June 15, 2023 15:49
@github-actions github-actions bot locked and limited conversation to collaborators Jun 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants