You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feed reasonably large SQL (in my case ~ 600 lines) file with multiple query statements to ActiveRecord::Base.connection.execute while using Postgresql as database adapter and wait for results. For a long time. It is working ok in Rails 6.0.4.8 but when migrating to rails 7.0.3 one of my tests hangs for more than 5 minutes.
I solved a similar problem for the query with comments - #45012. That was merged in 7.0.3, but seems like not solving you problem.
Can you paste your query? Or some other query that reproduces you problem?
Sure. Had to anonymize this old legacy script a bit. It still seems to be related to comments, for example removing first header comment makes it perform in low tens of milliseconds
Steps to reproduce
Feed reasonably large SQL (in my case ~ 600 lines) file with multiple query statements to ActiveRecord::Base.connection.execute while using Postgresql as database adapter and wait for results. For a long time. It is working ok in Rails 6.0.4.8 but when migrating to rails 7.0.3 one of my tests hangs for more than 5 minutes.
To check it's the issue:
Fetched READ_QUERY from debugger just before the line that hangs:
https://github.com/rails/rails/blob/main/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb#L30
Expected behavior
It should perform the match in reasonable time, even in 1 second it would be fine
Actual behavior
It does not finish in at least 5 minutes keeping CPU at 100%.
System configuration
Rails version: 7.0.3
Ruby version: 3.1.2
The text was updated successfully, but these errors were encountered: