saurabhnanda / odd-jobs

Haskell job queue with admin UI and loads of other features.
https://www.haskelltutorials.com/odd-jobs/
BSD 3-Clause "New" or "Revised" License
75 stars 29 forks source link

Recommend users fork jobs with Async #65

Closed codygman closed 3 years ago

codygman commented 3 years ago

This might sound kind of silly, but without it ResourceT based connection pools put the connection back too early.

In the real world this translates to:

If you use Persistent and postgresql with odd-jobs with a connection pool you get "libpq: failed another command already in progress" errors.

We had this issue in production and it debugging it led me to:

https://github.com/snoyberg/conduit/issues/425

A more concise example you can play with yourself is at https://gist.github.com/codygman/d38a049092301ade8e8e1bb362cac778#file-main-hs-L23

I also created an issue on Persistent but I'm starting to think Persistent might not be able to fix this if it requires wrapping calls with Async:

https://github.com/yesodweb/persistent/issues/1199

codygman commented 3 years ago

This was a bit misguided... but I think an action item could be pointing out there may be asynchronous exception issues you should worry about while using odd-jobs.

Also see haskellari/postgresql-simple#69 which I believe affects odd-jobs as well.