Opened 5 years ago

Last modified 3 years ago

#5672 assigned defect

segfaul after 'Invalid root' error in *_functions.c

Reported by: anonymous Owned by: Karim.Abdelhak
Priority: high Milestone:
Component: Code Generation Version:
Keywords: Cc:

Description

I received the following output from my call to the compiled model executable.

These results can be reproduced from the code at https://github.com/SolarTherm/SolarTherm.git in the 'particle' branch, at this commit:
https://github.com/SolarTherm/SolarTherm/commit/d532b6eeb9d9dfab1f24780e9745c120f3abc0c8

Obviously the modeller here (me) needs to ensure that functions being inverted don't lead to imaginary roots. However, there shouldn't need to be a segfault from such cases.

Using GDB, I was able to get a little more information on the location of the crash, see further below.

2 warnings generated.
/usr/bin/../lib/x86_64-linux-gnu/omc/libModelicaMatIO.a(ModelicaMatIO.o): In function `Mat_VarDelete':
(.text+0x1cb3): warning: the use of mktemp' is dangerous, better use mkstemp' or `mkdtemp'
assert | debug | PhysicalParticleSystem_functions.c:488: Invalid root: (-15169.2)(0.763767)
assert | debug | Solving non-linear system 977 failed at time=9040492.36941685.
| | | | For more information please use -lv LOG_NLS.

Limited backtrace at point of segmentation fault
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12890)[0x7f94c3c7a890]
/usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(solveNewton+0xcf)[0x7f94c51eff7b]
/usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(solveNLS+0xc3)[0x7f94c51d2613]
/usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(solve_nonlinear_system+0x2e9)[0x7f94c51d2b2b]
./PhysicalParticleSystem(PhysicalParticleSystem_eqFunction_977+0x7f)[0x41aa8a]
./PhysicalParticleSystem(PhysicalParticleSystem_functionDAE+0x496)[0x41d286]
/usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(updateDiscreteSystem+0x80)[0x7f94c51df3f4]
./PhysicalParticleSystem(PhysicalParticleSystem_performSimulation+0xc76)[0x417506]
/usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(solver_main+0x334)[0x7f94c51e6b5d]
/usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(+0x8466a)[0x7f94c520a66a]
/usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(startNonInteractiveSimulation+0xa16)[0x7f94c5209b2f]
/usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(_main_SimulationRuntime+0x72)[0x7f94c520bcbc]
./PhysicalParticleSystem(main+0x197)[0x41e191]
/lib/x86_64-linux-gnu/libc.so.6(libc_start_main+0xe7)[0x7f94c3898b97]
./PhysicalParticleSystem(_start+0x2a)[0x4167ca]
E
======================================================================
ERROR: test_sched (
main.TestPhysicalParticleSystem)


Traceback (most recent call last):

File "TestPhysicalParticleSystem.py", line 28, in test_sched

sim.simulate(start=0, stop='1y', step='5m',solver='dassl', nls='newton')

File "/home/john/.local/lib/python2.7/site-packages/solartherm/simulation.py", line 360, in simulate

sp.check_call(['./'+self.model] + sim_args + args)

File "/usr/lib/python2.7/subprocess.py", line 190, in check_call

raise CalledProcessError(retcode, cmd)

CalledProcessError: Command '['./PhysicalParticleSystem', '-override', 'startTime=0.0,stopTime=31536000.0,stepSize=300.0', '-s', 'dassl', '-lv', '-LOG_SUCCESS,-stdout', '-f', 'PhysicalParticleSystem_init.xml', '-r', 'PhysicalParticleSystem_res.mat', '-nls', 'newton']' returned non-zero exit status -11


Ran 1 test in 10.996s

GDB output:

Thread 1 "PhysicalParticl" received signal SIGSEGV, Segmentation fault.
0x00007ffff7951f7b in solveNewton () from /usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so
(gdb) where
#0 0x00007ffff7951f7b in solveNewton () from /usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so
#1 0x00007ffff7934613 in solveNLS () from /usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so
#2 0x00007ffff7934b2b in solve_nonlinear_system () from /usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so
#3 0x000000000041aa8a in PhysicalParticleSystem_eqFunction_977 ()
#4 0x000000000041d286 in PhysicalParticleSystem_functionDAE ()
#5 0x00007ffff79413f4 in updateDiscreteSystem () from /usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so
#6 0x0000000000417506 in PhysicalParticleSystem_performSimulation ()
#7 0x00007ffff7948b5d in solver_main () from /usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so
#8 0x00007ffff796c66a in ?? () from /usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so
#9 0x00007ffff796bb2f in startNonInteractiveSimulation () from /usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so
#10 0x00007ffff796dcbc in _main_SimulationRuntime () from /usr/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so
#11 0x000000000041e191 in main ()
(gdb)

Change History (5)

comment:1 Changed 5 years ago by casella

  • Milestone changed from Future to 1.16.0

comment:2 Changed 5 years ago by casella

  • Owner changed from lochel to Karim.Abdelhak
  • Status changed from new to assigned

comment:3 Changed 4 years ago by casella

  • Milestone changed from 1.16.0 to 1.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:4 Changed 3 years ago by casella

  • Milestone changed from 1.17.0 to 1.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:5 Changed 3 years ago by casella

  • Milestone 1.18.0 deleted

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.