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

do not use sllice_size=0 for compilation - hiding compile errors #388

Closed
EugenMayer opened this issue Aug 12, 2016 · 4 comments
Closed

do not use sllice_size=0 for compilation - hiding compile errors #388

EugenMayer opened this issue Aug 12, 2016 · 4 comments

Comments

@EugenMayer
Copy link

EugenMayer commented Aug 12, 2016

The default slice_size is 0, which leads to an issue tht e.g. if a gem connot be compiled, lets say erubis due to the syntax issue here: EugenMayer/erubis@d34acfd

then you end up having just a message compilation of .rb file failed and thats it, also with --trace no further information given

Using slice_size 10 here https://github.com/jruby/warbler/blob/master/lib/warbler/jar.rb#L58 , i end up having proper errors like

"tmp/WEB-INF/gems/gems/erubis-2.7.0/lib/erubis/local-setting.rb"
SyntaxError: tmp/WEB-INF/gems/gems/erubis-2.7.0/lib/erubis/helpers/rails_form_helper.rb:126: syntax error, unexpected ':'
      for key, val in html_options:

                            java_send at org/jruby/java/proxies/JavaProxy.java:363
                                parse at file:/root/.rbenv/versions/jruby-9.1.2.0/lib/ruby/gems/shared/gems/jruby-jars-9.1.2.0/lib/jruby-core-9.1.2.0-complete.jar!/jruby/jruby.rb:59
                           compile_ir at file:/root/.rbenv/versions/jruby-9.1.2.0/lib/ruby/gems/shared/gems/jruby-jars-9.1.2.0/lib/jruby-core-9.1.2.0-complete.jar!/jruby/jruby.rb:71
  block in compile_files_with_options at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/jruby/compiler.rb:161
  block in compile_files_with_options at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/jruby/compiler.rb:297
                                 each at org/jruby/RubyArray.java:1593
           compile_files_with_options at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/jruby/compiler.rb:281
                         compile_argv at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/jruby/compiler.rb:94
                                <top> at uri:classloader:/META-INF/jruby.home/bin/jrubyc:5
warble aborted!
Compilation of .rb files failed (pid 1467 exit 1)
/root/.rbenv/versions/jruby-9.1.2.0/bin/warble:1:in `<top>'
Tasks: TOP => compiled => war:compiled
(See full trace by running task with --trace)

or

SyntaxError: tmp/WEB-INF/gems/gems/activejob-4.2.6/lib/rails/generators/job/templates/job.rb:1: syntax error, unexpected tLT
<% module_namespacing do -%>

                            java_send at org/jruby/java/proxies/JavaProxy.java:363
                                parse at file:/root/.rbenv/versions/jruby-9.1.2.0/lib/ruby/gems/shared/gems/jruby-jars-9.1.2.0/lib/jruby-core-9.1.2.0-complete.jar!/jruby/jruby.rb:59
                           compile_ir at file:/root/.rbenv/versions/jruby-9.1.2.0/lib/ruby/gems/shared/gems/jruby-jars-9.1.2.0/lib/jruby-core-9.1.2.0-complete.jar!/jruby/jruby.rb:71
  block in compile_files_with_options at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/jruby/compiler.rb:161
  block in compile_files_with_options at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/jruby/compiler.rb:297
                                 each at org/jruby/RubyArray.java:1593
           compile_files_with_options at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/jruby/compiler.rb:281
                         compile_argv at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/jruby/compiler.rb:94
                                <top> at uri:classloader:/META-INF/jruby.home/bin/jrubyc:5
warble aborted!

for the issue with https://github.com/rails/rails/blob/master/activejob/lib/rails/generators/job/templates/job.rb

I suggest either having a setting in warble.rb to set it to zero, but by default, make it non zero so people do not run into such dead-ends an probably stop there jruby evaluation because "things magically wont compile"

Thanks!

@kares
Copy link
Member

kares commented Oct 26, 2016

there's a default slice size 2500 ... setting the default lower would cause more javac processes to spawn and warbling would get slower. the support that is there is fairly recent to help identifying compilation issues. we're certainly willing to accept PRs for further improving the current state.

@EugenMayer
Copy link
Author

@kares my default was zero, not sure if this here is a expectation issue. No matter what your application internal default is ( 2500 ) the configuration default is zero and should be addressed.

@kares
Copy link
Member

kares commented Oct 26, 2016

double checked, that would mean a failure (tested with JRuby 9.1.5.0) and also no compiling :

jruby-9.1.5.0 :001 > [1, 2].each_slice(0) { |slice| puts slice.inspect  }
ArgumentError: invalid slice size
    from org/jruby/RubyArray.java:1777:in `each_slice'
    from (irb):1:in `<eval>'
    from org/jruby/RubyKernel.java:995:in `eval'
    from org/jruby/RubyKernel.java:1296:in `loop'
    from org/jruby/RubyKernel.java:1115:in `catch'
    from org/jruby/RubyKernel.java:1115:in `catch'
    from /opt/local/rvm/rubies/jruby-9.1.5.0/bin/irb:13:in `<main>'

@dolzenko
Copy link

dolzenko commented Apr 27, 2023

Not sure what happened here but with default settings I was getting aforementioned compilation of .rb file failed error, with WARBLER_COMPILED_FILES_SLICE=10 I was able to track it down to

SyntaxError: cache/jruby/2.6.0/gems/actioncable-5.0.7.2/lib/rails/generators/channel/templates/channel.rb:1: syntax error, unexpected '<'
<% module_namespacing do -%>
^

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

3 participants