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

libpq: another command is already in progress #297

Closed
ninegua opened this issue May 8, 2017 · 3 comments
Closed

libpq: another command is already in progress #297

ninegua opened this issue May 8, 2017 · 3 comments

Comments

@ninegua
Copy link

ninegua commented May 8, 2017

I am running into this error with an opaleye program. I can't really reproduce the error deterministically -- it seems to be occasional and random. Googling this error message turns up some possible explanations such as data not being read completely by the client. There is also an issue filed on postgresql-simple's issue track about the same error message, but the discussion was mostly about transaction and async exception, and there doesn't seem to be any conclusive decision.

My program does not use transaction, but it does run queries from more than one thread. So has anybody here run into the same error before? If so, what is the best practice to debug it? Or alternatively, what is the best practice to gracefully handle this error, e.g., where to catch it and maybe restart a new DB connection?

Any help is greatly appreciated!

Update 1: when this error happens, my program become unusable and must be shutdown likely because no DB query would go through any more.

Update 2: my program does use async exception, and it could happen to a thread at the time when it is doing some DB query. Maybe I should just mask the DB part?

@tomjaguarpaw
Copy link
Owner

Hi Paul, this is indeed an issue at a lower level than Opaleye. I suggest you continue the discussion on the postgresql-simple issue tracker. In particular you might want to discuss it with @hesselink. He has been using Opaleye.

@hesselink
Copy link
Contributor

If you're using async exceptions, it sounds like the same issue. You could push a bit harder for a fix on that postgresql-simple issue. If you're just using the async exceptions for timeouts, you could use my workaround posted there.

@ninegua
Copy link
Author

ninegua commented May 8, 2017

Thank you @hesselink @tomjaguarpaw . I didn't use timeout, but I was using async exception as a way to pass messages. I've since rewritten the code using channels, so I'll close this issue for now. I'll follow up on the postgresql-simple issue tracker if the problem comes up again.

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

3 participants