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

Rails loading permission denied issue happens in 0.13.0 but not 0.12.0 #190

Closed
joemsak opened this issue Apr 19, 2021 · 3 comments
Closed

Comments

@joemsak
Copy link

joemsak commented Apr 19, 2021

Hey there - don't know if this is related to running rails with docker-compose maybe? But I ran bundle update and it bumped ethon from 0.12.0 to 0.13.0 - which I only had listed in my lockfile as a sub dependency of Typhoeus

When trying to boot rails this happens during Bundler.require:

36: from /app/config/application.rb:15:in `<main>'
35: from /usr/local/lib/ruby/site_ruby/2.7.0/bundler.rb:173:in `require'
34: from /usr/local/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:50:in `require'
33: from /usr/local/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:50:in `each'
32: from /usr/local/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:61:in `block in require'
31: from /usr/local/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:61:in `each'
30: from /usr/local/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:66:in `block (2 levels) in require'
29: from /usr/local/bundle/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
28: from /usr/local/bundle/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
27: from /usr/local/bundle/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
26: from /usr/local/bundle/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' 
25: from /usr/local/bundle/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
24: from /usr/local/bundle/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<main>'
23: from /usr/local/bundle/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `require'
22: from /usr/local/bundle/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:299:in `load_dependency'
21: from /usr/local/bundle/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `block in require
20: from /usr/local/bundle/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
19: from /usr/local/bundle/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' 
18: from /usr/local/bundle/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' 
17: from /usr/local/bundle/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi
16: from /usr/local/bundle/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' 
15: from /usr/local/bundle/gems/ethon-0.13.0/lib/ethon.rb:16:in `<main>'
 14: from /usr/local/bundle/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `require' 
13: from /usr/local/bundle/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:299:in `load_dependency' 
12: from /usr/local/bundle/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `block in require'
11: from /usr/local/bundle/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
10: from /usr/local/bundle/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
9: from /usr/local/bundle/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
8: from /usr/local/bundle/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
7: from /usr/local/bundle/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
6: from /usr/local/bundle/gems/ethon-0.13.0/lib/ethon/libc.rb:2:in `<main>'
5: from /usr/local/bundle/gems/ethon-0.13.0/lib/ethon/libc.rb:7:in `<module:Ethon>'
4: from /usr/local/bundle/gems/ethon-0.13.0/lib/ethon/libc.rb:17:in `<module:Libc>'
3: from /usr/local/bundle/gems/ethon-0.13.0/lib/ethon/libc.rb:17:in `new'
2: from /usr/local/bundle/gems/ffi-1.15.0/lib/ffi/tools/const_generator.rb:49:in `initialize'
1: from /usr/local/bundle/gems/ffi-1.15.0/lib/ffi/tools/const_generator.rb:135:in `calculate'
 /usr/local/bundle/gems/ffi-1.15.0/lib/ffi/tools/const_generator.rb:135:in ``': Permission denied - /tmp/rb_const_gen_bin_1 (Errno::EACCES)

I explicitly locked ethon back to 0.12.0 in my Gemfile and rails boots again

Rails 6.1, Ruby 2.7.2, in a docker/docker-compose environment if that helps

@paulmakepeace
Copy link

The change from 0.12.0 to 0.13.0 is,

diff ethon-0.1{2,3}.0/lib/ethon/libc.rb
0a1
> # frozen_string_literal: true
16c17,31
<       attach_function :getdtablesize, [], :int
---
>       fcg = FFI::ConstGenerator.new do |gen|
>         gen.include 'unistd.h'
>         %w[
>           _SC_OPEN_MAX
>         ].each do |const|
>           ruby_name = const.sub(/^_SC_/, '').downcase.to_sym
>           gen.const(const, "%d", nil, ruby_name, &:to_i)
>         end
>       end
>
>       CONF = enum(*fcg.constants.map{|_, const|
>         [const.ruby_name, const.converted_value]
>       }.flatten)
>
>       attach_function :sysconf, [CONF], :long

If the read-only filesystem issue doesn't get you, in a minimal Dockerized environment without a build environment, the lack of gcc (which FFI::ConstGenerator invokes) will likely be an issue too. I wonder if there isn't another way to obtain _SC_OPEN_MAX or provide a build time alternative?

@mindw
Copy link

mindw commented Apr 24, 2021

See the same here in a container without build system. didn't happen with 0.12.

fluentd-agent /usr/local/bundle/gems/ffi-1.15.0/lib/ffi/tools/const_generator.rb:131:in `block in calculate': Compilation error generating constants : (RuntimeError)
fluentd-agent        sh: 1: gcc: not found
fluentd-agent        from /usr/local/lib/ruby/2.7.0/tempfile.rb:291:in `open'
fluentd-agent        from /usr/local/bundle/gems/ffi-1.15.0/lib/ffi/tools/const_generator.rb:110:in `calculate'
fluentd-agent        from /usr/local/bundle/gems/ffi-1.15.0/lib/ffi/tools/const_generator.rb:49:in `initialize'
fluentd-agent        from /usr/local/bundle/gems/ethon-0.13.0/lib/ethon/libc.rb:17:in `new'
fluentd-agent        from /usr/local/bundle/gems/ethon-0.13.0/lib/ethon/libc.rb:17:in `<module:Libc>'
fluentd-agent        from /usr/local/bundle/gems/ethon-0.13.0/lib/ethon/libc.rb:7:in `<module:Ethon>'
fluentd-agent        from /usr/local/bundle/gems/ethon-0.13.0/lib/ethon/libc.rb:2:in `<top (required)>'
fluentd-agent        from /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
fluentd-agent        from /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
fluentd-agent        from /usr/local/bundle/gems/ethon-0.13.0/lib/ethon.rb:16:in `<top (required)>'
fluentd-agent        from /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
fluentd-agent        from /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
fluentd-agent        from /usr/local/bundle/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top (required)>'
fluentd-agent        from /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:158:in `require'
fluentd-agent        from /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:158:in `rescue in require'
fluentd-agent        from /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:147:in `require'
fluentd-agent        from /usr/local/bundle/gems/fluent-plugin-elasticsearch-5.0.3/lib/fluent/plugin/out_elasticsearch.rb:475:in `backend_options'
fluentd-agent        from /usr/local/bundle/gems/fluent-plugin-elasticsearch-5.0.3/lib/fluent/plugin/out_elasticsearch.rb:210:in `configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/plugin.rb:178:in `configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/plugin/multi_output.rb:74:in `block in configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/plugin/multi_output.rb:63:in `each'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/plugin/multi_output.rb:63:in `configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/plugin/out_copy.rb:39:in `configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/plugin.rb:178:in `configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/agent.rb:132:in `add_match'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/agent.rb:74:in `block in configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/agent.rb:64:in `each'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/agent.rb:64:in `configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/label.rb:31:in `configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/root_agent.rb:143:in `block in configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/root_agent.rb:143:in `each'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/root_agent.rb:143:in `configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/engine.rb:105:in `configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/engine.rb:80:in `run_configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/supervisor.rb:648:in `run_supervisor'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/command/fluentd.rb:345:in `<top (required)>'
fluentd-agent        from /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
fluentd-agent        from /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/bin/fluentd:8:in `<top (required)>'
fluentd-agent        from /usr/local/bundle/bin/fluentd:23:in `load'
fluentd-agent        from /usr/local/bundle/bin/fluentd:23:in `<main>'
fluentd-agent /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require': cannot load such file -- typhoeus (LoadError)
fluentd-agent        from /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
fluentd-agent        from /usr/local/bundle/gems/fluent-plugin-elasticsearch-5.0.3/lib/fluent/plugin/out_elasticsearch.rb:475:in `backend_options'
fluentd-agent        from /usr/local/bundle/gems/fluent-plugin-elasticsearch-5.0.3/lib/fluent/plugin/out_elasticsearch.rb:210:in `configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/plugin.rb:178:in `configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/plugin/multi_output.rb:74:in `block in configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/plugin/multi_output.rb:63:in `each'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/plugin/multi_output.rb:63:in `configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/plugin/out_copy.rb:39:in `configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/plugin.rb:178:in `configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/agent.rb:132:in `add_match'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/agent.rb:74:in `block in configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/agent.rb:64:in `each'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/agent.rb:64:in `configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/label.rb:31:in `configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/root_agent.rb:143:in `block in configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/root_agent.rb:143:in `each'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/root_agent.rb:143:in `configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/engine.rb:105:in `configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/engine.rb:80:in `run_configure'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/supervisor.rb:648:in `run_supervisor'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/lib/fluent/command/fluentd.rb:345:in `<top (required)>'
fluentd-agent        from /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
fluentd-agent        from /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
fluentd-agent        from /usr/local/bundle/gems/fluentd-1.12.3/bin/fluentd:8:in `<top (required)>'
fluentd-agent        from /usr/local/bundle/bin/fluentd:23:in `load'
fluentd-agent        from /usr/local/bundle/bin/fluentd:23:in `<main>'

@Kjarrigan
Copy link
Member

Should be solved in the next version. See #185

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

4 participants