jruby / activerecord-jdbc-adapter

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

activerecord-jdbcsqlite3-adapter v61.1 is not working with activerecord v6.1.5 #1106

Closed AndyObtiva closed 2 years ago

AndyObtiva commented 2 years ago

jruby -v

jruby 9.3.3.0 (2.6.8) 2022-01-19 b26de1f5c5 Java HotSpot(TM) 64-Bit Server VM 18+36-2087 on 18+36-2087 +jit [darwin-x86_64]

uname -a

Darwin Andys-MacBook-Pro-13.local 19.6.0 Darwin Kernel Version 19.6.0: Tue Feb 15 21:39:11 PST 2022; root:xnu-6153.141.59~1/RELEASE_X86_64 x86_64

My gem versions are:

gem 'activerecord', '~> 6.1.5'
gem 'activerecord-jdbcsqlite3-adapter', '~> 61.1', :platform => :jruby

When I run the following code in IRB:

require 'active_record'
require 'activerecord-jdbcsqlite3-adapter' if defined? JRUBY_VERSION
@connection = ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: 'db/database.sqlite3')

I get the following output and error:

jruby-9.3.3.0 :001 > require 'active_record'
 => true 
jruby-9.3.3.0 :004 > require 'activerecord-jdbcsqlite3-adapter' if defined? JRUBY_VERSION
 => true 
jruby-9.3.3.0 :005 > @connection = ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: 'db/database.sqlite3')
Traceback (most recent call last):
       16: from org/jruby/RubyKernel.java:1237:in `catch'
       15: from org/jruby/RubyKernel.java:1507:in `loop'
       14: from org/jruby/RubyKernel.java:1091:in `eval'
       13: from (irb):5:in `evaluate'
       12: from /Users/andymaleh/.rvm/gems/jruby-9.3.3.0@contact_manager/gems/activerecord-6.1.5/lib/active_record/connection_handling.rb:52:in `establish_connection'
       11: from /Users/andymaleh/.rvm/gems/jruby-9.3.3.0@contact_manager/gems/activerecord-6.1.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:1046:in `establish_connection'
       10: from /Users/andymaleh/.rvm/gems/jruby-9.3.3.0@contact_manager/gems/activerecord-6.1.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:1205:in `resolve_pool_config'
        9: from /Users/andymaleh/.rvm/gems/jruby-9.3.3.0@contact_manager/gems/activesupport-6.1.5/lib/active_support/dependencies.rb:332:in `require'
        8: from /Users/andymaleh/.rvm/gems/jruby-9.3.3.0@contact_manager/gems/activesupport-6.1.5/lib/active_support/dependencies.rb:299:in `load_dependency'
        7: from /Users/andymaleh/.rvm/gems/jruby-9.3.3.0@contact_manager/gems/activesupport-6.1.5/lib/active_support/dependencies.rb:332:in `block in require'
        6: from /Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:96:in `require'
        5: from org/jruby/RubyKernel.java:1017:in `require'
        4: from /Users/andymaleh/.rvm/gems/jruby-9.3.3.0@contact_manager/gems/activerecord-6.1.5/lib/active_record/connection_adapters/sqlite3_adapter.rb:13:in `<main>'
        3: from /Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/stdlib/rubygems/core_ext/kernel_gem.rb:62:in `gem'
        2: from /Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/stdlib/rubygems/dependency.rb:323:in `to_spec'
        1: from /Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/stdlib/rubygems/dependency.rb:311:in `to_specs'
LoadError (Error loading the 'sqlite3' Active Record adapter. Missing a gem it depends on? Could not find 'sqlite3' (~> 1.4) among 131 total gem(s))
Checked in 'GEM_PATH=/Users/andymaleh/.rvm/gems/jruby-9.3.3.0@contact_manager:/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/gems/shared' , execute `gem env` for more information

I even tried to add the following 2 extra lines to the code (line 2 and 3), but to no avail:

require 'active_record'
require 'jdbc/sqlite3'
Jdbc::SQLite3.load_driver
require 'activerecord-jdbcsqlite3-adapter' if defined? JRUBY_VERSION
@connection = ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: 'db/database.sqlite3')

The original code above used to work with older versions of activerecord (5.2.4.3) and activerecord-jdbcsqlite3-adapter (52.6). I am not sure if I am perhaps mixing the wrong version combinations of the two gems.

Help is appreciated!

rubycoder commented 2 years ago

Using JRuby 9.3.4.0 on Windows 7 SP1, with the same versions of the gems, I get the same error from IRB that @AndyObtiva did.

I then manually applied the pull request from @terencechow https://github.com/jruby/activerecord-jdbc-adapter/pull/1096 which resolved the error:

irb(main):001:0> require 'active_record'
=> true
irb(main):002:0> require 'activerecord-jdbcsqlite3-adapter' if defined? JRUBY_VERSION
=> true
irb(main):003:0> @connection = ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: 'db/database.sqlite3')
=> #<ActiveRecord::ConnectionAdapters::ConnectionPool:0x738a39cc @connection_klass=ActiveRecord::Base, @connections=[], @thread_cac
hed_conns=#<Concurrent::Map:0x40738846 entries=0 default_proc=nil>, @checkout_timeout=5.0, @mon_data_owner_object_id=4020, @now_con
necting=0, @pool_config=#<ActiveRecord::ConnectionAdapters::PoolConfig:0x6de33fde @connection_klass=ActiveRecord::Base, @db_config=
#<ActiveRecord::DatabaseConfigurations::HashConfig:0x1255de25 @name="primary", @env_name="default_env", @configuration_hash={:adapt
er=>"sqlite3", :database=>"db/database.sqlite3"}>, @_mutex=#<Thread::Mutex:0x5891b7c5>, @pool=#<ActiveRecord::ConnectionAdapters::C
onnectionPool:0x738a39cc ...>>, @automatic_reconnect=true, @threads_blocking_new_connections=0, @mon_data=#<Monitor:0x4fc3529>, @av
ailable=#<ActiveRecord::ConnectionAdapters::ConnectionPool::ConnectionLeasingQueue:0x38e46765 @lock=#<ActiveRecord::ConnectionAdapt
ers::ConnectionPool:0x738a39cc ...>, @queue=[], @cond=#<MonitorMixin::ConditionVariable:0x192f5f39 @monitor=#<Monitor:0x4fc3529>, @
cond=#<Thread::ConditionVariable:0x4cd5fc46>>, @num_waiting=0>, @idle_timeout=300.0, @db_config=#<ActiveRecord::DatabaseConfigurati
ons::HashConfig:0x1255de25 @name="primary", @env_name="default_env", @configuration_hash={:adapter=>"sqlite3", :database=>"db/datab
ase.sqlite3"}>, @query_cache_enabled=#<Concurrent::Map:0x2965dd88 entries=0 default_proc=#<Proc:0x3221588e@C:/Ruby/jruby-9.3.4.0/li
b/ruby/gems/shared/gems/activerecord-6.1.5/lib/active_record/connection_adapters/abstract/query_cache.rb:32>>, @size=5, @reaper=#<A
ctiveRecord::ConnectionAdapters::ConnectionPool::Reaper:0x51141f64 @pool=#<ActiveRecord::ConnectionAdapters::ConnectionPool:0x738a3
9cc ...>, @frequency=60.0>, @lock_thread=false>
irb(main):004:0>
AndyObtiva commented 2 years ago

@headius is there any chance the PR @rubycoder mentioned could be merged sometime soon? This gem is the main library used in Glimmer DSL for SWT desktop apps for including a SQLite database with ActiveRecord. I realize that users could revert to an older working version as a workaround, but it’s a shame they could not use the latest version reliably. I have been asked by someone to provide a blog post tutorial on how to integrate SQLite and ActiveRecord with a Glimmer DSL for SWT desktop app. But, this issue is a blocker.

enebo commented 2 years ago

@AndyObtiva We can release a fix and this PR is fine but do you know if this happened during a point release of 6.1? Or perhaps Rails itself somehow creates connections using a different call? The PR itself will gracefully go back to older constant so I should not be too concerned about this but I am just trying to figure out why this is broken for 6.1.5.

enebo commented 2 years ago

Actually #1095 Gives a reasonable explanation but I checked back and for 9.3.4.0 I ran 6.1.3.2 (don't ask) as a full rails app using sqlite3 and it runs using rails commands. I am wondering how rails bootstraps vs it being called directly. As I said we will fix this so people can call establish connection directly but I am hoping to understand this a little more.

AndyObtiva commented 2 years ago

I tried creating a new rails 6.1.5 app (not 6.1.3.2) under jruby-9.3.3.0 ARM64 M1 Chip Mac, and I got a different error during generation of the app, which prevented me to go as far as testing the rails commands for SQLite and ActiveRecord:

Installing sassc 2.4.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/Users/andymaleh/.rvm/gems/jruby-9.3.3.0@code/gems/sassc-2.4.0/ext
/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/bin/jruby -I
/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/stdlib -r
./siteconf20220429-45551-13rk1ls.rb extconf.rb
creating Makefile

current directory:
/Users/andymaleh/.rvm/gems/jruby-9.3.3.0@code/gems/sassc-2.4.0/ext
make DESTDIR\= clean

current directory:
/Users/andymaleh/.rvm/gems/jruby-9.3.3.0@code/gems/sassc-2.4.0/ext
make DESTDIR\=
compiling ./libsass/src/ast.cpp
clang: error: invalid arch name '-arch aarch64'
make: *** [ast.o] Error 1

make failed, exit code 2

Gem files will remain installed in
/Users/andymaleh/.rvm/gems/jruby-9.3.3.0@code/gems/sassc-2.4.0 for inspection.
Results logged to
/Users/andymaleh/.rvm/gems/jruby-9.3.3.0@code/extensions/universal-java-17/2.6.0/sassc-2.4.0/gem_make.out

/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/stdlib/rubygems/ext/builder.rb:92:in
`run'
/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/stdlib/rubygems/ext/builder.rb:43:in
`block in make'
  org/jruby/RubyArray.java:1865:in `each'
/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/stdlib/rubygems/ext/builder.rb:35:in
`make'
/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:63:in
`block in build'
  org/jruby/ext/tempfile/Tempfile.java:242:in `open'
/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:26:in
`build'
/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/stdlib/rubygems/ext/builder.rb:158:in
`build_extension'
/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/stdlib/rubygems/ext/builder.rb:192:in
`block in build_extensions'
  org/jruby/RubyArray.java:1865:in `each'
/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/stdlib/rubygems/ext/builder.rb:189:in
`build_extensions'
/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/stdlib/rubygems/installer.rb:837:in
`build_extensions'
/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/gems/shared/gems/bundler-2.3.5/lib/bundler/rubygems_gem_installer.rb:71:in
`build_extensions'
/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/gems/shared/gems/bundler-2.3.5/lib/bundler/rubygems_gem_installer.rb:28:in
`install'
/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/gems/shared/gems/bundler-2.3.5/lib/bundler/source/rubygems.rb:204:in
`install'
/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/gems/shared/gems/bundler-2.3.5/lib/bundler/installer/gem_installer.rb:54:in
`install'
/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/gems/shared/gems/bundler-2.3.5/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/gems/shared/gems/bundler-2.3.5/lib/bundler/installer/parallel_installer.rb:186:in
`do_install'
/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/gems/shared/gems/bundler-2.3.5/lib/bundler/installer/parallel_installer.rb:177:in
`block in worker_pool'
/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/gems/shared/gems/bundler-2.3.5/lib/bundler/worker.rb:62:in
`apply_func'
/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/gems/shared/gems/bundler-2.3.5/lib/bundler/worker.rb:57:in
`block in process_queue'
  org/jruby/RubyKernel.java:1507:in `loop'
/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/gems/shared/gems/bundler-2.3.5/lib/bundler/worker.rb:54:in
`process_queue'
/Users/andymaleh/.rvm/rubies/jruby-9.3.3.0/lib/ruby/gems/shared/gems/bundler-2.3.5/lib/bundler/worker.rb:91:in
`block in create_threads'

An error occurred while installing sassc (2.4.0), and Bundler cannot
continue.

In Gemfile:
  sass-rails was resolved to 6.0.0, which depends on
    sassc-rails was resolved to 2.1.2, which depends on
      sassc

That issue probably oughta get addressed too. It seems that they hardcoded a C dependency for a gem (sass-rails) that is usable in JRuby too, which is the cause of the issue.

I just reported that issue over here in case it is a serious one and not just a user error though if I'm wrong, I'd be happy to stand corrected: https://github.com/rails/sass-rails/issues/447

AndyObtiva commented 2 years ago

I just added a note to my last comment about the fact that I am using a Mac M1 Chip ARM64 CPU architecture.

% uname -a
Darwin Andys-Lexop-MacBook-Pro.local 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:47:26 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T8101 arm64

That might be related to this last error. I noted it on the opened issue on the sass-rails project too.

enebo commented 2 years ago

@AndyObtiva yeah that is something I am not seeing but it has to be related to M1 and how sassc is specified.

I have released 61.2 which applied #1096. So you should be able to establish_connection in the way you wrote above. Rails must have some additional magic which is unclear to me but I can run Rails itself before or after the PR. I personally like that the PR limits the range of this special require behavior.

I will apologize on all three issues/prs that this got lost in the fog. Thanks for pinging us again.

AndyObtiva commented 2 years ago

I just confirmed that I could install and build a Rails 6.1.5 app in JRuby 9.3.3.0 just fine on an Intel Mac machine, so the issue that I reported at sass-rails is limited to M1 Chip Macs (ARM64) only.

Thank you @enebo for the release. I just tested it and confirmed it resolves the issue.

headius commented 2 years ago

The arch issue should be fixed in JRuby 9.3.4.0. there was a set of changes there to correct the arch flag to be arm64 on MacOS.

AndyObtiva commented 2 years ago

I confirm that the sass-rails issue was fixed in JRuby 9.3.4.0

That said, I got another issue when running rails s from a rails 6.1.5 generated app with rails new app_name:

% rails s
=> Booting Puma
=> Rails 6.1.5.1 application starting in development 
=> Run `bin/rails server --help` for more startup options
Puma starting in single mode...
* Puma version: 5.6.4 (jruby 9.3.4.0 - ruby 2.6.8) ("Birdie's Version")
*  Min threads: 5
*  Max threads: 5
*  Environment: development
*          PID: 58156
* Listening on http://[::1]:3000
* Listening on http://127.0.0.1:3000
Use Ctrl-C to stop
Started GET "/" for 0:0:0:0:0:0:0:1 at 2022-05-03 13:05:47 -0400

ActiveRecord::JDBCError (Error opening connection):

arjdbc/jdbc/RubyJdbcConnection.java:532:in `initialize'
org/jruby/RubyClass.java:895:in `new'
activerecord-jdbc-adapter-61.2 (java) lib/arjdbc/abstract/core.rb:21:in `initialize'
activerecord-jdbc-adapter-61.2 (java) lib/arjdbc/sqlite3/adapter.rb:87:in `initialize'
activerecord-jdbc-adapter-61.2 (java) lib/arjdbc/abstract/statement_cache.rb:23:in `initialize'
org/jruby/RubyClass.java:909:in `new'
activerecord-jdbc-adapter-61.2 (java) lib/arjdbc/jdbc/connection_methods.rb:10:in `jdbc_connection'
activerecord-jdbc-adapter-61.2 (java) lib/arjdbc/sqlite3/connection_methods.rb:59:in `sqlite3_connection'
org/jruby/RubyKernel.java:2003:in `public_send'
activerecord (6.1.5.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection'
activerecord (6.1.5.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection'
activerecord (6.1.5.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection'
activerecord (6.1.5.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection'
activerecord (6.1.5.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout'
activerecord (6.1.5.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection'
activerecord (6.1.5.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection'
activerecord (6.1.5.1) lib/active_record/connection_handling.rb:327:in `retrieve_connection'
activerecord (6.1.5.1) lib/active_record/connection_handling.rb:283:in `connection'
activerecord (6.1.5.1) lib/active_record/migration.rb:611:in `connection'
activerecord (6.1.5.1) lib/active_record/migration.rb:606:in `build_watcher'
activerecord (6.1.5.1) lib/active_record/migration.rb:588:in `block in call'
org/jruby/ext/thread/Mutex.java:171:in `synchronize'
activerecord (6.1.5.1) lib/active_record/migration.rb:587:in `call'
actionpack (6.1.5.1) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (6.1.5.1) lib/active_support/callbacks.rb:98:in `run_callbacks'
actionpack (6.1.5.1) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (6.1.5.1) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (6.1.5.1) lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
actionpack (6.1.5.1) lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
web-console (4.2.0) lib/web_console/middleware.rb:132:in `call_app'
web-console (4.2.0) lib/web_console/middleware.rb:28:in `block in call'
org/jruby/RubyKernel.java:1237:in `catch'
web-console (4.2.0) lib/web_console/middleware.rb:17:in `call'
actionpack (6.1.5.1) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (6.1.5.1) lib/rails/rack/logger.rb:37:in `call_app'
railties (6.1.5.1) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (6.1.5.1) lib/active_support/tagged_logging.rb:99:in `block in tagged'
activesupport (6.1.5.1) lib/active_support/tagged_logging.rb:37:in `tagged'
activesupport (6.1.5.1) lib/active_support/tagged_logging.rb:99:in `tagged'
railties (6.1.5.1) lib/rails/rack/logger.rb:26:in `call'
sprockets-rails (3.4.2) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (6.1.5.1) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (6.1.5.1) lib/action_dispatch/middleware/request_id.rb:26:in `call'
rack (2.2.3) lib/rack/method_override.rb:24:in `call'
rack (2.2.3) lib/rack/runtime.rb:22:in `call'
activesupport (6.1.5.1) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (6.1.5.1) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (6.1.5.1) lib/action_dispatch/middleware/static.rb:24:in `call'
rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
actionpack (6.1.5.1) lib/action_dispatch/middleware/host_authorization.rb:148:in `call'
rack-mini-profiler (2.3.4) lib/mini_profiler/profiler.rb:393:in `call'
webpacker (5.4.3) lib/webpacker/dev_server_proxy.rb:25:in `perform_request'
rack-proxy (0.7.2) lib/rack/proxy.rb:67:in `call'
railties (6.1.5.1) lib/rails/engine.rb:539:in `call'
puma-5.6.4 (java) lib/puma/configuration.rb:252:in `call'
puma-5.6.4 (java) lib/puma/request.rb:77:in `block in handle_request'
puma-5.6.4 (java) lib/puma/thread_pool.rb:340:in `with_force_shutdown'
puma-5.6.4 (java) lib/puma/request.rb:76:in `handle_request'
puma-5.6.4 (java) lib/puma/server.rb:441:in `process_client'
puma-5.6.4 (java) lib/puma/thread_pool.rb:147:in `block in spawn_thread'

NoMethodError: undefined method `bindings' for #<Java::JavaSql::SQLException: Error opening connection>
Did you mean?  binding
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/web-console-4.2.0/lib/web_console/exception_mapper.rb:25:in `initialize'
    from org/jruby/RubyClass.java:888:in `new'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/web-console-4.2.0/lib/web_console/exception_mapper.rb:11:in `follow'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/web-console-4.2.0/lib/web_console/session.rb:34:in `from'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/web-console-4.2.0/lib/web_console/middleware.rb:30:in `block in call'
    from org/jruby/RubyKernel.java:1237:in `catch'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/web-console-4.2.0/lib/web_console/middleware.rb:17:in `call'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/actionpack-6.1.5.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/railties-6.1.5.1/lib/rails/rack/logger.rb:37:in `call_app'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/railties-6.1.5.1/lib/rails/rack/logger.rb:26:in `block in call'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/activesupport-6.1.5.1/lib/active_support/tagged_logging.rb:99:in `block in tagged'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/activesupport-6.1.5.1/lib/active_support/tagged_logging.rb:37:in `tagged'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/activesupport-6.1.5.1/lib/active_support/tagged_logging.rb:99:in `tagged'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/railties-6.1.5.1/lib/rails/rack/logger.rb:26:in `call'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/sprockets-rails-3.4.2/lib/sprockets/rails/quiet_assets.rb:13:in `call'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/actionpack-6.1.5.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/actionpack-6.1.5.1/lib/action_dispatch/middleware/request_id.rb:26:in `call'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/rack-2.2.3/lib/rack/method_override.rb:24:in `call'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/rack-2.2.3/lib/rack/runtime.rb:22:in `call'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/activesupport-6.1.5.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/actionpack-6.1.5.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/actionpack-6.1.5.1/lib/action_dispatch/middleware/static.rb:24:in `call'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/rack-2.2.3/lib/rack/sendfile.rb:110:in `call'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/actionpack-6.1.5.1/lib/action_dispatch/middleware/host_authorization.rb:148:in `call'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/rack-mini-profiler-2.3.4/lib/mini_profiler/profiler.rb:393:in `call'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/webpacker-5.4.3/lib/webpacker/dev_server_proxy.rb:25:in `perform_request'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/rack-proxy-0.7.2/lib/rack/proxy.rb:67:in `call'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/railties-6.1.5.1/lib/rails/engine.rb:539:in `call'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/puma-5.6.4-java/lib/puma/configuration.rb:252:in `call'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/puma-5.6.4-java/lib/puma/request.rb:77:in `block in handle_request'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/puma-5.6.4-java/lib/puma/thread_pool.rb:340:in `with_force_shutdown'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/puma-5.6.4-java/lib/puma/request.rb:76:in `handle_request'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/puma-5.6.4-java/lib/puma/server.rb:441:in `process_client'
    from /Users/andymaleh/.rvm/gems/jruby-9.3.4.0@code/gems/puma-5.6.4-java/lib/puma/thread_pool.rb:147:in `block in spawn_thread'
^C- Gracefully stopping, waiting for requests to finish
=== puma shutdown: 2022-05-03 13:06:11 -0400 ===
- Goodbye!
Exiting

I tried running rails db:create next, but I got an error:

% rails db:create
Error opening connection
Couldn't create 'db/development.sqlite3' database. Please check your configuration.
rails aborted!
ActiveRecord::JDBCError: Error opening connection

Caused by:
Java::JavaSql::SQLException: Error opening connection

Caused by:
Java::JavaLang::Exception: No native library is found for os.name=Mac and os.arch=aarch64. path=/org/sqlite/native/Mac/aarch64

Tasks: TOP => db:create
(See full trace by running task with --trace)

These might be ARM64 (AARCH64) related issues.

I'm at work right now, so I couldn't spend more time on this, but when I get home, I'll try the same commands on my Intel Mac to see if I get an issue there in JRuby 9.3.4.0.

AndyObtiva commented 2 years ago

I just tried installing Rails 6.1.5 in JRuby 9.3.4.0 on my Intel Mac, creating a new app, starting the server, and creating the database, and it all worked, just like JRuby 9.3.3.0 on the Intel Mac.

AndyObtiva commented 2 years ago

I just documented the newly discovered ARM64 Mac issue in a separate GitHub issue: https://github.com/jruby/activerecord-jdbc-adapter/issues/1113

Otherwise, thanks again for resolving this GitHub issue.