Opened 6 years ago
Closed 6 years ago
#5339 closed defect (wontfix)
OMCTest.cpp fails (assert) on Linux
Reported by: | Owned by: | somebody | |
---|---|---|---|
Priority: | low | Milestone: | Future |
Component: | Cpp Run-time | Version: | v1.14.0-dev-nightly |
Keywords: | omcCAPI | Cc: |
Description
Hi all,
I pulled OMCompiler from github, built OMCompiler (via autoconf) and the omcCAPI Simulation Runtime (cmake) am running into an assert() bug in settingsimpl.c under Ubuntu x64.
Specifically, SimulationRuntime/cpp/omcCAPI/src/OMCTest.cpp is meant to test the OMC C API by starting a bunch of threads and initing the api, but the call to InitOMC eventually calls settingsimpl.c's stripbinpath() on a path that does not contain 'bin'. As this is in an assert() it fails and the application exits.
I poked around in gdb a bit but can't say what the purpose is...pointers appreciated.
Thanks,
Ben
root@ac08b5907da8:/source/OMCompiler/SimulationRuntime/cpp# omc omhome is [/usr/local/bin/omc] via /proc/self/exe ////added in settingsimpl.c to print omhome OpenModelica Compiler OMCompiler v1.14.0-dev.102+g5c4124cc2
root@ac08b5907da8:/src/testOMCCAPI# gdb bin/OMCAPIInterface GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from bin/OMCAPIInterface...done. (gdb) dir /source/OMCompiler/Compiler/runtime/ Source directories searched: /source/OMCompiler/Compiler/runtime:$cdir:$cwd (gdb) dir /source/OMCompiler/SimulationRuntime/cpp/omcCAPI/src/ Source directories searched: /source/OMCompiler/SimulationRuntime/cpp/omcCAPI/src:/source/OMCompiler/Compiler/runtime:$cdir:$cwd (gdb) dir /source/OMCompiler/SimulationRuntime/cpp/omcCAPI/include/ Source directories searched: /source/OMCompiler/SimulationRuntime/cpp/omcCAPI/include:/source/OMCompiler/SimulationRuntime/cpp/omcCAPI/src:/source/OMCompiler/Compiler/runtime:$cdir:$cwd (gdb) set env LD_LIBRARY_PATH /usr/local/lib/x86_64-linux-gnu/omc (gdb) b stripbinpath Function "stripbinpath" not defined. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 1 (stripbinpath) pending. (gdb) run Starting program: /src/testOMCCAPI/bin/OMCAPIInterface warning: Error disabling address space randomization: Operation not permitted [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Test OMC C-API dll ... [New Thread 0x7f209cd6a700 (LWP 1760)] [New Thread 0x7f209c569700 (LWP 1761)] [New Thread 0x7f209bd68700 (LWP 1762)] [New Thread 0x7f209b567700 (LWP 1763)] [New Thread 0x7f209ad66700 (LWP 1764)] [New Thread 0x7f209a565700 (LWP 1765)] [New Thread 0x7f2099d64700 (LWP 1766)] [New Thread 0x7f2099563700 (LWP 1767)] [New Thread 0x7f2098d62700 (LWP 1768)] [New Thread 0x7f2098561700 (LWP 1769)] [New Thread 0x7f2097d60700 (LWP 1770)] [New Thread 0x7f209755f700 (LWP 1771)] Initialize OMC, use gcc compiler on folder: ./tmp0 omhome is [/src/testOMCCAPI/bin/OMCAPIInterface] via /proc/self/exe [New Thread 0x7f2096d5e700 (LWP 1772)] Initialize OMC, use gcc compiler on folder: ./tmp1 omhome is [/src/testOMCCAPI/bin/OMCAPIInterface] via /proc/self/exe [New Thread 0x7f209655d700 (LWP 1773)] [Switching to Thread 0x7f209755f700 (LWP 1771)] Thread 13 "OMCAPIInterface" hit Breakpoint 1, SettingsImpl__getInstallationDirectoryPath () at settingsimpl.c:107 107 stripbinpath(omhome); (gdb) bt #0 SettingsImpl__getInstallationDirectoryPath () at settingsimpl.c:107 #1 0x00007f209eefb79f in SystemImpl__gettextInit (locale=0x7f20a09944d8 <_OMC_LIT_STRUCT14+8> "") at systemimpl.c:2416 #2 0x00007f20a035a389 in omc_System_gettextInit (threadData=threadData@entry=0x7f2097557b20, _locale=<optimized out>) at /source/OMCompiler/Compiler/Util/System.mo:1132 #3 0x00007f20a0399561 in omc_Main_init (threadData=threadData@entry=0x7f2097557b20, _args=_args@entry=0x7f20a2200473 <mmc_nil+3>) at /source/OMCompiler/Compiler/Main/Main.mo:778 #4 0x00007f20a21ff098 in InitOMC (omcDataPtr=<optimized out>, compiler=<optimized out>, openModelicaHome=<optimized out>) at /source/OMCompiler/SimulationRuntime/cpp/omcCAPI/src/OMC.cpp:51 #5 0x000055a3f8c1b500 in runTest (testfolder="./tmp0", omhome=...) at /source/OMCompiler/SimulationRuntime/cpp/omcCAPI/src/OMCTest.cpp:28 #6 0x000055a3f8c1ca2e in std::__invoke_impl<void, void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*> (__f=@0x55a3f9a7d210: 0x55a3f8c1b410 <runTest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>) at /usr/include/c++/7/bits/invoke.h:60 #7 std::__invoke<void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*> (__fn=<optimized out>) at /usr/include/c++/7/bits/invoke.h:95 #8 std::thread::_Invoker<std::tuple<void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*> >::_M_invoke<0ul, 1ul, 2ul> (this=0x55a3f9a7d1e8) at /usr/include/c++/7/thread:234 #9 std::thread::_Invoker<std::tuple<void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*> >::operator() (this=0x55a3f9a7d1e8) at /usr/include/c++/7/thread:243 #10 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*> > >::_M_run (this=0x55a3f9a7d1e0) at /usr/include/c++/7/thread:186 #11 0x00007f20a188c57f in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #12 0x00007f20a1fe56db in start_thread (arg=0x7f209755f700) at pthread_create.c:463 #13 0x00007f20a12e788f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 (gdb) c Continuing. Initialize OMC, use gcc compiler on folder: ./tmp2 omhome is [/src/testOMCCAPI/bin/OMCAPIInterface] via /proc/self/exe [New Thread 0x7f2095d5c700 (LWP 1774)] [Switching to Thread 0x7f2096d5e700 (LWP 1772)] Thread 14 "OMCAPIInterface" hit Breakpoint 1, SettingsImpl__getInstallationDirectoryPath () at settingsimpl.c:107 107 stripbinpath(omhome); (gdb) bt #0 SettingsImpl__getInstallationDirectoryPath () at settingsimpl.c:107 #1 0x00007f209eefb79f in SystemImpl__gettextInit (locale=0x7f20a09944d8 <_OMC_LIT_STRUCT14+8> "") at systemimpl.c:2416 #2 0x00007f20a035a389 in omc_System_gettextInit (threadData=threadData@entry=0x7f2096d56b20, _locale=<optimized out>) at /source/OMCompiler/Compiler/Util/System.mo:1132 #3 0x00007f20a0399561 in omc_Main_init (threadData=threadData@entry=0x7f2096d56b20, _args=_args@entry=0x7f20a2200473 <mmc_nil+3>) at /source/OMCompiler/Compiler/Main/Main.mo:778 #4 0x00007f20a21ff098 in InitOMC (omcDataPtr=<optimized out>, compiler=<optimized out>, openModelicaHome=<optimized out>) at /source/OMCompiler/SimulationRuntime/cpp/omcCAPI/src/OMC.cpp:51 #5 0x000055a3f8c1b500 in runTest (testfolder="./tmp1", omhome=...) at /source/OMCompiler/SimulationRuntime/cpp/omcCAPI/src/OMCTest.cpp:28 #6 0x000055a3f8c1ca2e in std::__invoke_impl<void, void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*> (__f=@0x55a3f9a7d3a0: 0x55a3f8c1b410 <runTest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>) at /usr/include/c++/7/bits/invoke.h:60 #7 std::__invoke<void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*> (__fn=<optimized out>) at /usr/include/c++/7/bits/invoke.h:95 #8 std::thread::_Invoker<std::tuple<void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*> >::_M_invoke<0ul, 1ul, 2ul> (this=0x55a3f9a7d378) at /usr/include/c++/7/thread:234 #9 std::thread::_Invoker<std::tuple<void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*> >::operator() (this=0x55a3f9a7d378) at /usr/include/c++/7/thread:243 #10 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*> > >::_M_run (this=0x55a3f9a7d370) at /usr/include/c++/7/thread:186 #11 0x00007f20a188c57f in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #12 0x00007f20a1fe56db in start_thread (arg=0x7f2096d5e700) at pthread_create.c:463 #13 0x00007f20a12e788f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 (gdb) c Continuing. [Switching to Thread 0x7f209655d700 (LWP 1773)] Thread 15 "OMCAPIInterface" hit Breakpoint 1, SettingsImpl__getInstallationDirectoryPath () at settingsimpl.c:107 107 stripbinpath(omhome); (gdb) bt #0 SettingsImpl__getInstallationDirectoryPath () at settingsimpl.c:107 #1 0x00007f209eefb79f in SystemImpl__gettextInit (locale=0x7f20a09944d8 <_OMC_LIT_STRUCT14+8> "") at systemimpl.c:2416 #2 0x00007f20a035a389 in omc_System_gettextInit (threadData=threadData@entry=0x7f2096555b20, _locale=<optimized out>) at /source/OMCompiler/Compiler/Util/System.mo:1132 #3 0x00007f20a0399561 in omc_Main_init (threadData=threadData@entry=0x7f2096555b20, _args=_args@entry=0x7f20a2200473 <mmc_nil+3>) at /source/OMCompiler/Compiler/Main/Main.mo:778 #4 0x00007f20a21ff098 in InitOMC (omcDataPtr=<optimized out>, compiler=<optimized out>, openModelicaHome=<optimized out>) at /source/OMCompiler/SimulationRuntime/cpp/omcCAPI/src/OMC.cpp:51 #5 0x000055a3f8c1b500 in runTest (testfolder="./tmp2", omhome=...) at /source/OMCompiler/SimulationRuntime/cpp/omcCAPI/src/OMCTest.cpp:28 #6 0x000055a3f8c1ca2e in std::__invoke_impl<void, void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*> (__f=@0x55a3f9a7d530: 0x55a3f8c1b410 <runTest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>) at /usr/include/c++/7/bits/invoke.h:60 #7 std::__invoke<void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*> (__fn=<optimized out>) at /usr/include/c++/7/bits/invoke.h:95 #8 std::thread::_Invoker<std::tuple<void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*> >::_M_invoke<0ul, 1ul, 2ul> (this=0x55a3f9a7d508) at /usr/include/c++/7/thread:234 #9 std::thread::_Invoker<std::tuple<void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*> >::operator() (this=0x55a3f9a7d508) at /usr/include/c++/7/thread:243 #10 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*> > >::_M_run (this=0x55a3f9a7d500) at /usr/include/c++/7/thread:186 #11 0x00007f20a188c57f in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #12 0x00007f20a1fe56db in start_thread (arg=0x7f209655d700) at pthread_create.c:463 #13 0x00007f20a12e788f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 (gdb) c Continuing. Initialize OMC, use gcc compiler on folder: ./tmp3 options options +d=execstat +simCodeTarget=Cpp +target=gcc+d=execstat +simCodeTarget=Cpp +target=gcc OMCAPIInterface: settingsimpl.c:71: void stripbinpath(char*): Assertion `tmp = strrchr(omhome,'/')' failed. ..failed..failed Create working directory of OMC: ./tmp3 Create working directory of OMC: ./tmp0 ..ok Set working directory of OMC:./tmp0 ..ok Error, directory ./tmp0 does not exist, Get version of OMC ..ok Set working directory of OMC:./tmp3 ..ok Error, directory ./tmp3 does not exist, Thread 14 "OMCAPIInterface" received signal SIGABRT, Aborted. [Switching to Thread 0x7f2096d5e700 (LWP 1772)] __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 #1 0x00007f20a1206801 in __GI_abort () at abort.c:79 #2 0x00007f20a11f639a in __assert_fail_base (fmt=0x7f20a137d7d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7f209ef2319f "tmp = strrchr(omhome,'/')", file=file@entry=0x7f209ef23138 "settingsimpl.c", line=line@entry=71, function=function@entry=0x7f209ef232d0 <stripbinpath::__PRETTY_FUNCTION__> "void stripbinpath(char*)") at assert.c:92 #3 0x00007f20a11f6412 in __GI___assert_fail (assertion=assertion@entry=0x7f209ef2319f "tmp = strrchr(omhome,'/')", file=file@entry=0x7f209ef23138 "settingsimpl.c", line=line@entry=71, function=function@entry=0x7f209ef232d0 <stripbinpath::__PRETTY_FUNCTION__> "void stripbinpath(char*)") at assert.c:101 #4 0x00007f209ef009c3 in stripbinpath (omhome=0x7f209f170b00 <SettingsImpl__getInstallationDirectoryPath::omhome> "") at settingsimpl.c:71 #5 SettingsImpl__getInstallationDirectoryPath () at settingsimpl.c:107 #6 0x00007f209eefb79f in SystemImpl__gettextInit (locale=0x7f20a09944d8 <_OMC_LIT_STRUCT14+8> "") at systemimpl.c:2416 #7 0x00007f20a035a389 in omc_System_gettextInit (threadData=threadData@entry=0x7f2096d56b20, _locale=<optimized out>) at /source/OMCompiler/Compiler/Util/System.mo:1132 #8 0x00007f20a0399561 in omc_Main_init (threadData=threadData@entry=0x7f2096d56b20, _args=_args@entry=0x7f20a2200473 <mmc_nil+3>) at /source/OMCompiler/Compiler/Main/Main.mo:778 #9 0x00007f20a21ff098 in InitOMC (omcDataPtr=<optimized out>, compiler=<optimized out>, openModelicaHome=<optimized out>) at /source/OMCompiler/SimulationRuntime/cpp/omcCAPI/src/OMC.cpp:51 #10 0x000055a3f8c1b500 in runTest (testfolder="./tmp1", omhome=...) at /source/OMCompiler/SimulationRuntime/cpp/omcCAPI/src/OMCTest.cpp:28 #11 0x000055a3f8c1ca2e in std::__invoke_impl<void, void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*> (__f=@0x55a3f9a7d3a0: 0x55a3f8c1b410 <runTest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>) at /usr/include/c++/7/bits/invoke.h:60 #12 std::__invoke<void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*> (__fn=<optimized out>) at /usr/include/c++/7/bits/invoke.h:95 #13 std::thread::_Invoker<std::tuple<void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*> >::_M_invoke<0ul, 1ul, 2ul> (this=0x55a3f9a7d378) at /usr/include/c++/7/thread:234 #14 std::thread::_Invoker<std::tuple<void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*> >::operator() (this=0x55a3f9a7d378) at /usr/include/c++/7/thread:243 #15 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*> > >::_M_run (this=0x55a3f9a7d370) at /usr/include/c++/7/thread:186 #16 0x00007f20a188c57f in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #17 0x00007f20a1fe56db in start_thread (arg=0x7f2096d5e700) at pthread_create.c:463 #18 0x00007f20a12e788f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 (gdb) c Continuing. Couldn't get registers: No such process. Couldn't get registers: No such process. (gdb) [Thread 0x7f2095d5c700 (LWP 1774) exited] [Thread 0x7f209655d700 (LWP 1773) exited] [Thread 0x7f2096d5e700 (LWP 1772) exited] [Thread 0x7f209755f700 (LWP 1771) exited] [Thread 0x7f2098561700 (LWP 1769) exited] [Thread 0x7f2098d62700 (LWP 1768) exited] [Thread 0x7f2099563700 (LWP 1767) exited] [Thread 0x7f2099d64700 (LWP 1766) exited] [Thread 0x7f209a565700 (LWP 1765) exited] [Thread 0x7f209ad66700 (LWP 1764) exited] [Thread 0x7f209b567700 (LWP 1763) exited] [Thread 0x7f209bd68700 (LWP 1762) exited] [Thread 0x7f209c569700 (LWP 1761) exited] [Thread 0x7f209cd6a700 (LWP 1760) exited] [Thread 0x7f20a2612840 (LWP 1756) exited] Program terminated with signal SIGABRT, Aborted. The program no longer exists.
Change History (4)
follow-up: 2 comment:1 by , 6 years ago
comment:2 by , 6 years ago
Replying to sjoelund.se:
Simple solution: Don't use the C++ runtime CAPI. It doesn't follow the restrictions on when you can call functions.
Main.init
must be called only once or you have a race condition where multiple threads can work on the same global variable. So you would need to move the call toMain.init
out of loop (or do it there in addition to inside the loop).
Thanks...is there another api to facilitate model compilation? If the CAPI is deprecated why is it still in the repository? Looking through the build files it's not clear what headers describe the various libraries or how these should be linked against. What is the preferred way to use OMC?
comment:3 by , 6 years ago
The preferred way is ZMQ communication. Otherwise the preferred way is the C API (the one not in the C++ runtime, also used by OMEdit). I believe the CAPI in the cppruntime was used by XXXXX to try to gain additional performance through multi-threading rather than multi-processing (which doesn't really work well in a global lock garbage collector that requires you to register each thread so it can stop all threads to prevent garbage from happening; only pthreads allowed, no OpenMP or similar).
comment:4 by , 6 years ago
Priority: | high → low |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
Simple solution: Don't use the C++ runtime CAPI. It doesn't follow the restrictions on when you can call functions.
Main.init
must be called only once or you have a race condition where multiple threads can work on the same global variable. So you would need to move the call toMain.init
out of loop (or do it there in addition to inside the loop).