#4392 closed defect (fixed)
Stack overflow in calculateStrongComponentJacobians
Reported by: | Francesco Casella | Owned by: | Adrian Pop |
---|---|---|---|
Priority: | high | Milestone: | 1.12.0 |
Component: | Backend | Version: | |
Keywords: | Cc: | Per Östlund |
Description
When compiling a model with about 200k equations, I get this error during the performance of calculateStrongComponentJacobians:
[/build/openmodelica-pVlUNC/openmodelica-1.12.0~dev-633-gd90ff1c/OMCompiler/Compiler/BackEnd/BackendDAEUtil.mo:6963:3-6963:155:writable] Error: Internal error Stack overflow in BackendDAEUtil.getSolvedSystem... [bt] #1 /usr/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaRuntimeC.so(mmc_setStacktraceMessages_threadData) [bt] #2 /usr/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(ComponentReference.hashSubscript) [bt] #3 /usr/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(ComponentReference.hashSubscripts2) [bt] #4 /usr/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(ComponentReference.hashSubscripts) [bt] #5 /usr/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(ComponentReference.hashComponentRef) [bt] #6 /usr/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(ComponentReference.hashComponentRefMod) [bt] #7 /usr/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(BackendVariable.getVar2) [bt] #8 /usr/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(BackendVariable.getVarSingle) [bt] #9...1024 /usr/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(SymbolicJacobian.createAllDiffedVars) [bt] #1025 [...]
This happens with the standard 8192 kB stack size. If I increase it to 65535 kB it works fine, but I guess this might be a tell-tale sign of a not-too-efficient implementation.
I can provide the test case separately if needed.
Change History (5)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
A quick look:
SymbolicJacobian.createAllDiffedVars is recursive with matchcontinue, so no tail-recursion can be applied.
comment:5 by , 7 years ago
In fact, after some more testing I still got stack overflow, this time on a different function; I opened a separate ticket for that, see #4534.
What is strange is that the first time I ran omc on that test model it worked fine, the second time it failed. Is there such a thing as stack memory leaks?
@casella: Is this still the case? Can you provide an example model?