nikita-volkov / hasql-pool

A pool of connections for Hasql
http://hackage.haskell.org/package/hasql-pool
MIT License
17 stars 15 forks source link

Resources should be returned to the pool or released when exceptions occur in sessions #25

Closed periodic closed 2 years ago

periodic commented 2 years ago

We are using hasql-pool in production and have been chasing down an error where it seems our connections get pulled but never returned to the pool. This leads to a state where all the attempts to run sessions just hang until they hit the connection-acquisition timeout.

I seem to have chased down at least one of these to a place where there was a transaction error in the session. The simple solution seems to be to add a catch around the session execution that returns the connection to the pool and propagates the exception in an appropriate manner.

I'll submit a PR shortly.

nikita-volkov commented 2 years ago

Fixed in 0.8.0.5