-
Notifications
You must be signed in to change notification settings - Fork 18k
database/sql: Tx.Rollback hangs after panic in Valuer.Value #26332
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
CC @kardianos |
I don't think this is a regression. We can consider a cl for 1.12. |
Can/should I submit a PR? |
Change https://golang.org/cl/138579 mentions this issue: |
I sent a CL that adds a test that demonstrates this behavior. This is to help me understand what is involved in this issue. In the entire |
Change https://golang.org/cl/170700 mentions this issue: |
What version of Go are you using (
go version
)?go1.10.2 darwin/amd64
Does this issue reproduce with the latest release?
Tested on
go1.10.3 darwin/amd64
as well.What operating system and processor architecture are you using (
go env
)?What did you do?
Must have a PostgreSQL server setup locally with a database called
test_bug
.What did you expect to see?
Some sort of indication of a panic, followed by the program exiting.
What did you see instead?
Nothing. The program hangs with no output.
What I think is the problem
In
sql.go
inExecContext
,releaseConn
is not deferred so when a panic happens in aValuer.Value
call deep withinresultFromStatement
, there is some lock being held on to. Then, whenTx.Rollback
is called because it has been deferred, it hangs, stopping the unrolling of the stack and preventing any output from being shown or the process from exiting cleanly. I think we should change lines 2316-2320 to something likeThe text was updated successfully, but these errors were encountered: