problem when using "Calculate Velocity = Logical True"

Clearly defined bug reports and their fixes
Post Reply
stoykov
Posts: 26
Joined: 11 May 2012, 13:18
Antispam: Yes

problem when using "Calculate Velocity = Logical True"

Post by stoykov »

Hello,

I am using Elmer version 6.1. on Ubuntu 64 bits. I have a problem when I use "Calculate Velocity = Logical True" in the Solution section. The velocity is written at the .ep file but the following error appears at the end of the program:

Code: Select all

ElmerSolver: *** Elmer Solver: ALL DONE ***
*** glibc detected *** ElmerSolver: double free or corruption (!prev): 0x00000000012ca1c0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7e626)[0x7fcec6ac4626]
/usr/lib/libelmersolver-6.1.so(__meshutils_MOD_releasevariablelist+0x6cf)[0x7fcec73b27c1]
/usr/lib/libelmersolver-6.1.so(__meshutils_MOD_releasemesh+0x22)[0x7fcec73b0b43]
/usr/lib/libelmersolver-6.1.so(+0x40cf3c)[0x7fcec7526f3c]
/usr/lib/libelmersolver-6.1.so(+0x409b76)[0x7fcec7523b76]
/usr/lib/libelmersolver-6.1.so(elmersolver_+0x291f)[0x7fcec7526b1d]
ElmerSolver[0x402107]
ElmerSolver[0x402425]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7fcec6a6776d]
ElmerSolver[0x401da9]
======= Memory map: ========
00400000-00404000 r-xp 00000000 08:01 3951581                            /usr/bin/ElmerSolver
00603000-00604000 r--p 00003000 08:01 3951581                            /usr/bin/ElmerSolver
00604000-00605000 rw-p 00004000 08:01 3951581                            /usr/bin/ElmerSolver
0117a000-01bfe000 rw-p 00000000 00:00 0                                  [heap]
7fcebfee0000-7fcec0457000 rw-p 00000000 00:00 0 
7fcec0457000-7fcec0483000 r-xp 00000000 08:01 793011                     /usr/lib/elmersolver-6.1/StressSolve.so
7fcec0483000-7fcec0682000 ---p 0002c000 08:01 793011                     /usr/lib/elmersolver-6.1/StressSolve.so
7fcec0682000-7fcec0683000 r--p 0002b000 08:01 793011                     /usr/lib/elmersolver-6.1/StressSolve.so
7fcec0683000-7fcec0684000 rw-p 0002c000 08:01 793011                     /usr/lib/elmersolver-6.1/StressSolve.so
7fcec0684000-7fcec0685000 rw-p 00000000 00:00 0 
7fcec0685000-7fcec068c000 r-xp 00000000 08:01 2490396                    /lib/x86_64-linux-gnu/librt-2.15.so
7fcec068c000-7fcec088b000 ---p 00007000 08:01 2490396                    /lib/x86_64-linux-gnu/librt-2.15.so
7fcec088b000-7fcec088c000 r--p 00006000 08:01 2490396                    /lib/x86_64-linux-gnu/librt-2.15.so
7fcec088c000-7fcec088d000 rw-p 00007000 08:01 2490396                    /lib/x86_64-linux-gnu/librt-2.15.so
7fcec088d000-7fcec08a3000 r-xp 00000000 08:01 2490596                    /lib/x86_64-linux-gnu/libz.so.1.2.3.4
7fcec08a3000-7fcec0aa2000 ---p 00016000 08:01 2490596                    /lib/x86_64-linux-gnu/libz.so.1.2.3.4
7fcec0aa2000-7fcec0aa3000 r--p 00015000 08:01 2490596                    /lib/x86_64-linux-gnu/libz.so.1.2.3.4
7fcec0aa3000-7fcec0aa4000 rw-p 00016000 08:01 2490596                    /lib/x86_64-linux-gnu/libz.so.1.2.3.4
7fcec0aa4000-7fcec0aa5000 r-xp 00000000 08:01 3951528                    /usr/lib/libscotcherr-5.1.so
7fcec0aa5000-7fcec0ca4000 ---p 00001000 08:01 3951528                    /usr/lib/libscotcherr-5.1.so
7fcec0ca4000-7fcec0ca5000 r--p 00000000 08:01 3951528                    /usr/lib/libscotcherr-5.1.so
7fcec0ca5000-7fcec0ca6000 rw-p 00001000 08:01 3951528                    /usr/lib/libscotcherr-5.1.so
7fcec0ca6000-7fcec0d07000 r-xp 00000000 08:01 3951529                    /usr/lib/libscotch-5.1.so
7fcec0d07000-7fcec0f06000 ---p 00061000 08:01 3951529                    /usr/lib/libscotch-5.1.so
7fcec0f06000-7fcec0f07000 r--p 00060000 08:01 3951529                    /usr/lib/libscotch-5.1.so
7fcec0f07000-7fcec0f0b000 rw-p 00061000 08:01 3951529                    /usr/lib/libscotch-5.1.so
7fcec0f0b000-7fcec0f0f000 r-xp 00000000 08:01 3951531                    /usr/lib/libesmumps-5.1.so
7fcec0f0f000-7fcec110e000 ---p 00004000 08:01 3951531                    /usr/lib/libesmumps-5.1.so
7fcec110e000-7fcec110f000 r--p 00003000 08:01 3951531                    /usr/lib/libesmumps-5.1.so
7fcec110f000-7fcec1110000 rw-p 00004000 08:01 3951531                    /usr/lib/libesmumps-5.1.so
7fcec1110000-7fcec1124000 r-xp 00000000 08:01 3951532                    /usr/lib/libpord_scotch-4.9.2.so
7fcec1124000-7fcec1323000 ---p 00014000 08:01 3951532                    /usr/lib/libpord_scotch-4.9.2.so
7fcec1323000-7fcec1324000 r--p 00013000 08:01 3951532                    /usr/lib/libpord_scotch-4.9.2.so
7fcec1324000-7fcec1325000 rw-p 00014000 08:01 3951532                    /usr/lib/libpord_scotch-4.9.2.so
7fcec1325000-7fcec132e000 r-xp 00000000 08:01 3951356                    /usr/lib/libamd.so.2.2.0
7fcec132e000-7fcec152d000 ---p 00009000 08:01 3951356                    /usr/lib/libamd.so.2.2.0
7fcec152d000-7fcec152e000 r--p 00008000 08:01 3951356                    /usr/lib/libamd.so.2.2.0
7fcec152e000-7fcec152f000 rw-p 00009000 08:01 3951356                    /usr/lib/libamd.so.2.2.0
7fcec152f000-7fcec1536000 r-xp 00000000 08:01 3951538                    /usr/lib/libmpiseq_scotch-4.9.2.so
7fcec1536000-7fcec1735000 ---p 00007000 08:01 3951538                    /usr/lib/libmpiseq_scotch-4.9.2.so
7fcec1735000-7fcec1736000 r--p 00006000 08:01 3951538                    /usr/lib/libmpiseq_scotch-4.9.2.so
7fcec1736000-7fcec1737000 rw-p 00007000 08:01 3951538                    /usr/lib/libmpiseq_scotch-4.9.2.so
7fcec1737000-7fcec1772000 r-xp 00000000 08:01 3951534                    /usr/lib/libmumps_common_scotch-4.9.2.so
7fcec1772000-7fcec1971000 ---p 0003b000 08:01 3951534                    /usr/lib/libmumps_common_scotch-4.9.2.so
7fcec1971000-7fcec1972000 r--p 0003a000 08:01 3951534                    /usr/lib/libmumps_common_scotch-4.9.2.so
7fcec1972000-7fcec1973000 rw-p 0003b000 08:01 3951534                    /usr/lib/libmumps_common_scotch-4.9.2.so
7fcec1973000-7fcec1974000 rw-p 00000000 00:00 0 
7fcec1974000-7fcec198c000 r-xp 00000000 08:01 2490410                    /lib/x86_64-linux-gnu/libpthread-2.15.so
7fcec198c000-7fcec1b8b000 ---p 00018000 08:01 2490410                    /lib/x86_64-linux-gnu/libpthread-2.15.so
7fcec1b8b000-7fcec1b8c000 r--p 00017000 08:01 2490410                    /lib/x86_64-linux-gnu/libpthread-2.15.so
7fcec1b8c000-7fcec1b8d000 rw-p 00018000 08:01 2490410                    /lib/x86_64-linux-gnu/libpthread-2.15.so
7fcec1b8d000-7fcec1b91000 rw-p 00000000 00:00 0 
7fcec1b91000-7fcec1b93000 r-xp 00000000 08:01 2490403                    /lib/x86_64-linux-gnu/libutil-2.15.so
7fcec1b93000-7fcec1d92000 ---p 00002000 08:01 2490403                    /lib/x86_64-linux-gnu/libutil-2.15.so
7fcec1d92000-7fcec1d93000 r--p 00001000 08:01 2490403                    /lib/x86_64-linux-gnu/libutil-2.15.so
7fcec1d93000-7fcec1d94000 rw-p 00002000 08:01 2490403                    /lib/x86_64-linux-gnu/libutil-2.15.so
7fcec1d94000-7fcec1dab000 r-xp 00000000 08:01 2490394                    /lib/x86_64-linux-gnu/libnsl-2.15.so
7fcec1dab000-7fcec1faa000 ---p 00017000 08:01 2490394                    /lib/x86_64-linux-gnu/libnsl-2.15.so
7fcec1faa000-7fcec1fab000 r--p 00016000 08:01 2490394                    /lib/x86_64-linux-gnu/libnsl-2.15.so
7fcec1fab000-7fcec1fac000 rw-p 00017000 08:01 2490394                    /lib/x86_64-linux-gnu/libnsl-2.15.so
7fcec1fac000-7fcec1fae000 rw-p 00000000 00:00 0 
7fcec1fae000-7fcec1ffe000 r-xp 00000000 08:01 4462173                    /usr/lib/openmpi/lib/libopen-pal.so.0.0.0
7fcec1ffe000-7fcec21fe000 ---p 00050000 08:01 4462173                    /usr/lib/openmpi/lib/libopen-pal.so.0.0.0
7fcec21fe000-7fcec21ff000 r--p 00050000 08:01 4462173                    /usr/lib/openmpi/lib/libopen-pal.so.0.0.0
7fcec21ff000-7fcec2201000 rw-p 00051000 08:01 4462173                    /usr/lib/openmpi/lib/libopen-pal.so.0.0.0
7fcec2201000-7fcec2205000 rw-p 00000000 00:00 0 
7fcec2205000-7fcec224e000 r-xp 00000000 08:01 4462174                    /usr/lib/openmpi/lib/libopen-rte.so.0.0.0
7fcec224e000-7fcec244e000 ---p 00049000 08:01 4462174                    /usr/lib/openmpi/lib/libopen-rte.so.0.0.0
7fcec244e000-7fcec244f000 r--p 00049000 08:01 4462174                    /usr/lib/openmpi/lib/libopen-rte.so.0.0.0
7fcec244f000-7fcec2451000 rw-p 0004a000 08:01 4462174                    /usr/lib/openmpi/lib/libopen-rte.so.0.0.0
7fcec2451000-7fcec2453000 rw-p 00000000 00:00 0 
7fcec2453000-7fcec24e8000 r-xp 00000000 08:01 4462169                    /usr/lib/openmpi/lib/libmpi.so.0.0.2
7fcec24e8000-7fcec26e8000 ---p 00095000 08:01 4462169                    /usr/lib/openmpi/lib/libmpi.so.0.0.2
7fcec26e8000-7fcec26e9000 r--p 00095000 08:01 4462169                    /usr/lib/openmpi/lib/libmpi.so.0.0.2
7fcec26e9000-7fcec26fa000 rw-p 00096000 08:01 4462169                    /usr/lib/openmpi/lib/libmpi.so.0.0.2
7fcec26fa000-7fcec2704000 rw-p 00000000 00:00 0 
7fcec2704000-7fcec273c000 r-xp 00000000 08:01 3951508                    /usr/lib/libHYPRE_Euclid-2.4.0.so
7fcec273c000-7fcec293b000 ---p 00038000 08:01 3951508                    /usr/lib/libHYPRE_Euclid-2.4.0.so
7fcec293b000-7fcec293c000 r--p 00037000 08:01 3951508                    /usr/lib/libHYPRE_Euclid-2.4.0.so
7fcec293c000-7fcec293d000 rw-p 00038000 08:01 3951508                    /usr/lib/libHYPRE_Euclid-2.4.0.so
7fcec293d000-7fcec2947000 rw-p 00000000 00:00 0 
7fcec2947000-7fcec2957000 r-xp 00000000 08:01 3951517                    /usr/lib/libHYPRE_ParaSails-2.4.0.so
7fcec2957000-7fcec2b56000 ---p 00010000 08:01 3951517                    /usr/lib/libHYPRE_ParaSails-2.4.0.so
7fcec2b56000-7fcec2b57000 r--p 0000f000 08:01 3951517                    /usr/lib/libHYPRE_ParaSails-2.4.0.so
7fcec2b57000-7fcec2b58000 rw-p 00010000 08:01 3951517                    /usr/lib/libHYPRE_ParaSails-2.4.0.so
7fcec2b58000-7fcec2b67000 r-xp 00000000 08:01 3951507                    /usr/lib/libHYPRE_DistributedMatrixPilutSolver-2.4.0.so
7fcec2b67000-7fcec2d66000 ---p 0000f000 08:01 3951507                    /usr/lib/libHYPRE_DistributedMatrixPilutSolver-2.4.0.so
7fcec2d66000-7fcec2d67000 r--p 0000e000 08:01 3951507                    /usr/lib/libHYPRE_DistributedMatrixPilutSolver-2.4.0.so
7fcec2d67000-7fcec2d68000 rw-p 0000f000 08:01 3951507                    /usr/lib/libHYPRE_DistributedMatrixPilutSolver-2.4.0.so
7fcec2d68000-7fcec2d69000 r-xp 00000000 08:01 3951514                    /usr/lib/libHYPRE_MatrixMatrix-2.4.0.so
7fcec2d69000-7fcec2f68000 ---p 00001000 08:01 3951514                    /usr/lib/libHYPRE_MatrixMatrix-2.4.0.so
7fcec2f68000-7fcec2f69000 r--p 00000000 08:01 3951514                    /usr/lib/libHYPRE_MatrixMatrix-2.4.0.so
7fcec2f69000-7fcec2f6a000 rw-p 00001000 08:01 3951514                    /usr/lib/libHYPRE_MatrixMatrix-2.4.0.soAborted (core dumped)
Can someone tell me what is wrong, is it a problem of Ubuntu or of Elemer?

Regards,
Stan
raback
Site Admin
Posts: 4841
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: problem when using "Calculate Velocity = Logical True"

Post by raback »

Hi Stan

Probably it is Elmer. I would guess that the problem is in deallocating the created variables. The Velocity uses for certain time integration models an existing column of the PrevValues table. My guess is that this is not properly tested for and deallocation is attempted twice. Deallocating is more vital when Elmer is used as a library but normally the bug is just a matter of beauty. Still, it should be corrected. If you have a small case you could attach it here.

-Peter
stoykov
Posts: 26
Joined: 11 May 2012, 13:18
Antispam: Yes

Re: problem when using "Calculate Velocity = Logical True"

Post by stoykov »

Hi Peter,

Here is attached the small example. It presents a cantilever beam excited with harmonic force on the free edge. I compared the results with Timoshenko beam model and they are in agreement.

Thank you for your help!

Best regards,
Stan
Attachments
beam3d.grd
(740 Bytes) Downloaded 441 times
caseS.sif
(1.47 KiB) Downloaded 473 times
rgladstone
Posts: 64
Joined: 15 Apr 2013, 16:23
Antispam: Yes

Re: problem when using "Calculate Velocity = Logical True"

Post by rgladstone »

Hi Peter and co, I wonder if anyone has had a chance to look into this? I have a more-or-less identical problem, though the setup posted above is a smaller one, and so is perhaps more convenient for debugging purposes.

I've run the above setup with a recent Elmer checkout, compiled with debug flags and run through gdb. I get the same error. The stack looks like this:

Code: Select all

#0  0x00007ffff6dee425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff6df1b8b in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007ffff6e2c39e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3  0x00007ffff6e36b96 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x00007ffff77cfa70 in meshutils::releasevariablelist (variablelist=0x724430) at MeshUtils.f90:9749
#5  0x00007ffff77cddf2 in meshutils::releasemesh (mesh=0x7026b0) at MeshUtils.f90:9800
#6  0x00007ffff7a648d0 in freemesh (mesh=0x7026b0) at ElmerSolver.f90:1970
#7  0x00007ffff7a60fce in freemodel (model=0x631160) at ElmerSolver.f90:2025
#8  0x00007ffff7a6448b in elmersolver (initialize=0) at ElmerSolver.f90:681
#9  0x0000000000402f72 in solver () at Solver.f90:271
#10 0x0000000000403290 in main (argc=1, argv=0x7fffffffe2a9) at Solver.f90:247
#11 0x00007ffff6dd976d in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6
#12 0x0000000000402c19 in _start ()
The offending line in meshutils::releasevariablelist looks like this:

Code: Select all

         IF ( ASSOCIATED( Var % Values ) ) &
            DEALLOCATE( Var % Values )
The offending variable appears to be displacement velocity:

Code: Select all

(gdb) frame 4
#4  0x00007ffff77cfa70 in meshutils::releasevariablelist (variablelist=0x724430) at MeshUtils.f90:9749
9749	            DEALLOCATE( Var % Values )
(gdb) print Var % Name
$1 = 'displacement velocity', ' ' <repeats 107 times>
If my understanding of pointers in fortran is ok, then this must mean Var%values is undefined. The standard doesn't indicate what the associated function should return on an undefined pointer, so the compiler returning true in this case is allowed. I am pretty sure the pointers get defined ok early in the code, so my best guess is that a pointer has been left dangling by deallocation of its target via a different pointer. But I am a little out of my depth here, and I'm not sure how best to follow this up. Could two pointers point to the same target in Elmer, and could the target get deallocated by one without nulllifying the other? Having said that, I can't see any problem with the subroutine in question... anyone have insight into this?

Note that I am running on Ubuntu Linux in VMware with a windows host. I am using the gfortran compilers.

Cheers,
Rupert
Post Reply