jruby / activerecord-jdbc-adapter

JRuby's ActiveRecord adapter using JDBC.
BSD 2-Clause "Simplified" License
461 stars 385 forks source link

FrozenError: can't modify frozen Hash #1080

Closed hurricup closed 3 years ago

hurricup commented 3 years ago

Fresh generated rails app with rails 6.1.0 Jruby 9.2.9.0 (Rvm-single, Linux)

On attempt to migrate:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jruby.ext.openssl.SecurityHelper (file:/usr/share/rvm/rubies/jruby-9.2.9.0/lib/ruby/stdlib/jopenssl.jar) to constructor java.security.cert.CertificateFactory(java.security.cert.CertificateFactorySpi,java.security.Provider,java.lang.String)
WARNING: Please consider reporting this to the maintainers of org.jruby.ext.openssl.SecurityHelper
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
rake aborted!
FrozenError: can't modify frozen Hash
/home/user/.rvm/gems/jruby-9.2.9.0@untitled120/gems/activerecord-jdbc-adapter-50.0/lib/arjdbc/sqlite3/connection_methods.rb:3:in `sqlite3_connection'
/home/user/.rvm/gems/jruby-9.2.9.0@untitled120/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection'
/home/user/.rvm/gems/jruby-9.2.9.0@untitled120/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection'
/home/user/.rvm/gems/jruby-9.2.9.0@untitled120/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection'
/home/user/.rvm/gems/jruby-9.2.9.0@untitled120/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection'
/home/user/.rvm/gems/jruby-9.2.9.0@untitled120/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout'
/home/user/.rvm/gems/jruby-9.2.9.0@untitled120/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection'
/home/user/.rvm/gems/jruby-9.2.9.0@untitled120/gems/activerecord-6.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection'
/home/user/.rvm/gems/jruby-9.2.9.0@untitled120/gems/activerecord-6.1.0/lib/active_record/connection_handling.rb:319:in `retrieve_connection'
/home/user/.rvm/gems/jruby-9.2.9.0@untitled120/gems/activerecord-6.1.0/lib/active_record/connection_handling.rb:275:in `connection'
/home/user/.rvm/gems/jruby-9.2.9.0@untitled120/gems/activerecord-6.1.0/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/home/user/.rvm/gems/jruby-9.2.9.0@untitled120/gems/activerecord-6.1.0/lib/active_record/railties/databases.rake:92:in `block in <main>'
/home/user/.rvm/gems/jruby-9.2.9.0@untitled120/gems/activerecord-6.1.0/lib/active_record/railties/databases.rake:90:in `block in <main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

Process finished with exit code 1.

I presume after https://github.com/rails/rails/commit/2291d4a94fd3aff61c77d1a2ad1e6186ed4c80a2

rdubya commented 3 years ago

Hi @hurricup, it doesn't look like we've released support for Rails 6.1 yet. Based on that trace, it looks like you are trying to use version 50.0 which only supports Rails 5.0. Can you update to the latest 6.0.x release and see if it is still an issue?

hurricup commented 3 years ago
  1. default Gemfile generated by the rails contains

    gem 'activerecord-jdbcsqlite3-adapter'

    And I expect it to insstall proper working version.

  2. When i'm trying to specify dependency with version, like:

    gem 'activerecord-jdbcsqlite3-adapter', '~>60.2'

    I get an error:

    Bundler could not find compatible versions for gem "activerecord":
    In Gemfile:
    activerecord-jdbcsqlite3-adapter (~> 60.2) java was resolved to 60.2, which
    depends on
    activerecord-jdbc-adapter (= 60.2) java was resolved to 60.2, which
    depends on
        activerecord (~> 6.0.0) java
    
    rails (~> 6.1.0) java was resolved to 6.1.0, which depends on
      activerecord (= 6.1.0) java
rdubya commented 3 years ago

Ah, yeah it looks like we have the dependencies locked down now so it won't attempt to install the gem for the wrong version of Rails. We should probably fix the 50 version to do the same thing. At this point there isn't a release that is compatible with Rails 6.1 but you could potentially point it at the master branch for this repo and test it out with that until the new version is ready. @enebo @dr-itz do you have any more info on this?

dr-itz commented 3 years ago

I just created #1081 so we can have a 61.0 release soon.

Looking at the dependency problem in 50.x it turns out it's fixed with 50.1 whereas 50.0 has it wrong

enebo commented 3 years ago

61.0 was just put out. It will pick up that version now. Closing.