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

Asset precompile fails with --dev #2929

Closed
jkutner opened this issue May 11, 2015 · 12 comments
Closed

Asset precompile fails with --dev #2929

jkutner opened this issue May 11, 2015 · 12 comments

Comments

@jkutner
Copy link
Member

jkutner commented May 11, 2015

On JRuby 1.7.20 (and several earlier versions), the command rake assets:precompile may fail when JRUBY_OPTS is set to either --dev or just -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1. The resulting stack trace is:

remote:        NoVarsDynamicScope.java:87:in `setValue': java.lang.NullPointerException
remote:        from LocalAsgnNode.java:123:in `interpret'
remote:        from BlockNode.java:71:in `interpret'
remote:        from RescueBodyNode.java:108:in `interpret'
remote:        from RescueNode.java:204:in `handleJavaException'
remote:        from RescueNode.java:137:in `interpret'
remote:        from ASTInterpreter.java:74:in `INTERPRET_METHOD'
remote:        from InterpretedMethod.java:161:in `call'
remote:        from CachingCallSite.java:316:in `cacheAndCall'
remote:        from CachingCallSite.java:145:in `callBlock'
remote:        from CachingCallSite.java:154:in `callIter'
remote:        from FCallNoArgBlockNode.java:32:in `interpret'
remote:        from NewlineNode.java:105:in `interpret'
remote:        from ASTInterpreter.java:74:in `INTERPRET_METHOD'
remote:        from InterpretedMethod.java:139:in `call'
remote:        from CachingCallSite.java:306:in `cacheAndCall'
remote:        from CachingCallSite.java:136:in `call'
remote:        from CallNoArgNode.java:60:in `interpret'
remote:        from NewlineNode.java:105:in `interpret'
remote:        from BlockNode.java:71:in `interpret'
remote:        from RootNode.java:129:in `interpret'
remote:        from ASTInterpreter.java:121:in `INTERPRET_ROOT'
remote:        from Ruby.java:893:in `runInterpreter'
remote:        from Ruby.java:2845:in `loadFile'
remote:        from LibrarySearcher.java:264:in `loadScript'
remote:        from LibrarySearcher.java:252:in `load'
remote:        from LibrarySearcher.java:51:in `load'
remote:        from LoadService.java:358:in `load'
remote:        from RubyKernel.java:1095:in `loadCommon'
remote:        from RubyKernel.java:1087:in `load19'
remote:        from RubyKernel$INVOKER$s$0$1$load19.gen:-1:in `call'
remote:        from DynamicMethod.java:210:in `call'
remote:        from DynamicMethod.java:206:in `call'
remote:        from CachingCallSite.java:326:in `cacheAndCall'
remote:        from CachingCallSite.java:170:in `call'
remote:        from FCallOneArgNode.java:36:in `interpret'
remote:        from NewlineNode.java:105:in `interpret'
remote:        from BlockNode.java:71:in `interpret'
remote:        from RootNode.java:129:in `interpret'
remote:        from ASTInterpreter.java:121:in `INTERPRET_ROOT'
remote:        from Ruby.java:893:in `runInterpreter'
remote:        from Ruby.java:901:in `runInterpreter'
remote:        from Ruby.java:732:in `runNormally'
remote:        from Ruby.java:577:in `runFromMain'
remote:        from Main.java:395:in `doRunFromMain'
remote:        from Main.java:290:in `internalRun'
remote:        from Main.java:217:in `run'
remote:        from Main.java:197:in `main'

Platform details:

$ java -version
openjdk version "1.8.0_40-cedar14"
OpenJDK Runtime Environment (build 1.8.0_40-cedar14-b25)
OpenJDK 64-Bit Server VM (build 25.40-b25, mixed mode)

$ uname -a
Linux e3da07c0-2564-4123-9f79-3507aca387e1 3.13.0-49-generic #83-Ubuntu SMP Fri Apr 10 20:11:33 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

I cannot reproduce this locally on OS X with Oracle JDK8. I'm working on a reproducible example that does not include proprietary source code and will update shortly.

@Ch4s3
Copy link

Ch4s3 commented May 11, 2015

You might be exceeding the timeout on heroku.

edit this is totally wrong upon reflection

@jkutner
Copy link
Member Author

jkutner commented May 11, 2015

@Ch4s3 thanks for the suggestion, but that's not it. If I remove the --dev it works, and with --dev it's actually faster. And I work at Heroku :)

@enebo
Copy link
Member

enebo commented May 11, 2015

@jkutner you might want to not use --dev and try -X-C to see whether this is strictly an interpreter bug or whether the other options of --dev are causing this. Best case outcome is it is an interpreter bug.

@jkutner
Copy link
Member Author

jkutner commented May 11, 2015

@enebo it works with -X-C. what does that mean?

@Ch4s3
Copy link

Ch4s3 commented May 11, 2015

Ahh, @jkutner I should have recognized you from our buildpack discussion.

For future googlers:
-X-C only turns off the JIT. Using --dev turns off JIT, but also:

  • disables invokeDynamic
  • disables JRuby's JVM bytecode compiler
  • sets client mode, or tiered compilation depending on host system (probably the latter on heroku)

My guess is that its related to invokeDynamic. I suspect turning that off kills the ability of the JVM to duck type and do some of the things that Sprockets relies upon. That might explain why it is blowing up building the AST. This is just a hunch though, and I could be way off.

@enebo
Copy link
Member

enebo commented May 11, 2015

@jkutner @Ch4s3 invokedynamic has been disabled by default for a while now so unless it has been enabled then that probably is not it. It was disabled because warmup time on invokedynamic was really slow for big apps (like basically any Rails app). Also most of the invokedynamic options are done at JIT time (although not all).

@jkutner Is it possible asset compilation uses threads? LocalAsgnNode is just what you would think it would be. It is trying to assign an 'b = 1' or something and when grabbing the predefined depth and offset it is running into the wrong scope. You could recompile and catch this NPE in LocalAsgnNode and print out the file and source (getPosition() on that node).

@Ch4s3
Copy link

Ch4s3 commented May 11, 2015

@enebo That's interesting to know.

Speaking of threads, could this be the issue.

@enebo
Copy link
Member

enebo commented May 12, 2015

@Ch4s3 I don't know. If I had to guess we have had issues in the past with eval with bindings which displayed weird scoping issues. Combine that with threads? Getting an actual source location will end up being a huge clue.

@Ch4s3
Copy link

Ch4s3 commented May 12, 2015

@enebo I'm kind of grasping here, but I've had similar issues as well so I'm interested in reading through source and stack traces to see if I can help.

It might be interesting to walk through the stack with and without --dev.

@jkutner
Copy link
Member Author

jkutner commented May 12, 2015

@Ch4s3 @enebo thanks for looking at this. I've tried like heck to reproduce it without the customer's proprietary code, but have not had any luck.

There is no more stacktrace info than what I've shown above. The only other thing I know is that it happens after or during scss compile because the output right before the error is a warning about application.scss.

Is there any other info I can provide that might help determine the source? I'm not super familiar with sprockets :(

@kares
Copy link
Member

kares commented Jun 22, 2017

this piece is likely not longer relevant (with recent 9K). @jkutner has the time to close 🛬 ?

@kares kares added this to the Invalid or Duplicate milestone Jun 22, 2017
@enebo
Copy link
Member

enebo commented Dec 3, 2018

Ancient issue and I am closing barring any new info.

@enebo enebo closed this as completed Dec 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants