Fix mutex deadlock in setup_connection (#128)

Adds auto_release = false in setup_connection to avoid trying to release
the connection to the pool before it has been added.
This commit is contained in:
Johannes Müller 2020-09-14 15:55:18 +02:00 committed by GitHub
parent 291b65b853
commit fad9e70353
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View file

@ -8,6 +8,7 @@ describe DB::Database do
db.setup_connection do |cnn|
cnn_setup += 1
cnn.scalar("1").should eq "1"
end
cnn_setup.should eq(2)

View file

@ -55,6 +55,7 @@ module DB
@pool = uninitialized Pool(Connection) # in order to use self in the factory proc
@pool = Pool.new(**pool_options) {
conn = @driver.build_connection(self).as(Connection)
conn.auto_release = false
@setup_connection.call conn
conn
}