Opened 9 years ago

Last modified 9 years ago

#3314 new defect

Under RHEL6.5, the VanDerPol FMU created by omc r25909 segfaults when run using fmusdk2

Reported by: cxh@… Owned by:
Priority: high Milestone: Future
Component: FMI Version: trunk
Keywords: Cc: adeas31, wbraun

Description

Under RHEL6.5, the VanDerPol FMU created by omc r25909 segfaults when run using fmusdk2.

Here's how to reproduce this:

Build FMUSDK2:

git clone https://github.com/cxbrooks/fmusdk2.git
cd fmusdk2
make
cd fmu20/bin

Using the OpenModelica devel tree, create VanDerPol.fmu:

cxh@terra VanDerPol]$ omc --version
1.9.3+dev (r25909)
[cxh@terra VanDerPol]$ cat VanDerPol.mo
// Van der Pol model
// From OpenModelica: build/share/doc/omc/testmodels/VanDerPol.mo
model VanDerPol  "Van der Pol oscillator model"
  // Was start = 1, but FMUSDK has start = 2
  Real x(start = 2);
  // Was start = 1, but FMUSDK has start = 0
  Real y(start = 0);
  // Was lambda = 0.3, but FMUSDK has start = 1
  parameter Real lambda = 1.0;
equation
  der(x) = y;
  der(y) = - x + lambda*(1 - x*x)*y;
end VanDerPol;
[cxh@terra VanDerPol]$ cat VanDerPol.mos
loadModel(Modelica, {"3.2.1"});
getErrorString();
loadFile("VanDerPol.mo"); getErrorString();
OpenModelica.Scripting.translateModelFMU(
        className=VanDerPol,
        version="2.0");
getErrorString();
[cxh@terra VanDerPol]$ omc VanDerPol.mos
true
""
true
""
"SimCode: The model VanDerPol has been translated to FMU"
"Warning: The initial conditions are not fully specified. Use +d=initialization for more information.
"
[cxh@terra VanDerPol]$ gdb ~/src/fmi/fmusdk2/fmu20/bin/fmusim_me
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-75.el6)
Copyright (C) 2010 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-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/cxh/src/fmi/fmusdk2/fmu20/bin/fmusim_me...done.
(gdb) r  VanDerPol.fmu
Starting program: /home/cxh/src/fmi/fmusdk2/fmu20/bin/fmusim_me VanDerPol.fmu
warning: File "/usr/local/gcc-4.9.2/lib64/libstdc++.so.6.0.20-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "/usr/share/gdb/auto-load:/usr/lib/debug:/usr/bin/mono-gdb.py".
To enable execution of this file add
        add-auto-load-safe-path /usr/local/gcc-4.9.2/lib64/libstdc++.so.6.0.20-gdb.py
line to your configuration file "/home/cxh/.gdbinit".
To completely disable this security protection add
        set auto-load safe-path /
line to your configuration file "/home/cxh/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
        info "(gdb)Auto-loading safe path"
[Thread debugging using libthread_db enabled]
cmd='unzip -o -d fmuTmpceAftN/ "VanDerPol.fmu" > /dev/null'
Detaching after fork from child process 12875.
fmiModelDescription
  fmiVersion=2.0
  modelName=VanDerPol
  guid={8c4e810f-3df3-4a00-8276-176fa3c9f9e0}
  description=Van der Pol oscillator model
ModelExchange
  modelIdentifier=VanDerPol
dllPath = fmuTmpceAftN/binaries/linux64/VanDerPol.so
FMU Simulator: run 'VanDerPol.fmu' from t=0..1 with step size h=0.1, loggingOn=0, csv separator=',' log categories={ }

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff65257e2 in GC_find_limit_with_bound ()
   from /usr/local/openmodelica/lib/x86_64-linux-gnu/omc/libomcgc.so.1
Missing separate debuginfos, use: debuginfo-install atlas-3.8.4-2.el6.x86_64 blas-3.2.1-4.el6.x86_64 glibc-2.12-1.149.el6_6.7.x86_64 libxml2-2.7.6-17.el6_6.1.x86_64 zlib-1.2.3-29.el6.x86_64
(gdb) where
#0  0x00007ffff65257e2 in GC_find_limit_with_bound ()
   from /usr/local/openmodelica/lib/x86_64-linux-gnu/omc/libomcgc.so.1
#1  0x00007ffff65258e2 in GC_init_linux_data_start ()
   from /usr/local/openmodelica/lib/x86_64-linux-gnu/omc/libomcgc.so.1
#2  0x00007ffff6524352 in GC_init ()
   from /usr/local/openmodelica/lib/x86_64-linux-gnu/omc/libomcgc.so.1
#3  0x00007ffff651e809 in GC_generic_malloc_inner ()
   from /usr/local/openmodelica/lib/x86_64-linux-gnu/omc/libomcgc.so.1
#4  0x00007ffff651e8ce in GC_generic_malloc ()
   from /usr/local/openmodelica/lib/x86_64-linux-gnu/omc/libomcgc.so.1
#5  0x00007ffff7678f87 in fmi2Instantiate ()
   from fmuTmpceAftN/binaries/linux64/VanDerPol.so
#6  0x00000000004024ae in simulate (fmu=0x616a60, tEnd=1, h=0.10000000000000001,
    loggingOn=0, separator=44 ',', nCategories=0, categories=0x0)
    at model_exchange/main.c:75
#7  0x0000000000403139 in main (argc=2, argv=0x7fffffffe5a8) at model_exchange/main.c:275
(gdb) down
Bottom (innermost) frame selected; you cannot go down.
(gdb) up
#1  0x00007ffff65258e2 in GC_init_linux_data_start ()
   from /usr/local/openmodelica/lib/x86_64-linux-gnu/omc/libomcgc.so.1
(gdb) 
#2  0x00007ffff6524352 in GC_init ()
   from /usr/local/openmodelica/lib/x86_64-linux-gnu/omc/libomcgc.so.1
(gdb) 
#3  0x00007ffff651e809 in GC_generic_malloc_inner ()
   from /usr/local/openmodelica/lib/x86_64-linux-gnu/omc/libomcgc.so.1
(gdb) 
#4  0x00007ffff651e8ce in GC_generic_malloc ()
   from /usr/local/openmodelica/lib/x86_64-linux-gnu/omc/libomcgc.so.1
(gdb) 
#5  0x00007ffff7678f87 in fmi2Instantiate ()
   from fmuTmpceAftN/binaries/linux64/VanDerPol.so
(gdb) 
#6  0x00000000004024ae in simulate (fmu=0x616a60, tEnd=1, h=0.10000000000000001,
    loggingOn=0, separator=44 ',', nCategories=0, categories=0x0)
    at model_exchange/main.c:75
75          c = fmu->instantiate(instanceName, fmi2ModelExchange, guid, fmuResourceLocation,
(gdb) q
A debugging session is active.

        Inferior 1 [process 12872] will be killed.

Quit anyway? (y or n) y
[cxh@terra VanDerPol]$ 

Change History (1)

comment:1 Changed 9 years ago by sjoelund.se

  • Cc adeas31 wbraun added

This is still an issue. It seems that the simulation finishes successfully, and then calls instantiate again, which causes libgc to try to initialize once again. And causes the seg.fault.

Note: See TracTickets for help on using tickets.