Open torgeirsh opened 1 year ago
Thanks for reporting! This is gonna be hard to reproduce.
I suggest trying the latest version of hasql-pool. Lots of work has been done on it since the version you mention. It's possible that some of it already has fixed the issue.
Unfortunately it occurs with both 0.9.0.1 and 0.10 on GHC 9.2.8 as well. It's relatively rare, possibly one in 100,000 connections. It's not tied to one specific query, it appears that they fail randomly.
We have observed "ClientError (Just "connection pointer is NULL\n")" on a few occasions, but are unfortunately not able to reproduce it. Since this error comes from PQerrorMessage in libpq (https://github.com/postgres/postgres/blob/b381d9637030c163c3b1f8a9d3de51dfc1b4ee58/src/interfaces/libpq/fe-connect.c#L7248), it suggests that the foreign pointer inside the Connection was null. Could that be due to a race condition related to connection pools? https://github.com/nikita-volkov/hasql-pool/issues/6#issuecomment-942122267 mentions that PQerrorMessage is not thread safe. This is with GHC 9.2.7, hasql 1.6.3, and hasql-pool 0.8.0.7.