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

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

Closed
headius opened this issue Apr 22, 2016 · 2 comments
Closed

Comments

@headius
Copy link
Member

headius commented Apr 22, 2016

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.

@headius
Copy link
Member Author

headius commented Apr 29, 2016

Note that adding the "listen" gem gets past this. Is this a missing dependency in the beta3 generator, perhaps?

@headius headius modified the milestones: JRuby 9.1.1.0, JRuby 9.1.2.0 May 11, 2016
@enebo enebo modified the milestones: JRuby 9.1.2.0, JRuby 9.1.3.0 May 23, 2016
@headius
Copy link
Member Author

headius commented Aug 22, 2016

Very stale, and we managed to get Rails 5 to boot up and work in JRuby. Calling this fixed.

@headius headius closed this as completed Aug 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants