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

v0.1.17 can't load lib/xray/middleware #59

Closed
baburdick opened this issue Oct 20, 2015 · 6 comments
Closed

v0.1.17 can't load lib/xray/middleware #59

baburdick opened this issue Oct 20, 2015 · 6 comments

Comments

@baburdick
Copy link

Downgrading to v0.1.16 fixes this:

/usr/local/rvm/gems/ruby-2.1.2@my_app/gems/xray-rails-0.1.17/lib/xray-rails.rb:5:in `require_relative': cannot load such file -- /usr/local/rvm/gems/ruby-2.1.2@my_app/gems/xray-rails-0.1.17/lib/xray/middleware (LoadError)
    from /usr/local/rvm/gems/ruby-2.1.2@my_app/gems/xray-rails-0.1.17/lib/xray-rails.rb:5:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `require'
    from /usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `each'
    from /usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `block in require'
    from /usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `each'
    from /usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `require'
    from /usr/local/rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2/lib/bundler.rb:132:in `require'
    from /var/www/my_app/releases/20151020220531/config/application.rb:12:in `<top (required)>'
    from /var/www/my_app/releases/20151020220531/config/environment.rb:2:in `require'
    from /var/www/my_app/releases/20151020220531/config/environment.rb:2:in `<top (required)>'
    from config.ru:4:in `require'
    from config.ru:4:in `block in <main>'
    from /usr/local/rvm/gems/ruby-2.1.2@my_app/gems/rack-1.5.5/lib/rack/builder.rb:55:in `instance_eval'
    from /usr/local/rvm/gems/ruby-2.1.2@my_app/gems/rack-1.5.5/lib/rack/builder.rb:55:in `initialize'
    from config.ru:1:in `new'
    from config.ru:1:in `<main>'
    from /usr/local/rvm/gems/ruby-2.1.2@my_app/gems/unicorn-4.9.0/lib/unicorn.rb:48:in `eval'
    from /usr/local/rvm/gems/ruby-2.1.2@my_app/gems/unicorn-4.9.0/lib/unicorn.rb:48:in `block in builder'
    from /usr/local/rvm/gems/ruby-2.1.2@my_app/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:768:in `call'
    from /usr/local/rvm/gems/ruby-2.1.2@my_app/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:768:in `build_app!'
    from /usr/local/rvm/gems/ruby-2.1.2@my_app/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:632:in `init_worker_process'
    from /usr/local/rvm/gems/ruby-2.1.2@my_app/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:655:in `worker_loop'
    from /usr/local/rvm/gems/ruby-2.1.2@my_app/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:529:in `spawn_missing_workers'
    from /usr/local/rvm/gems/ruby-2.1.2@my_app/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:540:in `maintain_worker_count'
    from /usr/local/rvm/gems/ruby-2.1.2@my_app/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:294:in `join'
    from /usr/local/rvm/gems/ruby-2.1.2@my_app/gems/unicorn-4.9.0/bin/unicorn:126:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.1.2@my_app/bin/unicorn:23:in `load'
    from /usr/local/rvm/gems/ruby-2.1.2@my_app/bin/unicorn:23:in `<main>'
    from /usr/local/rvm/gems/ruby-2.1.2@my_app/bin/ruby_executable_hooks:15:in `eval'
    from /usr/local/rvm/gems/ruby-2.1.2@my_app/bin/ruby_executable_hooks:15:in `<main>'
@mattbrictson
Copy link
Collaborator

Strange! Can you verify that the file exists and is readable?

/usr/local/rvm/gems/ruby-2.1.2@my_app/gems/xray-rails-0.1.17/lib/xray/middleware.rb

If somehow the gem is damaged you could try this:

gem pristine xray-rails -v 0.1.17

@brentd
Copy link
Owner

brentd commented Oct 21, 2015

Yeah, super weird. Anyone else experiencing this?

Thanks for the help, @mattbrictson

@son1112
Copy link

son1112 commented Nov 7, 2015

I just experienced this as well. Looking into it...

xray-rails 0.1.18
permissions on middleware.rb only are set to be readable only by root on install

ls -l /usr/lib/ruby/gems/2.3.0/gems/xray-rails-0.1.18/lib/xray/

-rw-r--r-- 1 root root 1030 Jan 21 10:44 config.rb
-rw-r--r-- 1 root root 4181 Jan 21 10:44 engine.rb
-rw------- 1 root root 4066 Jan 21 10:44 middleware.rb
-rw-r--r-- 1 root root   37 Jan 21 10:44 version.rb

Neither switching to version 0.1.17, nor running gem pristine on either seems to have any affect on the situation

@rotated8
Copy link

rotated8 commented Mar 2, 2016

I had this problem today as well with 0.1.18.
sudo chmod +r ./middleware.rb fixed it.

@mattbrictson
Copy link
Collaborator

Yep, it looks like the 0.1.18 gem was packaged such that middleware.rb has a different permissions mask than the rest of the files. Not sure how this could happen. Maybe the machine where the gem was packaged had these permissions for some reason, and the resulting gem file simply mirrors those?

Solution would be to double check/correct permissions on the machine that packages the gem and then release a new version with correct permissions.

Here's what I see when I download the .gem file and inspect the contents:

$ tar xvf xray-rails-0.1.18.gem 
x metadata.gz
x data.tar.gz
x checksums.yaml.gz
$ tar tfzv data.tar.gz 
-rw-r--r--  0 wheel  wheel    1072 Jan 11 05:55 LICENSE
-rw-r--r--  0 wheel  wheel    3939 Jan 11 05:55 README.md
-rw-r--r--  0 wheel  wheel     738 Jan 11 05:55 app/assets/javascripts/xray-backbone.js.coffee
-rw-r--r--  0 wheel  wheel    9719 Jan 11 05:55 app/assets/javascripts/xray.js.coffee
-rw-r--r--  0 wheel  wheel   24382 Jan 11 05:55 app/assets/stylesheets/xray.css
-rw-r--r--  0 wheel  wheel    1827 Jan 11 05:55 app/views/_xray_bar.html.erb
-rw-r--r--  0 wheel  wheel    3656 Jan 11 05:55 lib/xray-rails.rb
-rw-r--r--  0 wheel  wheel    1030 Jan 11 05:55 lib/xray/config.rb
-rw-r--r--  0 wheel  wheel    4181 Jan 11 05:55 lib/xray/engine.rb
-rw-------  0 wheel  wheel    4066 Jan 11 05:55 lib/xray/middleware.rb
-rw-r--r--  0 wheel  wheel      37 Jan 11 05:55 lib/xray/version.rb

@mattbrictson
Copy link
Collaborator

I've released 0.1.19 that fixes the file permissions issue. You should now be able to install and use the latest gem without the "can't load lib/xray/middleware" error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants