Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"connection pointer is NULL" from libpq #38

Open
torgeirsh opened this issue Jun 28, 2023 · 2 comments
Open

"connection pointer is NULL" from libpq #38

torgeirsh opened this issue Jun 28, 2023 · 2 comments

Comments

@torgeirsh
Copy link

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? #6 (comment) 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.

@nikita-volkov
Copy link
Owner

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.

@torgeirsh
Copy link
Author

torgeirsh commented Jun 30, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants