Skip to content

database/sql: conn() can cause a deadlock #2542

@gopherbot

Description

@gopherbot

by samuel.stauffer:

What steps will reproduce the problem?
1. open a db
2. close the db
3. exec a query (returns error that db is closed)
4. exec a query - causes deadlock

What is the expected output?
All goroutines deadlocked

What do you see instead?
The same error about db being closed

Which compiler are you using (5g, 6g, 8g, gccgo)?
8g (though unrelated to compiler)

Which operating system are you using?
Linux/Ubuntu

Which revision are you using?  (hg identify)
5ea674d1b2ba+ tip

Please provide any additional information below.
conn() in exp/sql/sql.go:135 can return leaving db.mu locked if db.closed is true.

This is unlikely to show up in use as it requires ignoring the "closed" error
and trying again anyway.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions