Persistence interface for Haskell allowing multiple storage methods.
I don't think connection is returned to the pool here. The thread is interrupted when query is sent to server, but before the results are consumed. At that point cleanup action catches `ThreadKilled` exceptions and issues `ROLLBACK`, which fails with `libpg` exception because the previous operations was not completed. And now cleanup action rethrows the `libpg` exception instead of the `ThreadKilled` one - that's the behavior of `bracket` from `base`. [The fix](https://github.com/yesodweb/persistent/pull/1207/files#diff-f9d7f232cd00cb88188b7fcc68110e3f4cb378fcad9df652360de44d13cd86e3R199) was to use `bracket` from `unliftio`, which [rethrows the correct exception](https://hackage.haskell.org/package/unliftio-0.2.14/docs/src/UnliftIO.Exception.html#bracket).
mtl friendly exceptions
I see. Do you think rethrowing the original exception is the the right approach in all cases, or only in this case? In the documentation I wrote for the exceptions package, I recommend to let the release block's exceptions take priority, to match base's behavior. Should I recommend the opposite?
Learn any GitHub repo in 59 seconds. Onboard AI learns any GitHub repo in minutes and lets you chat with it to locate functionality, understand different parts, and generate new code. Use it for free at www.getonboard.dev.
Safe, consistent, and easy exception handling
In safe-exception and uniftio it was decided to rethrow the original exception exactly because they decided to use uninterruptibleMask, see here for details.
Mid-level client library for accessing PostgreSQL from Haskell
Hmm, you are right, the bracket I pointed to is unrelated. I guess the fix is in catchAny, which doesn't catch ThreadKilled. So not it's not rolling the transaction back in case of asynchronous exceptions. My point is that it probably should not rollback even on synchronous exception. BTW the issue is well know, see for example here
Pg_branch: Pre-alpha Postgres extension brings Neon-like branching
6 projects | news.ycombinator.com | 1 Oct 2023
Which Postgres client are you using?
1 project | /r/node | 29 Sep 2023
In-Depth Guide: Citus Technical Readme
1 project | news.ycombinator.com | 29 Sep 2023
JEP Draft: String Templates (Final)
1 project | news.ycombinator.com | 25 Sep 2023
How To Manage Access and Refresh Tokens for an API in Next.js 13 With Supabase and Prisma
3 projects | dev.to | 22 Sep 2023