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
If DuplicatePstatement will happen once, activerecord goes into DuplicatePstatement loop #22408
Comments
+1 |
If I understand correctly, this was explored in depth in #17607. The outcome seems to be that issue is most commonly caused by the rack-timeout gem, which is pretty nasty in that it can raise an exception at nearly any time. The Rails core team don't seem inclined to code the framework to defend against having the carpet pulled out from under them at any moment, which is totally reasonable. Heroku (who made rack-timeout) can't really do anything to handle this on their side — rack-timeout is intended to be a "last resort" defence against your app going totally unresponsive. So the burden falls to app developers to try especially hard to avoid hitting that timeout. I don't think there's a clean solution to this problem at this time, based on all my reading so far. |
This issue has been automatically marked as stale because it has not been commented on for at least The resources of the Rails team are limited, and so we are asking for your help. If you can still reproduce this error on the Thank you for all your contributions. |
This issue has been automatically closed because of inactivity. If you can still reproduce this error on the Thank you for all your contributions. |
Same here. I just restart dynos if I'm up when it happens, like now. Don't know what else to do. |
This is now fixed in 6-1-stable |
I have seen this issue on Rails 5.2.x, was the 6.1 fix backported to Rails 5? |
I'm guessing #41356 is the change that fixed this issue. (just linking them together – I haven't confirmed yet) |
We started seeing this issue in the logs:
Digging deeper, I found this piece of code:
https://github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L625
Basically, if the
@connection.prepare nextkey, sql
fails for some reason, then thenextkey
will not get saved.If the failure was because of
DuplicatePstatement
, this will become a problem, as subsequent prepared statement to also fail due to having an existing statement name.The text was updated successfully, but these errors were encountered: