This project is archived and is in readonly mode.
DateTime arithmetic: Stack level too deep
Reported by Pieter Bos | March 17th, 2010 @ 01:11 PM
Do the following in a Rails 3.0.0.beta app (on ruby 1.8.7 at least)
script/rails console
DateTime.now - 1.day
Result:
SystemStackError: stack level too deep
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/active_support/core_ext/date_time/calculations.rb:52:in `advance'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/active_support/core_ext/date_time/calculations.rb:52:in `advance'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/active_support/duration.rb:90:in `sum'
from (irb):4:in `inject'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/active_support/duration.rb:85:in `each'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/active_support/duration.rb:85:in `inject'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/active_support/duration.rb:85:in `sum'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/active_support/duration.rb:61:in `since'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/active_support/core_ext/date/calculations.rb:67:in `plus_with_duration'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/active_support/core_ext/date/calculations.rb:77:in `-'
from (irb):4
Workaround: use to_i, then convert back to datetime. It's annoying though. Verified both on windows (mingw32 build) and mac OS
Comments and changes to this ticket
-
Greg Campbell April 13th, 2010 @ 07:43 AM
This is reproducible on my machine. I believe it should be fixed by the patch in #3972.
-
Greg Campbell June 11th, 2010 @ 08:37 PM
This was fixed by this commit, which applied the patch from #3972. Both tickets can be closed.
-
Ryan Bigg June 12th, 2010 @ 02:53 AM
- State changed from new to resolved
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>