Skip to content
New issue

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

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

Already on GitHub? # to your account

Don't ignore error message on PQ.consumeInput #20

Closed
steve-chavez opened this issue Mar 12, 2024 · 3 comments
Closed

Don't ignore error message on PQ.consumeInput #20

steve-chavez opened this issue Mar 12, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@steve-chavez
Copy link

Hey @diogob,

On PostgREST/postgrest#3313 (reply in thread), a user reports the LISTEN channel is getting killed and we're getting a generic error message from hasql-notifications which comes from:

Nothing -> panic "Error checking for PostgreSQL notifications"

There might be more details on PQ.consumeInput, since according to pg docs:

PQconsumeInput normally returns 1 indicating “no error”, but returns 0 if there was some kind of trouble (in which case PQerrorMessage can be consulted).

However PQ.consumeInput result is getting ignored on:

void $ PQ.consumeInput pqCon

@diogob
Copy link
Owner

diogob commented Mar 12, 2024

Hi @steve-chavez , would a panic with some custom message work on your side? I can get the string from PQerrorMessage and default to the generic one when no string is available (comes inside a Maybe).

It could be the case that the call to PQsocket is failing during the connection setup (I think that panic should not be there, perhaps just using a delay will fix the issue).

I'll work on a PR to fix this.

@diogob diogob self-assigned this Mar 12, 2024
@diogob diogob added the bug Something isn't working label Mar 12, 2024
@diogob
Copy link
Owner

diogob commented Mar 12, 2024

@steve-chavez I just put together a quick attempt to address the issue on #21 but haven't tested it. Are you able to use the version from that branch and verify if the behaviour change would satisfy your case?

@diogob
Copy link
Owner

diogob commented Mar 13, 2024

@steve-chavez just published 0.2.1.0

@diogob diogob closed this as completed Mar 13, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants