Skip to content

Uninitialized constant -- already exists #6139

@fzakaria

Description

@fzakaria

Running into an interesting exception when running our code packaged in a JAR

Did you mean?  ActiveSupport::SafeBuffer
Did you mean?  ActiveSupport::SafeBuffer
  org/jruby/RubyModule.java:3370:in `const_missing'
  uri:classloader:/gems/activesupport-4.2.11.1/lib/active_support/core_ext/string/output_safety.rb:260:in `html_safe'
  uri:classloader:/gems/activesupport-4.2.11.1/lib/active_support/core_ext/string/output_safety.rb:22:in `html_escape'
  uri:classloader:/bundler/gems/diffy-de8b86845039/lib/diffy/html_formatter.rb:88:in `block in highlighted_words'
  org/jruby/RubyArray.java:1735:in `each'
  org/jruby/RubyEnumerable.java:1067:in `each_with_index'
  org/jruby/RubyEnumerator.java:323:in `each'
  org/jruby/RubyEnumerable.java:830:in `map'
  uri:classloader:/bundler/gems/diffy-de8b86845039/lib/diffy/html_formatter.rb:56:in `highlighted_words'
  uri:classloader:/bundler/gems/diffy-de8b86845039/lib/diffy/html_formatter.rb:11:in `to_s'
  uri:classloader:/bundler/gems/diffy-de8b86845039/lib/diffy/format.rb:34:in `html'

The fact that the constant seems present for the did you mean? leads me to believe some race condition.
I know that ActiveSupport likes to make heavy use of autoload which @headius has reported as unsafe via https://bugs.ruby-lang.org/issues/921
However I believe the codebase is mitigating this issue by explicitly requiring the file during our single-threaded startup phase.

# bunch of requires
require "active_support/core_ext/string/output_safety"

# start up the Puma server

Information

Provide at least:

  • jruby 9.1.17.0 (2.3.3) 2018-04-20 d8b1ff9 OpenJDK 64-Bit Server VM 25.232-b09 on 1.8.0_232-8u232-b09-1~deb9u1-b09 +jit [linux-x86_64]
  • Linux fmzakari-glaptop 5.2.17-1rodete3-amd64 break script engine #1 SMP Debian 5.2.17-1rodete3 (2019-10-21 > 2018) x86_64 GNU/Linux

The bug is being experienced specifically when packaged up into a JAR with Warbler; however that's when we really push the concurrency through testing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions