Opened 7 years ago

Last modified 7 years ago

#4893 new defect

ligc segfault at fmiInstantiateModel

Reported by: simon.zeni@… Owned by: Lennart Ochel
Priority: high Milestone: Future
Component: Code Generation Version: v1.13.0-dev-nightly
Keywords: SIGSEGV, libgc, c, fmi1 Cc:

Description

Hi,

I'm using fmi version 1 with the C simulation runtime, and for a specific FMU there is a SIGSEGV thrown when instantiating the model.

Here's the GDB stacktrace

(gdb) bt
#0  0xabfc366d in GC_find_limit_with_bound (p=0x81a0604 "", up=0, bound=0x0) at os_dep.c:966
#1  0xabfc373f in GC_find_limit (p=0x81a0604 "", up=0) at os_dep.c:978
#2  0xabfc37c0 in GC_init_linux_data_start () at os_dep.c:463
#3  0xabfc1799 in GC_init () at misc.c:1159
#4  0xabfbb76c in GC_generic_malloc_inner (lb=0, k=2) at malloc.c:125
#5  0xabfbb809 in GC_generic_malloc (lb=0, k=2) at malloc.c:196
#6  0xabfbbb69 in GC_generic_malloc_uncollectable (lb=<value optimized out>, k=2) at malloc.c:319
#7  0xabfbbc05 in GC_malloc_uncollectable (lb=0) at malloc.c:351
#8  0xaf881d19 in initializeDataStruc (data=0x83bf078, threadData=0x83bf410) at simulation/solver/model_help.c:903
#9  0xac4de7ec in GENSAL_fmiInstantiateModel (instanceName=<value optimized out>, GUID=<value optimized out>, functions=..., loggingOn=76 'L')
    at include/fmi1/fmu1_model_interface.c:189
(gdb) frame 0
#0  0xabfc366d in GC_find_limit_with_bound (p=0x81a0604 "", up=0, bound=0x0) at os_dep.c:966
966                     GC_noop1((word)(*result));
(gdb) print result
$5 = (volatile ptr_t) 0x8047f00 <Address 0x8047f00 out of bounds>
(gdb) frame 8
#8  0xaf881d19 in initializeDataStruc (data=0x83bf078, threadData=0x83bf410) at simulation/solver/model_help.c:903
903         tmpSimData.stringVars = (modelica_string*) omc_alloc_interface.malloc_uncollectable(data->modelData->nVariablesString * sizeof(modelica_string));
(gdb) info locals
tmpSimData = {timeValue = 0, realVars = 0x83bf500, integerVars = 0x83bef30, booleanVars = 0x83b99a0 "", stringVars = 0x0, inlineVars = 0x0}
i = <value optimized out>
(gdb) print data->modelData->nVariablesString
$6 = 0

Link the the function https://github.com/ivmai/bdwgc/blob/master/os_dep.c#L982

This model has only one string parameter, yet data->modelData->nVariablesString is 0.

I cannot test the c++ runtime because i'm using Centos 6.9 32 bits and cannot compile it due to boost errors.

Is this a known problem?

Thanks

Change History (1)

comment:1 by Martin Sjölund, 7 years ago

We don't really test FMI 1 much. Try using the static code target for FMUs though (especially if you use the latest version of the OM master branch); it does not use Boehm GC at all (and I think the default for the dynamic target changed to not use Boehm GC either).

Note: See TracTickets for help on using tickets.