Fix RuntimeError: can't add a new key into hash during iteration issu…
AR-JDBC's version used:
52.1
version of Rails / ActiveRecord you're running with:
5.2.1
JRuby version (you might include your Java version as well) - jruby -v
jruby-9.2.0.0
A way to reproduce :)
Start a console with rails c and run this line within the console
100.times { Thread.new { ActiveRecord::Base.connection.execute "SELECT SLEEP(1)" } }
Solution: Implemented the fix based on this link: https://stackoverflow.com/a/27643890
include any (related) back-traces (or Java stack-traces) you've seen in the logs
[]= at org/jruby/RubyHash.java:1033
mysql_connection at /Users/ptong/.rvm/gems/jruby-9.2.0.0/gems/activerecord-jdbc-adapter-52.1-java/lib/arjdbc/mysql/connection_methods.rb:8
new_connection at /Users/ptong/.rvm/gems/jruby-9.2.0.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:809
checkout_new_connection at /Users/ptong/.rvm/gems/jruby-9.2.0.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:853
try_to_checkout_new_connection at /Users/ptong/.rvm/gems/jruby-9.2.0.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:832
acquire_connection at /Users/ptong/.rvm/gems/jruby-9.2.0.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:793
checkout at /Users/ptong/.rvm/gems/jruby-9.2.0.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:521
connection at /Users/ptong/.rvm/gems/jruby-9.2.0.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:380
retrieve_connection at /Users/ptong/.rvm/gems/jruby-9.2.0.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1008
retrieve_connection at /Users/ptong/.rvm/gems/jruby-9.2.0.0/gems/activerecord-5.2.1/lib/active_record/connection_handling.rb:118
connection at /Users/ptong/.rvm/gems/jruby-9.2.0.0/gems/activerecord-5.2.1/lib/active_record/connection_handling.rb:90
block in evaluate at (irb):1```
we didn't look into support for running AR-JDBC with DB2 systems, however we welcome the effort. ... you should change the branch from master to target 50-stable so it gets fixed for all 5x releases
The stack trace says the issue is in mysql, but the change is to the db2 file. Which system are you using?