Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExternalMedia library, OMEdit crash with Test.fluidProp.WaterIF95.TestBasePropertiesDynamic #2838

Open
OpenModelica-TracImporter opened this issue Jun 27, 2020 · 13 comments

Comments

@OpenModelica-TracImporter
Copy link
Member

No description provided.

@bilderbuchi
Copy link

Original ticket https://trac.openmodelica.org/OpenModelica/ticket/2838

AFAICT, this still happens on Windows with OM 1.20 and current ExternalMedia master (f524f94), binaries from https://github.com/modelica-3rdparty/ExternalMedia/suites/9592856454/artifacts/457340537 -- running the example crashes OM.

@casella
Copy link
Contributor

casella commented Dec 12, 2022

@bilderbuchi I need to go for one more full rounds of ExternalMedia tests before finally making the releases. Too much stuff in the pipeline...

@bilderbuchi
Copy link

@bilderbuchi I need to go for one more full rounds of ExternalMedia tests before finally making the releases. Too much stuff in the pipeline...

😅 I know the feeling! No worries, I just used the opportunity of the 1.20 release to re-check issues, if they still reproduce.

@bilderbuchi
Copy link

bilderbuchi commented Mar 20, 2023

I just retested this with a recent OM nightly (1.21.0-dev-318) and current ExternalMedia master (modelica-3rdparty/ExternalMedia@db55653) with binaries from the CI job, and running Test.FluidProp.WaterIF95.TestBasePropertiesDynamic still crashes OMEdit.

Even running with --Debug=true, the last line in the communications log is

translateModel(ExternalMedia.Test.FluidProp.WaterIF95.TestBasePropertiesDynamic,startTime=0, stopTime=80, numberOfIntervals=800, method="dassl", tolerance=1e-07, outputFormat="mat", fileNamePrefix="TestBasePropertiesDynamic", variableFilter=".*") 14:00:39:839

omc just silently quits when trying to simulate the model with it.

Irrespective of progress in ExternalMedia, I think OM should not just crash when there is a problem with a package/external library, but catch the exception and emit an error message.
It's understandable that this model does not compile, because I don't have FluidProp installed, but OMEdit just crashing is not how I think the lack of library should manifest/be handled.

@bilderbuchi
Copy link

bilderbuchi commented Mar 21, 2023

Running the model in omc using gdb reveals a segfault that probably should be caught:

Thread 1 received signal SIGSEGV, Segmentation fault.
0x00000000703c18d9 
in TFluidProp::SetFluid(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, double*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*) ()
from C:\somepath\ExternalMedia\Modelica\ExternalMedia\Resources\Library\win64\ExternalMediaLib.dll 
backtrace
#0  0x00000000703c18d9 in TFluidProp::SetFluid(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, double*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*) ()
from C:\somepath\ExternalMedia\Resources\Library\win64\ExternalMediaLib.dll
#1  0x00000000703df783 in FluidPropSolver::FluidPropSolver(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
from C:\somepath\ExternalMedia\Resources\Library\win64\ExternalMediaLib.dll
#2  0x00000000703e0c0f in SolverMap::getSolver(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
from C:\somepath\ExternalMedia\Resources\Library\win64\ExternalMediaLib.dll
#3  0x00000000703d1def in TwoPhaseMedium_getMolarMass_C_impl ()
from C:\somepath\ExternalMedia\Resources\Library\win64\ExternalMediaLib.dll
#4  0x00000000075ad711 in ffi_call_win64 () at ../src/x86\win64.S:76
#5  0x00000000075ad502 in ffi_call_int (cif=<optimized out>, fn=<optimized out>, rvalue=<optimized out>,
avalue=0x242b6f0, closure=0x0) at ../src/x86\ffiw64.c:172
#6  0x00000000075ad3e2 in ffi_call (cif=0x0, fn=0x242b700, rvalue=0x1, avalue=0x242b6f0) at ../src/x86\ffiw64.c:178
#7  0x000000000759efa9 in FFI_callFunction () from C:\OpenModelica1.21.0-dev-64bit\bin\libOpenModelicaCompiler.dll
#8  0x00000000066cbb3a in omc_FFI_callFunction (threadData=<optimized out>, _fnHandle=0, _args=0x242b700,
_args@entry=0x3f3501b3, _specs=0x1, _returnType=0x7b5560b <_OMC_LIT_STRUCT48+3>, out_outputArgs=0x242c150)
at C:/dev/OM64bit/OMCompiler/Compiler/Util/FFI.mo:11
#9  0x0000000006c5761a in omc_NFEvalFunction_callExternalFunction (threadData=threadData@entry=0x242fad0,
_extName=<optimized out>, _extName@entry=0x39a74983, _fn=_fn@entry=0x4342a203, _args=<optimized out>,
_args@entry=0x7b69ac3 <mmc_nil+3>, _extArgs=0x42618883, _outputRef=0x43464d43, _extAnnotation=0x42864d63,
_debug=0 '\000') at C:/dev/OM64bit/OMCompiler/Compiler/NFFrontEnd/NFEvalFunction.mo:1148
#10 0x0000000006c5bcb6 in omc_NFEvalFunction_evaluateExternal (threadData=0x242fad0, _fn=0x4342a203,
_args=0x7b69ac3 <mmc_nil+3>, _target=0x7b654f3 <_OMC_LIT_STRUCT1+3>)
at C:/dev/OM64bit/OMCompiler/Compiler/NFFrontEnd/NFEvalFunction.mo:165
#11 0x0000000006c369ee in omc_NFExpression_mapSplitExpressions (threadData=0x242fad0, _exp=0x4263c9a3,
_func=0x4263c963) at C:/dev/OM64bit/OMCompiler/Compiler/NFFrontEnd/NFExpression.mo:5630
#12 0x0000000006ca6b4d in omc_NFCeval_makeRecordFieldBindingFromParent (threadData=0x242fad0, _cref=0x4345d0c3,
_target=0x7b654f3 <_OMC_LIT_STRUCT1+3>) at C:/dev/OM64bit/OMCompiler/Compiler/NFFrontEnd/NFCeval.mo:758
#13 0x0000000006ca6e75 in omc_NFCeval_makeComponentBinding (threadData=threadData@entry=0x242fad0,
_component=_component@entry=0x43380c03, _node=_node@entry=0x42c5eeb3, _cref=0x4345d0c3,
_target=0x7b654f3 <_OMC_LIT_STRUCT1+3>) at C:/dev/OM64bit/OMCompiler/Compiler/NFFrontEnd/NFCeval.mo:696
#14 0x0000000006ca7aa2 in omc_NFCeval_evalComponentBinding (threadData=threadData@entry=0x242fad0,
_node=_node@entry=0x42c5eeb3, _cref=_cref@entry=0x4345d0c3, _defaultExp=_defaultExp@entry=0x3f32d3f3,
_target=0x7b654f3 <_OMC_LIT_STRUCT1+3>, _evalSubscripts=0 '\000', _liftExp=1 '\001')
at C:/dev/OM64bit/OMCompiler/Compiler/NFFrontEnd/NFCeval.mo:407
#15 0x0000000006ca7fb0 in omc_NFCeval_evalCref (threadData=threadData@entry=0x242fad0,
_cref=_cref@entry=0x4345d0c3, _defaultExp=_defaultExp@entry=0x3f32d3f3,
_target=0x7b654f3 <_OMC_LIT_STRUCT1+3>, _evalSubscripts=0 '\000', _liftExp=1 '\001')
at C:/dev/OM64bit/OMCompiler/Compiler/NFFrontEnd/NFCeval.mo:372
#16 0x0000000006c61f26 in omc_NFEvalConstants_evaluateExpTraverser (threadData=threadData@entry=0x242fad0,
_exp=<optimized out>, _exp@entry=0x3f24f0c3, _info=_info@entry=0x39a72193, _changed=0 '\000',
out_outChanged=0x0) at C:/dev/OM64bit/OMCompiler/Compiler/NFFrontEnd/NFEvalConstants.mo:185
#17 0x0000000006c61212 in omc_NFEvalConstants_evaluateExp (threadData=0x242fad0, _exp=0x3f24f0c3, _info=0x39a72193)
at C:/dev/OM64bit/OMCompiler/Compiler/NFFrontEnd/NFEvalConstants.mo:148
#18 omc_NFEvalConstants_evaluateEquation (threadData=threadData@entry=0x242fad0, __omcQ_24in_5Feq=0x43451e43)
at C:/dev/OM64bit/OMCompiler/Compiler/NFFrontEnd/NFEvalConstants.mo:376
#19 0x0000000006c62c20 in omc_NFEvalConstants_evaluateEquations (threadData=0x242fad0, _eql=<optimized out>)
at C:/dev/OM64bit/OMCompiler/Compiler/boot/build/tmp/NFEvalConstants.c:1448
#20 omc_NFEvalConstants_evaluate (threadData=threadData@entry=0x242fad0, __omcQ_24in_5FflatModel=<optimized out>,
_context=_context@entry=0) at C:/dev/OM64bit/OMCompiler/Compiler/NFFrontEnd/NFEvalConstants.mo:69
#21 0x0000000006c0d861 in omc_NFInst_instClassInProgram (threadData=threadData@entry=0x242fad0,
_classPath=<optimized out>, _program=0x42903003, _annotationProgram=<optimized out>,
_relaxedFrontend=0 '\000', _dumpFlat=0 '\000', out_functions=0x242cbc0, out_flatString=0x242cbc8)
at C:/dev/OM64bit/OMCompiler/Compiler/NFFrontEnd/NFInst.mo:170
#22 0x0000000006af92c8 in omc_CevalScriptBackend_runFrontEndWorkNF (threadData=threadData@entry=0x242fad0,
_className=<optimized out>, _className@entry=0x3d6cd333, _relaxedFrontend=<optimized out>,
_relaxedFrontend@entry=0 '\000', _dumpFlat=<optimized out>, _dumpFlat@entry=0 '\000', out_functions=0x242cd90,
out_flatString=0x242cda0) at C:/dev/OM64bit/OMCompiler/Compiler/Script/CevalScriptBackend.mo:3372
#23 0x0000000006af9750 in omc_CevalScriptBackend_runFrontEndWork (threadData=threadData@entry=0x242fad0,
__omcQ_24in_5Fcache=__omcQ_24in_5Fcache@entry=0x3d5a1bc3, __omcQ_24in_5Fenv=<optimized out>,
--Type <RET> for more, q to quit, c to continue without paging--c
_className=_className@entry=0x3d6cd333, _relaxedFrontEnd=0 '\000', _dumpFlat=0 '\000', out_env=0x242cf88, out_dae=0x242cf80, out_flatString=0x242cf78) at C:/dev/OM64bit/OMCompiler/Compiler/Script/CevalScriptBackend.mo:3289
#24 0x0000000006ae1cff in omc_CevalScriptBackend_runFrontEnd (threadData=threadData@entry=0x242fad0, __omcQ_24in_5Fcache=__omcQ_24in_5Fcache@entry=0x3d5a1bc3, __omcQ_24in_5Fenv=<optimized out>, _className=_className@entry=0x3d6cd333, _relaxedFrontEnd=0 '\000', _dumpFlat=0 '\000', _transform=0 '\000', out_env=0x242d220, out_odae=0x242d1e8, out_flatString=0x0) at C:/dev/OM64bit/OMCompiler/Compiler/Script/CevalScriptBackend.mo:3211
#25 0x0000000006aa1a5e in omc_SimCodeMain_translateModel (threadData=threadData@entry=0x242fad0, _kind=0x7b2bf83 <_OMC_LIT_STRUCT516+3>, __omcQ_24in_5Fcache=__omcQ_24in_5Fcache@entry=0x3d5a1bc3, _inEnv=_inEnv@entry=0x3d599a53, _className=0x3d6cd333, _inFileNamePrefix=0x3d53bb43, _addDummy=<optimized out>, _inSimSettingsOpt=0x3d6d48a3, _args=0x7b2a8d3 <_OMC_LIT_STRUCT238+3>, out_cache=0x242d318, out_outStringLst=0x242d320, out_outFileDir=0x242d328, out_resultValues=0x242d330) at C:/dev/OM64bit/OMCompiler/Compiler/SimCode/SimCodeMain.mo:1083
#26 0x0000000006af8a5f in omc_CevalScriptBackend_callTranslateModel (threadData=threadData@entry=0x242fad0, _inCache=0x3d5a1bc3, _inEnv=_inEnv@entry=0x3d599a53, _className=_className@entry=0x3d6cd333, _inFileNamePrefix=0x3d53bb43, _inSimSettingsOpt=0x3d6d48a3, out_outCache=0x242d4f8, out_outStringLst=0x242d4e8, out_outFileDir=0x242d4f0, out_resultValues=0x242d4e0) at C:/dev/OM64bit/OMCompiler/Compiler/Script/CevalScriptBackend.mo:3530
#27 0x0000000006aefa10 in omc_CevalScriptBackend_translateModel (threadData=threadData@entry=0x242fad0, _inCache=<optimized out>, _inCache@entry=0x3d5a1bc3, _inEnv=_inEnv@entry=0x3d599a53, _className=_className@entry=0x3d6cd333, _inFileNamePrefix=0x3d53bb43, _addDummy=<optimized out>, _inSimSettingsOpt=0x3d6d48a3, out_outCache=0x242d848, out_outStringLst=0x242d838, out_outFileDir=0x242d818, out_resultValues=0x242d830) at C:/dev/OM64bit/OMCompiler/Compiler/Script/CevalScriptBackend.mo:3430
#28 0x0000000006aeef42 in omc_CevalScriptBackend_buildModel (threadData=threadData@entry=0x242fad0, _inCache=<optimized out>, _inEnv=<optimized out>, _inEnv@entry=0x3d599a53, _inValues=0x3d6d4d43, _inMsg=<optimized out>, out_outCache=0x242e190, out_compileDir=0x242e138, out_outString1=0x242e158, out_outString2=0x0, out_outputFormat_str=0x0, out_outInitFileName=0x242e0f8, out_outSimFlags=0x0, out_resultValues=0x0, out_outArgs=0x242e188, out_outLibsAndLibDirs=0x0) at C:/dev/OM64bit/OMCompiler/Compiler/Script/CevalScriptBackend.mo:5608
#29 0x0000000006b0e0f2 in omc_CevalScriptBackend_cevalInteractiveFunctions3 (threadData=<optimized out>, threadData@entry=0x242fad0, _inCache=<optimized out>, _inEnv=_inEnv@entry=0x3d599a53, _inFunctionName=_inFunctionName@entry=0x7c3ee13 <_OMC_LIT_STRUCT39+3>, _inVals=0x3d6d4d43, _msg=0x3d6d23a3, out_outValue=0x242e850) at C:/dev/OM64bit/OMCompiler/Compiler/Script/CevalScriptBackend.mo:1381
#30 0x000000000723222f in omc_CevalScript_cevalInteractiveFunctions2 (threadData=<optimized out>, threadData@entry=0x242fad0, _cache=<optimized out>, _cache@entry=0x3d5a1bc3, _env=_env@entry=0x3d599a53, _functionName=0x242b6f0, _functionName@entry=0x7c3ee13 <_OMC_LIT_STRUCT39+3>, _args=0x3d6d4d43, _msg=0x3d6d23a3, out_outValue=0x242ea68) at C:/dev/OM64bit/OMCompiler/Compiler/Script/CevalScript.mo:1484
#31 0x0000000007236127 in omc_CevalScript_cevalInteractiveFunctions (threadData=threadData@entry=0x242fad0, _inCache=<optimized out>, _inEnv=<optimized out>, _inExp=<optimized out>, _msg=0x3d6d23a3, _numIter=1, out_outValue=0x242ec88) at C:/dev/OM64bit/OMCompiler/Compiler/Script/CevalScript.mo:569
#32 0x00000000072375da in omc_CevalScript_ceval (threadData=threadData@entry=0x242fad0, _inCache=<optimized out>, _inCache@entry=0x3d5a1bc3, _inEnv=<optimized out>, _inEnv@entry=0x242ee50, _inExp=<optimized out>, _inBoolean=1 '\001', _inMsg=0x3d6d23a3, _numIter=0, out_outValue=0x242ee50) at C:/dev/OM64bit/OMCompiler/Compiler/Script/CevalScript.mo:172
#33 0x000000000721fa71 in omc_Interactive_evaluateExpr (threadData=threadData@entry=0x242fad0, _inExp=<optimized out>, _info=_info@entry=0x2497f03) at C:/dev/OM64bit/OMCompiler/Compiler/Script/Interactive.mo:733
#34 0x000000000721f897 in omc_Interactive_evaluateExprToStr (threadData=threadData@entry=0x242fad0, _inExp=<optimized out>, _inExp@entry=0x2488c33, _info=_info@entry=0x2497f03) at C:/dev/OM64bit/OMCompiler/Compiler/Script/Interactive.mo:775
#35 0x0000000007221925 in omc_Interactive_evaluate2 (threadData=threadData@entry=0x242fad0, _inStatements=<optimized out>) at C:/dev/OM64bit/OMCompiler/Compiler/Script/Interactive.mo:354
#36 0x0000000007222362 in omc_Interactive_evaluateToStdOut (threadData=<optimized out>, threadData@entry=0x242fad0, _statements=<optimized out>, _statements@entry=0x2488b13, _verbose=1 '\001') at C:/dev/OM64bit/OMCompiler/Compiler/Script/Interactive.mo:198
#37 0x0000000007099a48 in omc_Main_translateFile (threadData=threadData@entry=0x242fad0, _inStringLst=<optimized out>, _inStringLst@entry=0x2486443) at C:/dev/OM64bit/OMCompiler/Compiler/Main/Main.mo:491
#38 0x0000000007098983 in omc_Main_main2 (threadData=threadData@entry=0x242fad0, _args=<optimized out>, _args@entry=0x2486443) at C:/dev/OM64bit/OMCompiler/Compiler/Main/Main.mo:881
#39 0x0000000007099d36 in omc_Main_main (threadData=threadData@entry=0x242fad0, _args=_args@entry=0x2481fe3) at C:/dev/OM64bit/OMCompiler/Compiler/Main/Main.mo:821
#40 0x0000000007510eb1 in __omc_main (argc=<optimized out>, argv=0x24f6cf0) at build\_main_omc.c:61
#41 0x00000000004013c1 in __tmainCRTStartup () at C:/_/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:333
#42 0x00000000004014f6 in mainCRTStartup () at C:/_/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:212  

@casella
Copy link
Contributor

casella commented Mar 23, 2023

@bilderbuchi thanks for reporting. Unfortunately, this stems from a basic issue, which is discussed in modelica/ModelicaSpecification#2191 ad #9029: there is currently no guaranteed way to access ModelicaError from externally compiled code that may be called either at run time or compile time, with all Modelica tools and with all major operating systems.

Thanks to @fedetft we eventually managed to conjure up a strategy that works in most cases. It works well if the error is generated when actually computing medium properties at runtime, which is normally initiated by calling setState_XX functions. This is currently handled successfully with ModelicaError with Dymola and OMC under Linux and Windows. This means that if a solver goes beyond the validity limits of a certain medium models, and the external code throws an error, the exception is caught by the tool and the solver retries with a different step or something.

Unfortunately, we couldn't find a way to have ModelicaError handled also at compile time. In order to do so, we would need all Modelica tools to export the ModelicaError symbol, not only in the executable simulation codes, but also in the tools themselves. This would allow to check if the solver exists and report an error in that case, instead of segfaulting. This is actually already possible with the Linux versions of OMC and Dymola (probably by sheer chance), but alas not for Windows versions.

When you compile a model using ExternalMedia with OMC, the frontend evaluates all constants at compile time, and to do so it triggers a chain of events that leads to calling the some function in the externally compiled DLL at compile time already. That function calls SetFluid, which crashes because there is no pointer to the solver. Of course we could check if the pointer is null and report an error, but the problem is, we can't call ModelicaError in this context.

In principle we could implement a workaround for this issue: if the solver does not exist, set the constants to some dummy value, and delay the generation of the proper error to the runtime, when setState_XX is called during initialization, and ModelicaError is available. However, this would pollute the code even more than it already is with low-level hacks which are difficult to understand, explain, and maintain, I'm not sure that is the best way to go. We needed the hacks to finally get the thing going, but enough of that already.

I think we should instead invest our time into trying to convince the community to standardize and provide full support of ModelicaError (and in fact all Modelica.Utilities) functions both at run time and compile time without the need of intricate hacks. That would solve all problems at the root: when something wrong happens, you just call ModelicaError, and you don't have to worry if the symbols are available, or to pass around pointers to that function, or other low-level, tool-dependent stuff. It will also ensure that ExternalMedia runs out of the box on other Modelica tools we haven't tried out yet.

Do you want to help us with that? If so, we can restart the discussion on modelica/ModelicaSpecification#2191.

@bilderbuchi
Copy link

bilderbuchi commented Mar 23, 2023

Ah, that sounds like gnarly problem. I had seen/skimmed #9029, but I'm quickly out of my depth with linking intricacies.

I understand the problem I think and accept that it happens and this is unavoidable for the time being. What I don't fully get, as to me it seems quite avoidable, is that a segfault in the compiler crashes OMEdit. It's like you compile a malformed C++ program and your Visual Studio just closes -- quite unexpected and undesirable!

Is there no equivalent to what I would do in Python to limit the blast radius of an Exception?

try:
    ret = compile(somecode)
except RuntimeError as exc: # or "Exception" if you want to catch all of them
    print(f'Oopsie, compilation failed: {exc}!')

I'm not sure how I could help with modelica/ModelicaSpecification#2191, as I'm by no means an expert. Also, before restarting another can of wormsdiscussion, I'd rather first conclude the last one I restarted.

@casella
Copy link
Contributor

casella commented Mar 23, 2023

Ah, that sounds like gnarly problem.

It is 😓

I understand the problem I think and accept that it happens and this is unavoidable for the time being. What I don't fully get, as to me it seems quite avoidable, is that a segfault in the compiler crashes OMEdit. It's like you compile a malformed C++ program and your Visual Studio just closes -- quite unexpected and undesirable!

OMEdit is directly linked to OMC, so the communication is pretty low-level. I think in the past we used CORBA, which is of course safer, but slow as hell, eventually we needed something more direct.

Is there no equivalent to what I would do in Python to limit the blast radius of an Exception?

Not sure, @adrpo, @mahge, @perost, @sjoelund any idea?

I'm not sure how I could help with modelica/ModelicaSpecification#2191, as I'm by no means an expert.

You can help pushing as a developer for the need of calling utilities functions in all contexts.

Also, before restarting another can of wormsdiscussion, I'd rather first conclude the last one I restarted.

I lost hope on that. At least, I would not put it on the critical path 😅

@adrpo
Copy link
Member

adrpo commented Mar 23, 2023

Python is an interpreter but if you call some external C library that will dereference a NULL pointer Python will die very nicely. There is no exception handling for that. It might be possible to set some event handler and try to recover but sometimes is impossible to recover.

@bilderbuchi
Copy link

I lost hope on that. At least, I would not put it on the critical path 😅

In December, I came up with a possible solution for the stumbling block that I'm still hoping for your feedback/comments on. I planned to wait until after 1.21 before bumping you again, though, as I can see how busy you are. :-)

@bilderbuchi
Copy link

bilderbuchi commented Mar 23, 2023

OMEdit is directly linked to OMC

Ah, I was not aware, I assumed this was ZMQ (or something); I can see how being linked as a library will complicate things. 😅

@sjoelund
Copy link
Member

Running the model in omc using gdb reveals a segfault that probably should be caught

It's not really safe to catch segmentation faults. Anything could have happened in the code with dangling pointers/etc.

@fedetftpolimi
Copy link

We reached a point where it makes no sense to try adding further workarounds for a problem that has no solution. Catching segmentation faults and recovering in the general case is impossible. There are already enough workarounds in ExternalMedia that keep failing in certain corner cases.

I think we need to address the root cause of the problem by forcing the openmodelica specifications to make error reporting functions available both at compile time and at run-time. The possibility to call external functions at compile time to resolve package constants coupled with the lack of mandated, standardized error reporting at compile time results in a broken language specification. Period.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants