{"action":"created","issue":{"url":"https://api.github.com/repos/wro4j/wro4j/issues/1007","repository_url":"https://api.github.com/repos/wro4j/wro4j","labels_url":"https://api.github.com/repos/wro4j/wro4j/issues/1007/labels{/name}","comments_url":"https://api.github.com/repos/wro4j/wro4j/issues/1007/comments","events_url":"https://api.github.com/repos/wro4j/wro4j/issues/1007/events","html_url":"https://github.com/wro4j/wro4j/pull/1007","id":140143666,"number":1007,"title":"`RubySassEngine` crashes with parallel preprocessing","user":{"login":"shirosaki","id":170831,"avatar_url":"https://avatars.githubusercontent.com/u/170831?v=3","gravatar_id":"","url":"https://api.github.com/users/shirosaki","html_url":"https://github.com/shirosaki","followers_url":"https://api.github.com/users/shirosaki/followers","following_url":"https://api.github.com/users/shirosaki/following{/other_user}","gists_url":"https://api.github.com/users/shirosaki/gists{/gist_id}","starred_url":"https://api.github.com/users/shirosaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shirosaki/subscriptions","organizations_url":"https://api.github.com/users/shirosaki/orgs","repos_url":"https://api.github.com/users/shirosaki/repos","events_url":"https://api.github.com/users/shirosaki/events{/privacy}","received_events_url":"https://api.github.com/users/shirosaki/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/wro4j/wro4j/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/wro4j/wro4j/milestones/44","html_url":"https://github.com/wro4j/wro4j/milestones/1.8.0","labels_url":"https://api.github.com/repos/wro4j/wro4j/milestones/44/labels","id":1036608,"number":44,"title":"1.8.0","description":"","creator":{"login":"alexo","id":30596,"avatar_url":"https://avatars.githubusercontent.com/u/30596?v=3","gravatar_id":"","url":"https://api.github.com/users/alexo","html_url":"https://github.com/alexo","followers_url":"https://api.github.com/users/alexo/followers","following_url":"https://api.github.com/users/alexo/following{/other_user}","gists_url":"https://api.github.com/users/alexo/gists{/gist_id}","starred_url":"https://api.github.com/users/alexo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexo/subscriptions","organizations_url":"https://api.github.com/users/alexo/orgs","repos_url":"https://api.github.com/users/alexo/repos","events_url":"https://api.github.com/users/alexo/events{/privacy}","received_events_url":"https://api.github.com/users/alexo/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":13,"state":"open","created_at":"2015-03-24T15:46:59Z","updated_at":"2016-03-14T08:02:01Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2016-03-11T10:03:45Z","updated_at":"2016-03-14T08:39:18Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/wro4j/wro4j/pulls/1007","html_url":"https://github.com/wro4j/wro4j/pull/1007","diff_url":"https://github.com/wro4j/wro4j/pull/1007.diff","patch_url":"https://github.com/wro4j/wro4j/pull/1007.patch"},"body":"I see the following errors with 1.7.9 while building using `mvn` with `parallelPreprocessing=true`.\r\n`RubySassEngine` crashes while processing`sass` files.\r\nI don't see the errors with 1.7.7. This error seems to be due to JRuby 9.0.0.0.\r\nJRuby 9.0.0.0 would have different behavior with multi-thread from 1.7.x.\r\nAdding global lock solves the issue for me.\r\n\r\n```\r\n[ERROR] Failed to process the resource: ro.isdc.wro.model.resource.Resource@27b2faa6[CSS,/asset/common.scss,true] using processor: ro.isdc.wro.extensions.processor.css.RubySassCssProcessor@5beea545. Reason: java.lang.NullPointerException\r\n[ERROR] Failed to process the resource: ro.isdc.wro.model.resource.Resource@7adad1f1[CSS,/asset/common.scss,true] using processor: ro.isdc.wro.extensions.processor.css.RubySassCssProcessor@5beea545. Reason: java.lang.NullPointerException\r\n[ERROR] Failed to process the resource: ro.isdc.wro.model.resource.Resource@219b95ca[CSS,/asset/common.scss,true] using processor: ro.isdc.wro.extensions.processor.css.RubySassCssProcessor@5beea545. Reason: java.lang.NullPointerException\r\n[INFO] processing group: xxxxxx.css\r\n[ERROR] Exception occured while processing: ro.isdc.wro.WroRuntimeException: java.lang.NullPointerException, class: ro.isdc.wro.WroRuntimeException,caused by: javax.script.ScriptException\r\n[INFO] processing group: xxxxx.js\r\n[INFO] processing group: xxxxx.css\r\nro.isdc.wro.WroRuntimeException: java.lang.NullPointerException\r\n        at ro.isdc.wro.extensions.processor.support.sass.RubySassEngine.process(RubySassEngine.java:70)\r\n        at ro.isdc.wro.extensions.processor.css.RubySassCssProcessor.process(RubySassCssProcessor.java:59)\r\n        at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)\r\n        at ro.isdc.wro.model.resource.processor.decorator.LazyProcessorDecorator.process(LazyProcessorDecorator.java:49)\r\n        at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)\r\n        at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)\r\n        at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)\r\n        at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)\r\n        at ro.isdc.wro.model.resource.processor.decorator.SupportAwareProcessorDecorator.process(SupportAwareProcessorDecorator.java:39)\r\n        at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)\r\n        at ro.isdc.wro.model.resource.processor.decorator.ExceptionHandlingProcessorDecorator.process(ExceptionHandlingProcessorDecorator.java:56)\r\n        at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)\r\n        at ro.isdc.wro.model.resource.processor.decorator.BenchmarkProcessorDecorator.process(BenchmarkProcessorDecorator.java:44)\r\n        at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)\r\n        at ro.isdc.wro.model.resource.processor.decorator.DefaultProcessorDecorator.process(DefaultProcessorDecorator.java:42)\r\n        at ro.isdc.wro.model.group.processor.PreProcessorExecutor$2.process(PreProcessorExecutor.java:228)\r\n        at ro.isdc.wro.model.group.processor.PreProcessorExecutor.applyPreProcessors(PreProcessorExecutor.java:207)\r\n        at ro.isdc.wro.model.group.processor.PreProcessorExecutor.access$100(PreProcessorExecutor.java:49)\r\n        at ro.isdc.wro.model.group.processor.PreProcessorExecutor$1.call(PreProcessorExecutor.java:133)\r\n        at ro.isdc.wro.model.group.processor.PreProcessorExecutor$1.call(PreProcessorExecutor.java:129)\r\n        at ro.isdc.wro.config.support.ContextPropagatingCallable.call(ContextPropagatingCallable.java:62)\r\n        at java.util.concurrent.FutureTask.run(FutureTask.java:266)\r\n        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\r\n        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\r\n        at java.lang.Thread.run(Thread.java:745)\r\nCaused by: javax.script.ScriptException: java.lang.NullPointerException\r\n        at org.jruby.embed.jsr223.JRubyEngine.wrapException(JRubyEngine.java:104)\r\n        at org.jruby.embed.jsr223.JRubyEngine.eval(JRubyEngine.java:93)\r\n        at org.jruby.embed.jsr223.JRubyEngine.eval(JRubyEngine.java:142)\r\n        at ro.isdc.wro.extensions.processor.support.sass.RubySassEngine.process(RubySassEngine.java:68)\r\n        ... 24 more\r\nCaused by: java.lang.NullPointerException\r\n        at org.jruby.RubyModule.defineAnnotatedMethodsIndividually(RubyModule.java:968)\r\n        at org.jruby.RubyModule.defineAnnotatedMethods(RubyModule.java:887)\r\n        at org.jruby.RubyBasicObject.createBasicObjectClass(RubyBasicObject.java:218)\r\n        at org.jruby.Ruby.initRoot(Ruby.java:1367)\r\n        at org.jruby.Ruby.init(Ruby.java:1208)\r\n        at org.jruby.Ruby.newInstance(Ruby.java:331)\r\n        at org.jruby.embed.internal.AbstractLocalContextProvider.getGlobalRuntime(AbstractLocalContextProvider.java:82)\r\n        at org.jruby.embed.internal.SingletonLocalContextProvider.getRuntime(SingletonLocalContextProvider.java:99)\r\n        at org.jruby.embed.internal.EmbedRubyRuntimeAdapterImpl.runParser(EmbedRubyRuntimeAdapterImpl.java:167)\r\n        at org.jruby.embed.internal.EmbedRubyRuntimeAdapterImpl.parse(EmbedRubyRuntimeAdapterImpl.java:94)\r\n        at org.jruby.embed.ScriptingContainer.parse(ScriptingContainer.java:1243)\r\n        at org.jruby.embed.jsr223.JRubyEngine.eval(JRubyEngine.java:89)\r\n        ... 26 more\r\n```"},"comment":{"url":"https://api.github.com/repos/wro4j/wro4j/issues/comments/196204458","html_url":"https://github.com/wro4j/wro4j/pull/1007#issuecomment-196204458","issue_url":"https://api.github.com/repos/wro4j/wro4j/issues/1007","id":196204458,"user":{"login":"shirosaki","id":170831,"avatar_url":"https://avatars.githubusercontent.com/u/170831?v=3","gravatar_id":"","url":"https://api.github.com/users/shirosaki","html_url":"https://github.com/shirosaki","followers_url":"https://api.github.com/users/shirosaki/followers","following_url":"https://api.github.com/users/shirosaki/following{/other_user}","gists_url":"https://api.github.com/users/shirosaki/gists{/gist_id}","starred_url":"https://api.github.com/users/shirosaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shirosaki/subscriptions","organizations_url":"https://api.github.com/users/shirosaki/orgs","repos_url":"https://api.github.com/users/shirosaki/repos","events_url":"https://api.github.com/users/shirosaki/events{/privacy}","received_events_url":"https://api.github.com/users/shirosaki/received_events","type":"User","site_admin":false},"created_at":"2016-03-14T08:39:18Z","updated_at":"2016-03-14T08:39:18Z","body":"I cannot find document that `ScriptEngineManager` of JRuby is thread unsafe.\r\nI tried other property settings of `org.jruby.embed.localcontext.scope`, but all options caused same errors.\r\nhttps://github.com/jruby/jruby/wiki/RedBridge#Context_Instance_Type\r\n\r\n- Singleton\r\n- ThreadSafe\r\n- SingleThread\r\n- Concurrent\r\n\r\nIt might be a bug of JRuby 9.0.0.0.\r\nUsing `org.jruby.embed.ScriptingContainer` instead of `ScriptEngineManager` is alternative, but I don't try it.\r\n\r\nNewly added properties are just for performance improvement. Document is here.\r\nhttps://github.com/jruby/jruby/wiki/RedBridge#CompileMode\r\nhttps://github.com/jruby/jruby/wiki/RedBridge#Disabling_Sharing_Variables"}}