Skip to content

LESS compilation results in busy loop, thread hangs, with Nashorn engine #59

Open
@bradmac

Description

@bradmac

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(:310)
... many more...
at java.lang.invoke.LambdaForm$MH/522631210.linkToCallSite(LambdaForm$MH)
at jdk.nashorn.internal.scripts.Script$^eval_._L12(:64)
at java.lang.invoke.LambdaForm$DMH/883214287.invokeStatic_LLLLL_L(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$MH/664550332.invokeExact_MT(LambdaForm$MH)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:504)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:206)
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:378)
at jdk.nashorn.api.scripting.ScriptObjectMirror.call(ScriptObjectMirror.java:107)
at com.asual.lesscss.compiler.NashornCompiler.compile(NashornCompiler.java:77)
at com.asual.lesscss.LessEngine.compile(LessEngine.java:107)
at com.asual.lesscss.LessEngine.compile(LessEngine.java:101)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @bradmac

        Issue actions

          LESS compilation results in busy loop, thread hangs, with Nashorn engine · Issue #59 · asual/lesscss-engine