database/sql: Tx.Rollback hangs after panic in Valuer.Value #26332
Labels
FrozenDueToAge
help wanted
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
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: