Skip to content
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: failures in TestTxStmtDeadlock starting Oct. 28 #42259

Closed
bcmills opened this issue Oct 28, 2020 · 4 comments
Closed

database/sql: failures in TestTxStmtDeadlock starting Oct. 28 #42259

bcmills opened this issue Oct 28, 2020 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Oct 28, 2020

--- FAIL: TestTxStmtDeadlock (0.01s)
    sql_test.go:2835: unexpected error while executing stmt, err: sql: statement is closed
FAIL
FAIL	database/sql	0.624s

Possibly due to CL 250178 (@tz70s, @odeke-em @kardianos).
(Possibly another deadlock similar to the one fixed in that CL.)

Marking as release-blocker because deadlock and test-regression.

2020-10-28T19:19:04-bc0d7fd/freebsd-amd64-12_0
2020-10-28T16:55:17-d4c1ad8/openbsd-386-64

@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker labels Oct 28, 2020
@bcmills bcmills added this to the Go1.16 milestone Oct 28, 2020
@kardianos
Copy link
Contributor

@bcmills Sorry. My fault. I'll look into ASAP.

@gopherbot
Copy link

Change https://golang.org/cl/266097 mentions this issue: database/sql: fix TestTxStmtDeadlock test

@tz70s
Copy link
Contributor

tz70s commented Oct 28, 2020

Yes sorry was due to one error check I wasn't aware of, the test was introduced by that CL as well instead of existing regression.

@gopherbot
Copy link

Change https://golang.org/cl/284513 mentions this issue: [release-branch.go1.15] database/sql: fix tx stmt deadlock when rollback

gopherbot pushed a commit that referenced this issue Mar 30, 2021
Tx acquires tx.closemu W-lock and then acquires stmt.closemu.W-lock
to fully close the transaction and associated prepared statement.
Stmt query and execution run in reverse ways - acquires
stmt.closemu.R-lock and then acquires tx.closemu.R-lock to grab tx
connection, which may cause deadlock.

Prevent the lock is held around tx.closePrepared to ensure no
deadlock happens.

Includes a test fix from CL 266097.
Fixes #42884
Updates #40985
Updates #42259

Change-Id: Id52737660ada3cebdfff6efc23366cdc3224b8e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/250178
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
(cherry picked from commit d4c1ad8)
Reviewed-on: https://go-review.googlesource.com/c/go/+/284513
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
@golang golang locked and limited conversation to collaborators Mar 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants