BigBinary
Read post

Debugging a Stack Overflow in Rails 7.2.1.1

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 having smaller stack sizes than threads. The problem was fixed in Rails 7.2.2 by flattening the OR node structure, but a workaround using simpler queries with in-memory filtering can be implemented for earlier versions.

    #performance#ruby#rails
Nov 25, 2025•7m read time•From bigbinary.com
Post cover image
Table of contents
Identifying the problemGoing into Rails InternalsThe Tree Structure ProblemThe Async ConnectionThe GitHub TrailOur SolutionMeasuring and VerifyingReferences
386 Impressions
BigBinary's image
BigBinary

BigBinary is a resource for Ruby on Rails developers, offering tutorials, articles, and best practic...

14 Followers

•

194 Upvotes

Would you recommend this post?

Copy link
WhatsApp
Facebook
X
New Squad
  • © 2026 Daily Dev Ltd.
  • Guidelines
  • Explore
  • Tags
  • Sources
  • Squads
  • Leaderboard