Segfault in flux solver on old input file

Clearly defined bug reports and their fixes
Post Reply
elmerUser
Posts: 21
Joined: 26 Mar 2010, 17:57

Segfault in flux solver on old input file

Post by elmerUser »

Hello,

Please find attached two SIF files. The first is a working sif file, and the second is the one that causes the crash. The one that crashed previously worked under the release revision.

The output of ElmerSolver electorstatic-crash.sif is

Code: Select all

blah
blah

ComputeChange: NS (ITER=3) (NRM,RELC): ( 0.90935729     0.21625704E-09 ) :: electrostatics
StatElecSolve:  Solve (s)             :   0.0000000000000000
StatElecSolve:  Result Norm   :   0.90935728663860727
StatElecSolve:  Relative Change :   2.16257039433936301E-010
StatElecSolve: 
ComputeChange: SS (ITER=1) (NRM,RELC): ( 0.90935729      2.0000000     ) :: electrostatics
FluxSolver: -------------------------------------
FluxSolver: Computing the flux
FluxSolver: -------------------------------------
Segmentation fault

The crash occurs in trunk/fem/src/FluxSolver.f90, on line 263 in revision 5010, due to the old flux variable being named "Flux Variable", which is now "Target Variable".

The VariableGet seems to fail, causing the member access FluxSol%Values to segfault. I am unsure exactly what should be being checked here; fortran is not my thing unfortunately.

The relevant valgrind output is:

==3014== Invalid read of size 4
==3014== at 0x8D77F31: fluxsolver_ (in /usr/local/elmer/share/elmersolver/lib/FluxSolver.so)
==3014== by 0x4FE1BCC: __mainutils_MOD_singlesolver (in /usr/local/elmer/lib/libelmersolver-6.1.so)
==3014== by 0x4FE200B: __mainutils_MOD_solveractivate (in /usr/local/elmer/lib/libelmersolver-6.1.so)
==3014== by 0x4FE27BC: solvecoupled.9333 (in /usr/local/elmer/lib/libelmersolver-6.1.so)
==3014== by 0x4FE4F1B: __mainutils_MOD_solveequations (in /usr/local/elmer/lib/libelmersolver-6.1.so)
==3014== by 0x50E327B: execsimulation.1937 (in /usr/local/elmer/lib/libelmersolver-6.1.so)
==3014== by 0x50E71D7: elmersolver_ (in /usr/local/elmer/lib/libelmersolver-6.1.so)
==3014== by 0x40123D: MAIN__ (in /usr/local/elmer/bin/ElmerSolver)
==3014== by 0x401C59: main (fmain.c:21)
==3014== Address 0x190 is not stack'd, malloc'd or (recently) free'd


Edit: Specify full path
Attachments
electrostatic-crash.sif
(2.54 KiB) Downloaded 362 times
electrostatic.sif
(2.55 KiB) Downloaded 404 times
raback
Site Admin
Posts: 4832
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Segfault in flux solver on old input file

Post by raback »

Hi

The use of the solver is nowadays slightly more elegant so you can scratch the following

Code: Select all

  Variable = -nooutput flux_e
  Flux Result Variable = String "F"
  Exported Variable 1 = "F[Electric Flux:3]"
and say

Code: Select all

  Calculate Flux = Logical True
Check Models Manual for details. I'm sorry for breaking the backward compatibity. The excuse is that the old formalism was out there for relatively short period and it was so terribly unintuitive.

-Peter
elmerUser
Posts: 21
Joined: 26 Mar 2010, 17:57

Re: Segfault in flux solver on old input file

Post by elmerUser »

Not too worried about the break in compat, thats what I get for using SVN. Is it possible to trap the segfault? It took me a while to track it down. My bad fortran is probably not helping me there..

Thanks for the conversion tips
Post Reply