Reputation: 6136
I am frequently getting Pg Connection timeout error in my application. I tried to fix it by upgrading the system memory, also updated the pg gem but the issue is still occurring. Anybody's help will be really appreciated.
(ActiveRecord::StatementInvalid) "PGError: server closed the connection unexpectedly\n\tThis probably means the server terminated abnormally\n\tbefore or while processing the request.\n: BEGIN"
Upvotes: 0
Views: 2289
Reputation: 4631
For what it's worth, the easiest solution is ActiveRecord::Base.connection.reconnect!
once connectivity is re-established.
Upvotes: 1
Reputation: 324285
Both the client and server think that the other vanished unexpectedly. This suggests that you're having networking problems. Look into the network between client and server:
Upvotes: 1