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-848019: Add mutex lock to prevent race condition in populateErrorFields() #834

Merged
merged 1 commit into from
Jun 27, 2023

Conversation

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

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

Description

https://github.com/snowflakedb/snowflake-sdks-drivers-issues-teamwork/issues/491

An intermittent issue was reported where if a query failed while executing queries simultaneously, the wrong error message could be shown in the log.

The root cause is that during processing of the query response from the server inside the exec() function, there is a function populateErrorFields(). If two or more query responses are returned simultaneously and enter this function around the same time, it can cause a race condition where the error data is updated incorrectly. I am able to reproduce this about ~60% of the time without this change.

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 26, 2023 23:23
@sfc-gh-ext-simba-lb sfc-gh-ext-simba-lb requested a review from a team as a code owner June 26, 2023 23:23
connection.go Outdated 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 ee57d93 into master Jun 27, 2023
21 checks passed
@sfc-gh-ext-simba-lb sfc-gh-ext-simba-lb deleted the raceConditionInExecFunc branch June 27, 2023 16:50
@github-actions github-actions bot locked and limited conversation to collaborators Jun 27, 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.

3 participants