We have a bunch of sidekiq jobs (background workers) that talk to an API for a long time (10 minutes+) and then save the results into the DB.
For some APIs/users the jobs are failing consistently with ActiveRecord::StatementInvalid and:
PG::ConnectionBad: PQconsumeInput() server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
Render and its postgress should not have any limitation on long-lived connections, yet we are seeing this happen on a daily basis, some jobs never finish untill a workaround is implemented. Right now I am testing something like this: retry for ActiveRecord::StatementInvalid · GitHub
Has anyone seen a similar issue and found a solution? Render’s support has not been able to help so far.