Skip to content

Race on LOAD DATA called from different routines #383

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

Merged
merged 1 commit into from
Nov 12, 2015
Merged

Race on LOAD DATA called from different routines #383

merged 1 commit into from
Nov 12, 2015

Conversation

mrsinham
Copy link
Contributor

Hello, I experienced some data races when loading readers from different routines, so I created this PR, thanks !

"Maps are not routine safe so if you register readers/files from differents routines, the
registry must be locked."

@arnehormann
Copy link
Member

Wow, thanks, great find!!!
I'd like you to make some very minor changes:

  • in the rather short Register* calls, drop the defers and move Unlock calls to the bottom.
  • in handleInFileRequest: RLock, store in new variable, RUnlock, use variable in if conditional.

Thanks again!

Maps are not routine safe so if you register readers/files from differents routines, the
registry must be locked.
@mrsinham
Copy link
Contributor Author

I have done the changes according to your review :)

@arnehormann
Copy link
Member

LGTM, thanks again!

arnehormann added a commit that referenced this pull request Nov 12, 2015
Race on LOAD DATA called from different routines
@arnehormann arnehormann merged commit d512f20 into go-sql-driver:master Nov 12, 2015
@julienschmidt julienschmidt added this to the v1.3 milestone Jan 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants