-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Datarace on context cancellation #728
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
Comments
Use go 1.9.2 or later. |
ok, thx. |
1.9.2 still appear
|
|
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue description
When using context cancellation on heavy request and parallel queries, got a datarace.
Trace
To reproduce
Please use the demo : https://github.com/mrsinham/mysqlrace (execute until you have the datarace, a bit difficult to trigger)
Early analysis
The connection to MySQL use a buffer that is not protected against dataraces.
When the context sends a Close() order via the context cancelling and when the buffer is still providing data to the rows.Scan() method, they read/write on the same []byte at the same time (using database/sql.convertAssign), triggering the datarace.
Configuration
Driver version (or git SHA): 9181e3a
Go version: go version go1.8.3 linux/amd64
Server version: MariaDB 10.2
Server OS: Ubuntu 17.10
The text was updated successfully, but these errors were encountered: