Skip to content

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