Skip to content

Rails 5 dependencies fail to load 'listen' lib for evented file checking #3823

@headius

Description

@headius

Issue #3733, after some patching, proceeds on to a new error when trying to boot a Rails 5 console. The error appears to happen when trying to load the 'listen' library lazily:

$ JRUBY_OPTS='-X-C -Xbacktrace.style=full' rails c
LoadError: no such file to load -- listen
                               getStackTrace at java/lang/Thread.java:1552
                            getBacktraceData at org/jruby/runtime/backtrace/TraceType.java:215
                                getBacktrace at org/jruby/runtime/backtrace/TraceType.java:47
                            prepareBacktrace at org/jruby/RubyException.java:225
                                    preRaise at org/jruby/exceptions/RaiseException.java:229
                                    preRaise at org/jruby/exceptions/RaiseException.java:196
                                      <init> at org/jruby/exceptions/RaiseException.java:111
                           newRaiseException at org/jruby/Ruby.java:4066
                                newLoadError at org/jruby/Ruby.java:3916
                               requireCommon at org/jruby/runtime/load/LoadService.java:414
                                     require at org/jruby/runtime/load/LoadService.java:392
                               requireCommon at org/jruby/RubyKernel.java:944
                                   require19 at org/jruby/RubyKernel.java:937
                                        call at org/jruby/internal/runtime/methods/JavaMethod.java:579
                                        call at org/jruby/internal/runtime/methods/AliasMethod.java:101
                                        call at org/jruby/internal/runtime/methods/AliasMethod.java:101
                             unresolvedSuper at org/jruby/ir/runtime/IRRuntimeHelpers.java:965
                                   interpret at org/jruby/ir/instructions/ZSuperInstr.java:71
                                 processCall at org/jruby/ir/interpreter/InterpreterEngine.java:348
                                   interpret at org/jruby/ir/interpreter/InterpreterEngine.java:161
                             INTERPRET_BLOCK at org/jruby/ir/interpreter/Interpreter.java:132
                            block in require at /Users/headius/projects/jruby/lib/ruby/gems/shared/gems/activesupport-5.0.0.beta3/lib/active_support/dependencies.rb:302
                                 yieldDirect at org/jruby/runtime/InterpretedIRBlockBody.java:109
                               yieldSpecific at org/jruby/runtime/IRBlockBody.java:73
                               yieldSpecific at org/jruby/runtime/Block.java:135
                               yieldSpecific at org/jruby/ir/runtime/IRRuntimeHelpers.java:480
                                   interpret at org/jruby/ir/instructions/YieldInstr.java:73
                              processOtherOp at org/jruby/ir/interpreter/InterpreterEngine.java:550
                                   interpret at org/jruby/ir/interpreter/InterpreterEngine.java:203
                                   interpret at org/jruby/ir/interpreter/InterpreterEngine.java:86
                            INTERPRET_METHOD at org/jruby/internal/runtime/methods/InterpretedIRMethod.java:189
                             load_dependency at /Users/headius/projects/jruby/lib/ruby/gems/shared/gems/activesupport-5.0.0.beta3/lib/active_support/dependencies.rb:268
                                        call at org/jruby/internal/runtime/methods/InterpretedIRMethod.java:180
                                cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:323
                                   callBlock at org/jruby/runtime/callsite/CachingCallSite.java:173
                                        call at org/jruby/runtime/callsite/CachingCallSite.java:177
                                 processCall at org/jruby/ir/interpreter/InterpreterEngine.java:325
                                   interpret at org/jruby/ir/interpreter/InterpreterEngine.java:161
                                   interpret at org/jruby/ir/interpreter/InterpreterEngine.java:86
                            INTERPRET_METHOD at org/jruby/internal/runtime/methods/InterpretedIRMethod.java:189
                                     require at /Users/headius/projects/jruby/lib/ruby/gems/shared/gems/activesupport-5.0.0.beta3/lib/active_support/dependencies.rb:302
                                        call at org/jruby/internal/runtime/methods/InterpretedIRMethod.java:180
                                        call at org/jruby/internal/runtime/methods/DynamicMethod.java:197
                                cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:313
                                        call at org/jruby/runtime/callsite/CachingCallSite.java:163
                                 processCall at org/jruby/ir/interpreter/InterpreterEngine.java:316
                                   interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:77
                             INTERPRET_BLOCK at org/jruby/ir/interpreter/Interpreter.java:132
                         block in initialize at /Users/headius/projects/jruby/lib/ruby/gems/shared/gems/activesupport-5.0.0.beta3/lib/active_support/evented_file_update_checker.rb:24

Here's the lines that trigger the lazy require, in `active_support/evented_file_update_checker.rb

      if (dtw = directories_to_watch).any?
        # Loading listen triggers warnings. These are originated by a legit
        # usage of attr_* macros for private attributes, but adds a lot of noise
        # to our test suite. Thus, we lazy load it and disable warnings locally.
        silence_warnings { require 'listen' }
        Listen.to(*dtw, &method(:changed)).start
      end
    end

And the lines in dependencies.rb that do the load:

      def require(file)
        result = false
        load_dependency(file) { result = super }
        result
      end

The super call here is not able to eventually find anything to require for listen. The only instance of listen.rb I could find in Rails 5 dependencies was vendored into sass and does not appear to be loadable...so I'm confused.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions