Skip to content

NameError: uninitialized constant RubyVM for non-CRuby #3375

@eregon

Description

@eregon

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions