A production stack overflow error appeared after upgrading from Rails 7.1 to 7.2, caused by a change in how ActiveRecord builds OR queries. Rails 7.2 switched from iterative to recursive traversal of OR nodes, creating deep recursion with composite key queries containing many pairs. The issue was exacerbated by Async fibers

7m read timeFrom bigbinary.com
Post cover image
Table of contents
Identifying the problemGoing into Rails InternalsThe Tree Structure ProblemThe Async ConnectionThe GitHub TrailOur SolutionMeasuring and VerifyingReferences

Sort: