The Second Oldest Bug
summary
Bug 4040 is fixed for C methods in Ruby 3.3: calling a method with a huge splatted array no longer crashes with SystemStackError because the VM switches to a temporary hidden Ruby array on the heap and passes a pointer via a new Heap argv flag instead of copying onto the VM stack. The patch covers send, symbol to_proc, method objects, defined_method/defined_singleton_method and rb_yield, balances a minor dispatch slowdown with targeted method call optimizations, and notes thresholds (~1,000,000 main VM ~132k thread ~16,400 fiber ~2,000 tuned).
AI-written summary · about
chapters (21)
- 0:00Introduction
- 1:29Ruby’s second oldest bug
- 3:56Why this bug matters in real applications
- 5:44System stack errors in Ruby
- 7:09Debugging with GDB
- 11:26Ruby VM stack and memory
- 14:54Stack size impact on web apps
- 15:38Bug root cause in argument handling
- 17:45Fix design for large array splats
- 21:57Temporary array solution
- 23:01Patch performance trade-offs
- 24:48Bug as a class of issues
- 26:15Fixing B-method calls with splats
- 28:46Maintainability vs duplication
- 31:14Additional cases requiring fixes
- 33:41Exception handling for restricted methods
- 35:49Fix costs and benefits
- 37:36Optimizing method calls
- 41:29Community review and approval
- 42:32Lessons from the fix
- 43:59Closing remarks








