Skip to content

loading LS might (rarely) fail due JRuby auto-load bug #12077

@kares

Description

@kares

JRuby, being Ruby, uses RubyGems - a require 'rubygems' happens by default as the runtime starts.
Some of the constants (such as Gem::Specification) are setup to auto-load on demand while also being explicitly required.

This is problematic and known issue for JRuby 9K, it can be triggered when multiple threads try to do smt with an auto-loaded constant which has been explicitly required (sample reproducer at jruby/jruby#6293).

LS does use Gem::Specification as pipelines are being initialized, sample logged failure from LS 7.6.0 :

[ERROR][logstash.agent           ] Failed to execute action 
{:action=>LogStash::PipelineAction::Create/pipeline_id:a_pipeline, 
:exception=>"NameError", 
:message=>"uninitialized constant Gem::Specification", 
:backtrace=>[
"org/jruby/RubyModule.java:3742:in `const_missing'", 
"/usr/share/logstash/logstash-core/lib/logstash/util/plugin_version.rb:25:in `find_version!'", 
"/usr/share/logstash/logstash-core/lib/logstash/util/plugin_version.rb:42:in `find_plugin_version!'", 
"/usr/share/logstash/logstash-core/lib/logstash/config/mixin.rb:245:in `print_version_notice'", 
"/usr/share/logstash/logstash-core/lib/logstash/config/mixin.rb:231:in `validate'", 
"/usr/share/logstash/logstash-core/lib/logstash/config/mixin.rb:86:in `config_init'", 
"/usr/share/logstash/logstash-core/lib/logstash/inputs/base.rb:60:in `initialize'", 
"org/logstash/plugins/PluginFactoryExt.java:258:in `plugin'", 
"org/logstash/plugins/PluginFactoryExt.java:120:in `buildInput'", 
"org/logstash/execution/JavaBasePipelineExt.java:50:in `initialize'", 
"/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:24:in `initialize'", 
"/usr/share/logstash/logstash-core/lib/logstash/pipeline_action/create.rb:36:in `execute'", 
"/usr/share/logstash/logstash-core/lib/logstash/agent.rb:325:in `block in converge_state'"
]}

HINT: The issue is rare to run into and users are advised to attempt to (re-)start.

A work-around is expected to be available with the release of RGs 3.1.5 (and 3.2.0), where auto-loaded parts are no longer being explicitly required. A proper fix is expected to be available in JRuby 9.3.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions