janino-compiler / janino

Janino is a super-small, super-fast Java™ compiler.
http://janino-compiler.github.io/janino
Other
1.21k stars 205 forks source link

Encounter java.lang.StackOverflowError in flink application #175

Closed mddxhj closed 7 months ago

mddxhj commented 1 year ago

Issue

When I start a flink application and set env.java.opts=-Xss512k, I encountered a StackOverflowError as below, and my janino version is 3.0.11. On the other hand, if set env.java.opts=-Xss1m, the problem disappeared. I want to know why does this happened, or which version of janino has fixed this problem? thanks for any reply!

java.lang.RuntimeException: Could not instantiate generated class 'StreamExecCalc$10323'
    at org.apache.flink.table.runtime.generated.GeneratedClass.newInstance(GeneratedClass.java:66)
    at org.apache.flink.table.runtime.operators.CodeGenOperatorFactory.createStreamOperator(CodeGenOperatorFactory.java:40)
    at org.apache.flink.streaming.api.operators.StreamOperatorFactoryUtil.createOperator(StreamOperatorFactoryUtil.java:80)
    at org.apache.flink.streaming.runtime.tasks.OperatorChain.createOperator(OperatorChain.java:652)
    at org.apache.flink.streaming.runtime.tasks.OperatorChain.createOperatorChain(OperatorChain.java:626)
    at org.apache.flink.streaming.runtime.tasks.OperatorChain.createOutputCollector(OperatorChain.java:566)
    at org.apache.flink.streaming.runtime.tasks.OperatorChain.createOperatorChain(OperatorChain.java:616)
    at org.apache.flink.streaming.runtime.tasks.OperatorChain.createOutputCollector(OperatorChain.java:566)
    at org.apache.flink.streaming.runtime.tasks.OperatorChain.createOperatorChain(OperatorChain.java:616)
    at org.apache.flink.streaming.runtime.tasks.OperatorChain.createOutputCollector(OperatorChain.java:566)
    at org.apache.flink.streaming.runtime.tasks.OperatorChain.createOperatorChain(OperatorChain.java:616)
    at org.apache.flink.streaming.runtime.tasks.OperatorChain.createOutputCollector(OperatorChain.java:566)
    at org.apache.flink.streaming.runtime.tasks.OperatorChain.createOperatorChain(OperatorChain.java:616)
    at org.apache.flink.streaming.runtime.tasks.OperatorChain.createOutputCollector(OperatorChain.java:566)
    at org.apache.flink.streaming.runtime.tasks.OperatorChain.<init>(OperatorChain.java:181)
    at org.apache.flink.streaming.runtime.tasks.StreamTask.executeRestore(StreamTask.java:548)
    at org.apache.flink.streaming.runtime.tasks.StreamTask.runWithCleanUpOnFail(StreamTask.java:647)
    at org.apache.flink.streaming.runtime.tasks.StreamTask.restore(StreamTask.java:537)
    at org.apache.flink.runtime.taskmanager.Task.doRun(Task.java:759)
    at org.apache.flink.runtime.taskmanager.Task.run(Task.java:566)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.flink.util.FlinkRuntimeException: org.apache.flink.api.common.InvalidProgramException: Table program cannot be compiled. This is a bug. Please file an issue.
    at org.apache.flink.table.runtime.generated.CompileUtils.compile(CompileUtils.java:76)
    at org.apache.flink.table.runtime.generated.GeneratedClass.compile(GeneratedClass.java:77)
    at org.apache.flink.table.runtime.generated.GeneratedClass.newInstance(GeneratedClass.java:64)
    ... 20 more
Caused by: org.apache.flink.shaded.guava18.com.google.common.util.concurrent.UncheckedExecutionException: org.apache.flink.api.common.InvalidProgramException: Table program cannot be compiled. This is a bug. Please file an issue.
    at org.apache.flink.shaded.guava18.com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2203)
    at org.apache.flink.shaded.guava18.com.google.common.cache.LocalCache.get(LocalCache.java:3937)
    at org.apache.flink.shaded.guava18.com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4739)
    at org.apache.flink.table.runtime.generated.CompileUtils.compile(CompileUtils.java:74)
    ... 22 more
Caused by: org.apache.flink.api.common.InvalidProgramException: Table program cannot be compiled. This is a bug. Please file an issue.
    at org.apache.flink.table.runtime.generated.CompileUtils.doCompile(CompileUtils.java:89)
    at org.apache.flink.table.runtime.generated.CompileUtils.lambda$compile$1(CompileUtils.java:74)
    at org.apache.flink.shaded.guava18.com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4742)
    at org.apache.flink.shaded.guava18.com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
    at org.apache.flink.shaded.guava18.com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
    at org.apache.flink.shaded.guava18.com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
    at org.apache.flink.shaded.guava18.com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
    ... 25 more
Caused by: java.lang.StackOverflowError
    at org.codehaus.janino.CodeContext.flowAnalysis(CodeContext.java:429)
    at org.codehaus.janino.CodeContext.flowAnalysis(CodeContext.java:591)
    at org.codehaus.janino.CodeContext.flowAnalysis(CodeContext.java:591)
    at org.codehaus.janino.CodeContext.flowAnalysis(CodeContext.java:591)
    at org.codehaus.janino.CodeContext.flowAnalysis(CodeContext.java:591)
aunkrig commented 1 year ago

Hey Jun He,

I suppose the stack trace is truncated at the bottom, right? What amazes me is that the recursion obviously is not infinite, because when you increase the stack size, the problem goes away.

(A) Can you please update to the latest version of Janino and verify that the problem persists? 3.0.11 is from 2018!

(B) Can you please develop a test case as small as possible that reproduces the problem?

CU Arno

aunkrig commented 1 year ago

Ping.

aunkrig commented 1 year ago

Ping.

aunkrig commented 10 months ago

Ping.