---
title: "Debugging a Stack Overflow in Rails 7.2.1.1"
url: https://daily.dev/posts/debugging-a-stack-overflow-in-rails-7-2-1-1-spzjloril
source_url: https://www.bigbinary.com/blog/debugging-stack-overflow
type: article
source: "BigBinary"
published: 2025-11-25T18:06:10.292Z
updated: 2025-11-25T18:06:34.584Z
tags: ["performance", "ruby", "rails"]
reading_time: 7
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Debugging a Stack Overflow in Rails 7.2.1.1

**[BigBinary](https://daily.dev/sources/bigbinary)** · 7 min read · 0 upvotes · 0 comments

## Summary

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.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.bigbinary.com/blog/debugging-stack-overflow>

## Similar posts on daily.dev

- [Debugging a Stack Overflow in Rails 7.2.1.1](https://daily.dev/posts/debugging-a-stack-overflow-in-rails-7-2-1-1-cweswsrr8) · RUBYLAND · 1 upvotes · 0 comments
- [Engineering at Babylist](https://daily.dev/posts/engineering-at-babylist-eu2yhxdsr) · Ruby Flow · 0 upvotes · 0 comments
- [This Week in Rails: March 27, 2026](https://daily.dev/posts/this-week-in-rails-march-27-2026-urbkc7sbo) · This Week in Rails · 1 upvotes · 0 comments
- [Stack Buffer Overflow in Oj::Doc\#each\_child via Deeply Nested Input](https://daily.dev/posts/stack-buffer-overflow-in-oj-doc-each-child-via-deeply-nested-input-giufomo5u) · RUBYLAND · 1 upvotes · 0 comments
- [i coercion, custom to](https://daily.dev/posts/i-coercion-custom-to-w1nutb2rf) · This Week in Rails · 0 upvotes · 0 comments

---

Tags: [#performance](https://daily.dev/tags/performance), [#ruby](https://daily.dev/tags/ruby), [#rails](https://daily.dev/tags/rails)

[View this post on daily.dev](https://daily.dev/posts/debugging-a-stack-overflow-in-rails-7-2-1-1-spzjloril)
