lesscss-engine
lesscss-engine copied to clipboard
LESS compilation results in busy loop, thread hangs, with Nashorn engine
Compiling bootstrap occasionally results in a thread hung indefinitely in a busy loop. Usually it compiles in a few seconds, but i've been seeing it stuck for several hours at times.
Assuming that the problem is buried deep within either the LESS or Nashorn code a fix might be out of reach. I could detect the stuck thread and interrupt it with application code, but apparently nashorn doesnt check interrupt status. However, this can be done from within the JS. Would it be possible to insert something like this into some suitable processing loop?
if (java.lang.Thread.interrupted()) break;
See commentary about interrupting Nashorn scripts here - http://stackoverflow.com/questions/24855182/interrupt-java-thread-running-nashorn-script
Thread stack is probably not much help, its mostly lamdas:
java.lang.Thread.State: RUNNABLE
at jdk.nashorn.internal.runtime.ScriptRuntime.EQ_STRICT(ScriptRuntime.java:767)
at jdk.nashorn.internal.runtime.ScriptRuntime.NE_STRICT(ScriptRuntime.java:779)
at java.lang.invoke.LambdaForm$DMH/1653016297.invokeStatic_LL_I(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$MH/1620750378.convert(LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/1064733140.linkToCallSite(LambdaForm$MH)
at jdk.nashorn.internal.scripts.Script$^eval_$2._L15$Parser$getLocation(