ibmdb / ruby-ibmdb

Rails Adapter/Ruby driver for IBM DB2 and IBM Informix
42 stars 48 forks source link

Error when trying to use version 5.3.1 with Rails 6.0.3 #134

Closed jfahrenkrug closed 1 year ago

jfahrenkrug commented 1 year ago

After updating ibm_db to version 5.3.1 in my Gemfile and running bundle install successfully, I get this error when trying to start my Rails 6.0.3 app with unicorn:

/usr/local/bundle/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:34:in `require': cannot load such file -- active_record/connection_adapters (LoadError) 69: from /usr/local/bundle/bin/bundle:23:in `<main>' 68: from /usr/local/bundle/bin/bundle:23:in `load' 67: from /usr/local/bundle/gems/bundler-2.3.17/exe/bundle:36:in `<top (required)>' 66: from /usr/local/bundle/gems/bundler-2.3.17/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors' 65: from /usr/local/bundle/gems/bundler-2.3.17/exe/bundle:48:in `block in <top (required)>' 64: from /usr/local/bundle/gems/bundler-2.3.17/lib/bundler/cli.rb:25:in `start' 63: from /usr/local/bundle/gems/bundler-2.3.17/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start' 62: from /usr/local/bundle/gems/bundler-2.3.17/lib/bundler/cli.rb:31:in `dispatch' 61: from /usr/local/bundle/gems/bundler-2.3.17/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch' 60: from /usr/local/bundle/gems/bundler-2.3.17/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' 59: from /usr/local/bundle/gems/bundler-2.3.17/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run' 58: from /usr/local/bundle/gems/bundler-2.3.17/lib/bundler/cli.rb:483:in `exec' 57: from /usr/local/bundle/gems/bundler-2.3.17/lib/bundler/cli/exec.rb:23:in `run' 56: from /usr/local/bundle/gems/bundler-2.3.17/lib/bundler/cli/exec.rb:58:in `kernel_load' 55: from /usr/local/bundle/gems/bundler-2.3.17/lib/bundler/cli/exec.rb:58:in `load' 54: from /usr/local/bundle/bin/unicorn:23:in `<top (required)>' 53: from /usr/local/bundle/bin/unicorn:23:in `load' 52: from /usr/local/bundle/gems/unicorn-6.1.0/bin/unicorn:128:in `<top (required)>' 51: from /usr/local/bundle/gems/unicorn-6.1.0/lib/unicorn/http_server.rb:140:in `start' 50: from /usr/local/bundle/gems/unicorn-6.1.0/lib/unicorn/http_server.rb:821:in `build_app!' 49: from /usr/local/bundle/gems/unicorn-6.1.0/lib/unicorn.rb:54:in `block in builder' 48: from /usr/local/bundle/gems/unicorn-6.1.0/lib/unicorn.rb:54:in `eval' 47: from config.ru:1:in `<main>' 46: from config.ru:1:in `new' 45: from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:125:in `initialize' 44: from /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:125:in `instance_eval' 43: from config.ru:4:in `block in <main>' 42: from config.ru:4:in `require' 41: from /usr/src/app/config/environment.rb:5:in `<top (required)>' 40: from /usr/local/bundle/gems/railties-6.0.3/lib/rails/application.rb:363:in `initialize!' 39: from /usr/local/bundle/gems/railties-6.0.3/lib/rails/initializable.rb:60:in `run_initializers' 38: from /usr/local/lib/ruby/2.7.0/tsort.rb:205:in `tsort_each' 37: from /usr/local/lib/ruby/2.7.0/tsort.rb:226:in `tsort_each' 36: from /usr/local/lib/ruby/2.7.0/tsort.rb:347:in `each_strongly_connected_component' 35: from /usr/local/lib/ruby/2.7.0/tsort.rb:347:in `call' 34: from /usr/local/lib/ruby/2.7.0/tsort.rb:347:in `each' 33: from /usr/local/lib/ruby/2.7.0/tsort.rb:349:in `block in each_strongly_connected_component' 32: from /usr/local/lib/ruby/2.7.0/tsort.rb:431:in `each_strongly_connected_component_from' 31: from /usr/local/lib/ruby/2.7.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component' 30: from /usr/local/lib/ruby/2.7.0/tsort.rb:228:in `block in tsort_each' 29: from /usr/local/bundle/gems/railties-6.0.3/lib/rails/initializable.rb:61:in `block in run_initializers' 28: from /usr/local/bundle/gems/railties-6.0.3/lib/rails/initializable.rb:32:in `run' 27: from /usr/local/bundle/gems/railties-6.0.3/lib/rails/initializable.rb:32:in `instance_exec' 26: from /usr/local/bundle/gems/activerecord-6.0.3/lib/active_record/railtie.rb:198:in `block in <class:Railtie>' 25: from /usr/local/bundle/gems/activesupport-6.0.3/lib/active_support/lazy_load_hooks.rb:42:in `on_load' 24: from /usr/local/bundle/gems/activesupport-6.0.3/lib/active_support/lazy_load_hooks.rb:42:in `each' 23: from /usr/local/bundle/gems/activesupport-6.0.3/lib/active_support/lazy_load_hooks.rb:43:in `block in on_load' 22: from /usr/local/bundle/gems/activesupport-6.0.3/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook' 21: from /usr/local/bundle/gems/activesupport-6.0.3/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control' 20: from /usr/local/bundle/gems/activesupport-6.0.3/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook' 19: from /usr/local/bundle/gems/activesupport-6.0.3/lib/active_support/lazy_load_hooks.rb:71:in `class_eval' 18: from /usr/local/bundle/gems/activerecord-6.0.3/lib/active_record/railtie.rb:201:in `block (2 levels) in <class:Railtie>' 17: from /usr/local/bundle/gems/activerecord-6.0.3/lib/active_record/connection_handling.rb:51:in `establish_connection' 16: from /usr/local/bundle/gems/activerecord-6.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1052:in `establish_connection' 15: from /usr/local/bundle/gems/activerecord-6.0.3/lib/active_record/connection_adapters/connection_specification.rb:169:in `spec' 14: from /usr/local/bundle/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:324:in `require' 13: from /usr/local/bundle/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:291:in `load_dependency' 12: from /usr/local/bundle/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:324:in `block in require' 11: from /usr/local/bundle/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require' 10: from /usr/local/bundle/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' 9: from /usr/local/bundle/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' 8: from /usr/local/bundle/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' 7: from /usr/local/bundle/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' 6: from /usr/local/bundle/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' 5: from /usr/local/bundle/gems/ibm_db-5.3.1/lib/active_record/connection_adapters/ibm_db_adapter.rb:19:in `<main>' 4: from /usr/local/bundle/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:324:in `require' 3: from /usr/local/bundle/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:291:in `load_dependency' 2: from /usr/local/bundle/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:324:in `block in require' 1: from /usr/local/bundle/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require' /usr/local/bundle/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:34:in `require': Error loading the 'ibm_db' Active Record adapter. Missing a gem it depends on? cannot load such file -- active_record/connection_adapters (LoadError)

It works find when using version 5.2.0 of the gem. Any ideas?

praveen-db2 commented 1 year ago

@jfahrenkrug I see its not able to load 'active_record/connection_adapters' at line 19 in file /usr/local/bundle/gems/ibm_db-5.3.1/lib/active_record/connection_adapters/ibm_db_adapter.rb.

Have you installed active_record v6.1 ?

I had given below list of gems our adapter depends on and most of these get auto installed when we install Rails v6.1

abbrev (default: 0.1.0)
actioncable (6.1.0)
actionmailbox (6.1.0)
actionmailer (6.1.0)
actionpack (6.1.0)
actiontext (6.1.0)
actionview (6.1.0)
activejob (6.1.0)
activemodel (6.1.0)
activerecord (6.1.0)
activestorage (6.1.0)
activesupport (6.1.0)
addressable (2.8.0)
base64 (default: 0.1.0)
benchmark (default: 0.1.1)
bigdecimal (default: 3.0.0)
bindex (0.8.1)
bootsnap (1.11.1, 1.10.3)
builder (3.2.4)
bundler (default: 2.2.3)
byebug (11.1.3)
capybara (3.36.0)
cgi (default: 0.2.0)
childprocess (4.1.0)
concurrent-ruby (1.1.10, 1.1.9)
crass (1.0.6)
csv (default: 3.1.9)
date (default: 3.1.0)
debug (default: 0.1.0)
delegate (default: 0.2.0)
did_you_mean (default: 1.5.0)
digest (default: 3.0.0)
drb (default: 2.0.4)
english (default: 0.7.1)
erb (default: 2.2.0)
erubi (1.10.0)
erubis (2.7.0)
etc (default: 1.2.0)
fcntl (default: 1.0.0)
ffi (1.15.5)
fiddle (default: 1.0.6)
fileutils (default: 1.5.0)
find (default: 0.1.0)
forwardable (default: 1.3.2)
gdbm (default: 2.1.0)
getoptlong (default: 0.1.1)
globalid (1.0.0)
i18n (1.10.0)
ibm_db (5.3.1)
io-console (default: 0.5.6)
io-nonblock (default: 0.1.0)
io-wait (default: 0.1.0)
ipaddr (default: 1.2.2)
irb (default: 1.3.0)
jbuilder (2.11.5)
json (default: 2.5.1)
listen (3.7.1)
logger (default: 1.4.3)
loofah (2.15.0, 2.14.0)
mail (2.7.1)
marcel (1.0.2, 0.3.3)
matrix (0.4.2, default: 0.3.1)
method_source (1.0.0)
mimemagic (0.3.10)
mini_mime (1.1.2)
minitest (5.15.0, 5.14.2)
mocha (1.13.0)
msgpack (1.4.5)
mutex_m (default: 0.1.1)
net-ftp (default: 0.1.1)
net-http (default: 0.1.1)
net-imap (default: 0.1.1)
net-pop (default: 0.1.1)
net-protocol (default: 0.1.0)
net-smtp (default: 0.2.1)
nio4r (2.5.8)
nkf (default: 0.1.0)
nokogiri (1.13.3 x86_64-linux)
observer (default: 0.1.1)
open-uri (default: 0.1.0)
open3 (default: 0.1.1)
openssl (default: 2.2.0)
optparse (default: 0.1.0)
ostruct (default: 0.3.1)
pathname (default: 0.1.0)
power_assert (1.2.0)
pp (default: 0.1.0)
prettyprint (default: 0.1.0)
prime (default: 0.1.2)
pstore (default: 0.1.1)
psych (default: 3.3.0)
public_suffix (4.0.6)
puma (5.6.2)
racc (1.6.0, default: 1.5.1)
rack (2.2.3)
rack-mini-profiler (2.3.4)
rack-proxy (0.7.2)
rack-test (1.1.0)
rails (6.1.0)
rails-dom-testing (2.0.3)
rails-html-sanitizer (1.4.2)
railties (6.1.0)
rake (13.0.6, 13.0.3)
rb-fsevent (0.11.1)
rb-inotify (0.10.1)
rbs (1.0.0)
rdoc (default: 6.3.0)
readline (default: 0.0.2)
readline-ext (default: 0.1.1)
regexp_parser (2.2.1)
reline (default: 0.2.0)
resolv (default: 0.2.0)
resolv-replace (default: 0.1.0)
rexml (3.2.5, 3.2.4)
rinda (default: 0.1.0)
rss (0.2.9)
rubyzip (2.3.2)
sass-rails (6.0.0)
sassc (2.4.0)
sassc-rails (2.1.2)
securerandom (default: 0.1.0)
selenium-webdriver (4.1.0)
semantic_range (3.0.0)
set (default: 1.0.1)
shellwords (default: 0.1.0)
singleton (default: 0.1.1)
spring (4.0.0)
sprockets (4.0.3, 4.0.2)
sprockets-rails (3.4.2)
sqlite3 (1.4.2)
stringio (default: 3.0.0)
strscan (default: 3.0.0)
syslog (default: 0.1.0)
tempfile (default: 0.1.1)
test-unit (3.3.7)
thor (1.2.1)
tilt (2.0.10)
time (default: 0.1.0)
timeout (default: 0.1.1)
tmpdir (default: 0.1.1)
tracer (default: 0.1.1)
tsort (default: 0.1.0)
turbolinks (5.2.1)
turbolinks-source (5.2.0)
typeprof (0.11.0)
tzinfo (2.0.4)
un (default: 0.1.0)
uri (default: 0.10.1)
weakref (default: 0.1.1)
web-console (4.2.0)
webdrivers (5.0.0)
webpacker (5.4.3)
websocket-driver (0.7.5)
websocket-extensions (0.1.5)
xpath (3.2.0)
yaml (default: 0.1.1)
zeitwerk (2.5.4)
zip (2.0.2)
zlib (default: 1.1.0)
jfahrenkrug commented 1 year ago

@praveen-db2 Thank you for the feedback. This is specifically about using version 5.3.1 of the gem with Rails 6.0.3 (not 6.1). The gemspec declares that it's compatible with any ActiveRecord version between 5.0.7 and 6.1:

spec.add_dependency('activerecord', '>= 5.0.7', '<=6.1')
spec.requirements << 'ActiveRecord, at least 5.0.7'

(see https://github.com/ibmdb/ruby-ibmdb/blob/master/IBM_DB_Adapter/ibm_db/IBM_DB.gemspec#L22)

So the reason for my bug report was that seemingly version 5.3.1 of the ibm_db gem is not compatible with ActiveRecord versions lower than 6.1 anymore. So I think there are two options to address this:

  1. Adjust the gemspec to reflect that at least ActiveRecord 6.1 is required.
  2. Fix the code so that it is compatible with the ActiveRecords versions declared in the gemspec (5.0.7 up to 6.1).

What do you think?

praveen-db2 commented 1 year ago

@jfahrenkrug thanks got it, will modify gem spec to reflect that at least ActiveRecord 6.1 is required. I will replace with below statements,

spec.add_dependency('activerecord', '<6.2')
spec.requirements << 'ActiveRecord, at least 6.1'
praveen-db2 commented 1 year ago

@jfahrenkrug released v5.3.2 , can you check and close this issue.

praveen-db2 commented 1 year ago

@jfahrenkrug can we close this if recent release fixed your issue.

jfahrenkrug commented 1 year ago

@praveen-db2 I can confirm this is fixed, thanks!!