-
Notifications
You must be signed in to change notification settings - Fork 18k
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
database/sql: driver.Stmt.Close is called twice #16019
Comments
"Possible solution" I wrote above cause another race. If Another possible solution is:
(I haven't tested this because it's midnight in Japan) |
@kardianos, if you have time, can you take a look? |
I will try. |
I'm sorry about long time no update. |
I don't see anything in the current database/sql code that prevents driver.Stmt.Close from being closed more than once. It will prevent it from being called concurrently, but nothing prevents it from being called twice. My recommendation is to document that driver.Stmt.Close may be called more than once and further calls should be idempotent. Also, there is currently a code path where if driver.Stmt.Close panics the sql pool will lock up due to a held lock. This is in |
I'm OK for your recommendation. |
CL https://golang.org/cl/33329 mentions this issue. |
CL https://golang.org/cl/33328 mentions this issue. |
Do not retain a lock when driver.Stmt.Close panic as the rest of the sql package ensures. Updates #16019 Change-Id: Idc7ea9258ae23f491e79cce3efc365684a708428 Reviewed-on: https://go-review.googlesource.com/33328 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
CL https://golang.org/cl/33352 mentions this issue. |
Please answer these questions before submitting your issue. Thanks!
go version
)?go1.7beta1
go env
)?See go-sql-driver/mysql#450
reproducible example is here
No error log shown.
go-sql-driver/mysql prints
[mysql] 2016/04/24 13:56:27 statement.go:27: invalid connection
.It means Stmt.Close() is called twice. First stack trace is:
And second is:
Possible solution is:
The text was updated successfully, but these errors were encountered: