Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RuntimeError: can't add a new key into hash during iteration issu… #954

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pytong
Copy link

@pytong pytong commented Oct 1, 2018

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```

@kares
Copy link
Member

kares commented Oct 4, 2018

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

@rdubya
Copy link
Collaborator

rdubya commented Oct 29, 2018

The stack trace says the issue is in mysql, but the change is to the db2 file. Which system are you using?

@dr-itz dr-itz mentioned this pull request Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants