jruby / activerecord-jdbcsqlserver-adapter

SQL Server Adapter for Rails (JRuby JDBC support)
https://github.com/jruby/activerecord-jdbc-adapter/
MIT License
2 stars 4 forks source link

no such file to load -- pry #3

Closed aaronkelton closed 4 years ago

aaronkelton commented 4 years ago

Hi 👋 upgrading to Rails 5 here; squashed a lot of bugs to get a successful WAR file built, and upon deployment I'm seeing this Internal Server Error page with message You're seeing this error because you use JRuby::Rack::ErrorApp::ShowStatus.. Stack trace formatted below.

The thing is, pry in my Gemfile is in the development and test group, so I'm not sure why it's being loaded in the first place, or what specifically inside jdbc_overrides.rb is requiring pry (because that's the next-to-last line on top before the "no such file" statement). I did some source diving to see what the problem could be, but no luck.

I'm using JRuby 9.2.9.0, Bundler 1.17.3, and Warbler 2.0.5. If it's not a jdbcsqlserver issue, my next guess is Warbler, or maybe there's another knob I need to turn in my own configuration. I'll start going thru Warbler docs in depth, but in the meantime, does this look like a bug inside jdbc_overrides.rb by chance?

no such file to load -- pry 
from org/jruby/RubyKernel.java:978:in `require' 
from /edsa/app/webapps/ROOT/WEB-INF/gems/gems/activerecord-jdbcsqlserver-adapter-51.0.0/lib/active_record/connection_adapters/sqlserver/jdbc_overrides.rb:1:in `<main>' 
from org/jruby/RubyKernel.java:978:in `require' 
from /edsa/app/webapps/ROOT/WEB-INF/gems/gems/activerecord-jdbcsqlserver-adapter-51.0.0/lib/activerecord-jdbcsqlserver-adapter.rb:16:in `<main>' 
from org/jruby/RubyKernel.java:978:in `require' 
from /edsa/app/webapps/ROOT/WEB-INF/gems/gems/bundler-1.17.3/lib/bundler/runtime.rb:81:in `block in require' 
from org/jruby/RubyArray.java:1814:in `each' 
from /edsa/app/webapps/ROOT/WEB-INF/gems/gems/bundler-1.17.3/lib/bundler/runtime.rb:76:in `block in require' 
from org/jruby/RubyArray.java:1814:in `each' 
from /edsa/app/webapps/ROOT/WEB-INF/gems/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `require' 
from /edsa/app/webapps/ROOT/WEB-INF/gems/gems/bundler-1.17.3/lib/bundler.rb:114:in `require' 
from /edsa/app/webapps/ROOT/WEB-INF/config/application.rb:7:in `<main>' 
from org/jruby/RubyKernel.java:978:in `require' 
from org/jruby/RubyKernel.java:1006:in `require_relative' 
from /edsa/app/webapps/ROOT/WEB-INF/config/environment.rb:2:in `<main>' 
from org/jruby/RubyKernel.java:978:in `require' 
from uri:classloader:/jruby/rack/rails/environment3.rb:25:in `load_environment' 
from uri:classloader:/jruby/rack/rails_booter.rb:83:in `load_environment' from <script>:1:in `<main>'
rdubya commented 4 years ago

Hi @chemturion I dug into this a little bit but I'm not able to find any references to pry either so I'm not sure. The one thing I noticed is that it says its calling require on line 1 in jdbc_overrides.rb but there isn't a require line in that file. Is it possible that its loading a modified version of that file on your system?

aaronkelton commented 4 years ago

Hi @rdubya I think you're on the right trail. On my local I found this with the require 'pry' statement on line 1.

# C:\projects\my_app\vendor\jruby\2.5.0\gems\activerecord-jdbcsqlserver-adapter-51.0.0\lib\active_record\connection_adapters\sqlserver\jdbc_overrides.rb

require 'pry'

module ActiveRecord
  module ConnectionAdapters
    module SQLServer
      module JDBCOverrides
# etc.

I then did a fresh gem install activerecord-jdbcsqlserver-adapter to see what I would get from Ruby Gems. I confirmed the install location using gem env

gem env

RubyGems Environment:
  - RUBYGEMS VERSION: 2.7.10
  - RUBY VERSION: 2.5.7 (2019-10-30 patchlevel 0) [java]
  - INSTALLATION DIRECTORY: C:/jruby-9.2.9.0/lib/ruby/gems/shared

and looked inside the jdbc_overrides.rb file freshly installed on my machine.

# C:\jruby-9.2.9.0\lib\ruby\gems\shared\gems\activerecord-jdbcsqlserver-adapter-51.0.0\lib\active_record\connection_adapters\sqlserver\jdbc_overrides.rb

require 'pry'

module ActiveRecord
  module ConnectionAdapters
    module SQLServer
      module JDBCOverrides
# etc.

Is it possible that the 51.0.0 version uploaded to Ruby Gems differs from the one here on GitHub (5-1-stable-jdbc branch)?

enebo commented 4 years ago

@chemturion @rdubya I can confirm installing 51.0.0 jdbc_overrides.rb does in fact have a require 'pry' as the first line (installed the gem on my linux box so I never have installed it here ).

An obvious workaround would be to comment out the require, but looking through history of that file there has NEVER been a require there. Is something adding it as part of a post-install hook or something like that? Or gem release happened to have an uncommitted change when building the gem?

rdubya commented 4 years ago

@enebo good call. It probably was there when I built the gem. I'll try to get that fixed up and release a 51.0.1 version

rdubya commented 4 years ago

Ok 51.0.1 is up, can you try it and make sure it works now?

aaronkelton commented 4 years ago

Thank you for the minor bump. Working now. 👍