You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there some way to get a more detailed trace that shows the original exception? Modification of a Hash during iteration is officially undefined behavior (in both CRuby and JRuby), so if some code is doing that we should find it and fix it.
@applecrusher yes, the error should happen on MRI as well:
> ruby -e'h={:a=>:b}; h.each{ h[:b] = :c }' -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin12.0]
-e:1:in `block in <main>': can't add a new key into hash during iteration (RuntimeError)
from -e:1:in `each'
from -e:1:in `<main>'
Sorry for the late reply, I was using Puma for multithreading and I think my app was not multithread safe. Once I disabled multithreading I had no further problems.
@applecrusher Ok. Hopefully you can find what hash was being mutated across threads and isolated it. A simple freeze would tell you who is doing the mutation. An alternative would be to dup it before iterating. If it's somewhere in Rails itself, we DEFINITELY want to find the problem, so it doesn't affect other users. I'm happy to help...find me on Twitter or Freenode IRC as headius.
I have the following code in config/application.rb that I believe is causing the error below.
I am getting this error on certain pages, I have no idea what could be causing it or how to avoid this.
The text was updated successfully, but these errors were encountered: