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

NameError: uninitialized constant RubyVM for non-CRuby #3375

Closed
eregon opened this issue May 14, 2021 · 5 comments
Closed

NameError: uninitialized constant RubyVM for non-CRuby #3375

eregon opened this issue May 14, 2021 · 5 comments
Labels

Comments

@eregon
Copy link

eregon commented May 14, 2021

Check CONTRIBUTING guideline first and here is the list to help us investigate the problem.

Describe the bug
Starting fluentd on any other implementation than CRuby (e.g. TruffleRuby) causes:

$ bundle exec fluentd -c receiver.conf
bundler: failed to load command: fluentd (/home/eregon/.rubies/truffleruby-dev/bin/fluentd)
NameError: uninitialized constant RubyVM
  /home/eregon/.rubies/truffleruby-dev/lib/gems/gems/fluentd-1.12.3/bin/fluentd:4:in `const_missing'
  /home/eregon/.rubies/truffleruby-dev/lib/gems/gems/fluentd-1.12.3/bin/fluentd:4:in `<top (required)>'
  <internal:core> core/kernel.rb:400:in `load'
  <internal:core> core/kernel.rb:400:in `load'
  /home/eregon/.rubies/truffleruby-dev/bin/fluentd:23:in `<top (required)>'
  <internal:core> core/kernel.rb:400:in `load'
  <internal:core> core/kernel.rb:400:in `load'

due to

RubyVM::InstructionSequence.compile_option = {trace_instruction: false} rescue nil

#1764

To Reproduce
I used https://github.com/fluent/fluentd-benchmark/tree/master/one_forward but any fluent command would do

Expected behavior
It should work.

The rescue nil is not enough, for instance this also fails on CRuby:

$ ruby -ve 'RubyVM2::InstructionSequence.compile_option = {trace_instruction: false} rescue nil'
ruby 2.7.3p183 (2021-04-05 revision 6847ee089d) [x86_64-linux]
Traceback (most recent call last):
-e:1:in `<main>': uninitialized constant RubyVM2 (NameError)

I think the issue is the rescue nil only applies to {trace_instruction: false} and not the whole assignment.

Your Environment

  • Fluentd or td-agent version: fluentd --version or td-agent --version: 1.12.3
@cosmo0920
Copy link
Contributor

I'm not familiar with TruffleRuby. But, other C-Ruby implementation can be handle to install C extension such as cool.io, msgpack-ruby and other gems?
If so, we should investigate how to support TruffleRuby.

@eregon
Copy link
Author

eregon commented May 15, 2021

Yes, TruffleRuby supports C extensions: https://github.com/oracle/truffleruby/blob/master/doc/user/compatibility.md
I ran the one_forward benchmark on it (by commenting out that line) and it seems to work fine.
I also ran the test suite and a good part passes but not everything.

@cosmo0920
Copy link
Contributor

I'd confirmed that truffleruby can handle C extensions.
But some gems are still not working correctly.
We should investigate more about this issue.

@ashie
Copy link
Member

ashie commented May 18, 2021

Fixed by #3376

@ashie ashie closed this as completed May 18, 2021
@eregon
Copy link
Author

eregon commented May 18, 2021

Thank you for the fix!

@cosmo0920 cosmo0920 mentioned this issue Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants