Issue #16503 has been updated by ko1 (Koichi Sasada).


Could you make reproducible script?


----------------------------------------
Bug #16503: "ret: 2, hash modified during iteration" error in Ruby 2.7.0
https://bugs.ruby-lang.org/issues/16503#change-83804

* Author: jnchito (Junichi Ito)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux] (heroku-18 stack)
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
I am running a Rails app on Heroku. After upgrading to Ruby 2.7, I sometimes get `ret: 2, hash modified during iteration` error.

The same issue is reported here (I'm using meta-tags gem too):
https://github.com/kpumuk/meta-tags/issues/209

This gem deletes elements while iterating hash (HashWithIndifferentAccess actually), so I guess it might involve this error:
https://github.com/kpumuk/meta-tags/blob/v2.13.0/lib/meta_tags/renderer.rb#L168
https://github.com/kpumuk/meta-tags/blob/v2.13.0/lib/meta_tags/renderer.rb#L181
https://github.com/kpumuk/meta-tags/blob/v2.13.0/lib/meta_tags/meta_tags_collection.rb#L85

However, this error does not occur every time (sometimes works, sometimes fails), and it didn't occur in Ruby 2.6. So I'm wondering why. Do you have any idea on this?



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>