mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
sql: fix missing mutex unlock in an error case
Fixes #2542 R=golang-dev, r CC=golang-dev https://golang.org/cl/5483054
This commit is contained in:
parent
3dc278d3e2
commit
06a9bc6835
2 changed files with 14 additions and 0 deletions
|
|
@ -228,3 +228,16 @@ func TestTxStmt(t *testing.T) {
|
|||
t.Fatalf("Commit = %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Tests fix for issue 2542, that we release a lock when querying on
|
||||
// a closed connection.
|
||||
func TestIssue2542Deadlock(t *testing.T) {
|
||||
db := newTestDB(t, "people")
|
||||
closeDB(t, db)
|
||||
for i := 0; i < 2; i++ {
|
||||
_, err := db.Query("SELECT|people|age,name|")
|
||||
if err == nil {
|
||||
t.Fatalf("expected error")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue