infinite loop with memory leak using OCCT (not OCE)
Using the original OCCT library (not OCE, which works fine) I found an infinite loop that leaks all the memory with the attached STEP file (which does not seem to be very complex) and .geo file:
When compiling the latest git source against OCE, the problem does not apepar. When using OCCT, once Gmsh calls OCC_Internals::makeFaceSTL
from Geo/GModelIO_OCC.cpp:3865
the stack goes up to other OCCT internals and apparently fails when waiting to threaded mutexes (even though I think I did not enable OpenMP in CMake). The binary versions provided in the Gmsh page (at least 3.0.7-git-0ff7b634
) also show the same problem.
See a gdb
session from a compiled with debugging symbols binary:
$ gmsh --version
3.0.7-git-531917b22
$ gdb --args gmsh -2 mesh.geo
GNU gdb (Debian 7.12-6+b2) 7.12.0.20161007-git
Copyright (C) 2016 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-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from gmsh...done.
(gdb) run
Starting program: /home/gtheler/bin/gmsh -2 mesh.geo
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe6fd3700 (LWP 27214)]
[New Thread 0x7fffe67d2700 (LWP 27215)]
[New Thread 0x7fffe1fd1700 (LWP 27216)]
[New Thread 0x7fffdf7d0700 (LWP 27217)]
[New Thread 0x7fffdcfcf700 (LWP 27218)]
[New Thread 0x7fffdc7ce700 (LWP 27219)]
[New Thread 0x7fffd9fcd700 (LWP 27220)]
Info : Running '/home/gtheler/bin/gmsh -2 mesh.geo' [Gmsh 3.0.7-git-531917b22, 1 node, max. 1 thread]
Info : Started on Thu Jun 28 16:15:36 2018
Info : Reading 'mesh.geo'...
[...]
Info : Meshing surface 21 (Plane, Frontal)
Info : Meshing surface 22 (Plane, Frontal)
Info : Meshing surface 23 (Cylinder, Frontal)
^Z
Thread 1 "gmsh" received signal SIGTSTP, Stopped (user).
0x00007ffff402b868 in do_sincos_1 (shift_quadrant=false, n=<optimized out>, x=3.1219181705880814, da=1.0340365963588241e-18,
a=0.019674483001711828) at ../sysdeps/ieee754/dbl-64/s_sin.c:340
340 ../sysdeps/ieee754/dbl-64/s_sin.c: No such file or directory.
(gdb) where
#0 0x00007ffff402b868 in do_sincos_1 (shift_quadrant=false, n=<optimized out>, x=3.1219181705880814, da=1.0340365963588241e-18,
a=0.019674483001711828) at ../sysdeps/ieee754/dbl-64/s_sin.c:340
#1 __sincos (x=3.1219181705880814, sinx=0x7fffffffc328, cosx=0x7fffffffc320) at ../sysdeps/ieee754/dbl-64/s_sincos.c:84
#2 0x00007fffedbbb7a6 in ElSLib::CylinderD0(double, double, gp_Ax3 const&, double, gp_Pnt&) () from /usr/local/lib/libTKMath.so.7
#3 0x00007ffff0477cf2 in BRepMesh_FastDiscretFace::insertInternalVerticesCylinder(NCollection_List<BRepMesh_Vertex>&) ()
from /usr/local/lib/libTKMesh.so.7
#4 0x00007ffff047e8b5 in BRepMesh_FastDiscretFace::insertInternalVertices(BRepMesh_Delaun&) () from /usr/local/lib/libTKMesh.so.7
#5 0x00007ffff04809c1 in BRepMesh_FastDiscretFace::add(opencascade::handle<BRepMesh_FaceAttribute> const&) ()
from /usr/local/lib/libTKMesh.so.7
#6 0x00007ffff0481ad9 in BRepMesh_FastDiscretFace::Perform(opencascade::handle<BRepMesh_FaceAttribute> const&) ()
from /usr/local/lib/libTKMesh.so.7
#7 0x00007ffff0472225 in BRepMesh_FastDiscret::Process(TopoDS_Face const&) const () from /usr/local/lib/libTKMesh.so.7
#8 0x00007ffff04748be in BRepMesh_FastDiscret::Perform(TopoDS_Shape const&) () from /usr/local/lib/libTKMesh.so.7
#9 0x0000555555a6b232 in makeSTL (s=..., verticesUV=verticesUV@entry=0x55555697a588, verticesXYZ=verticesXYZ@entry=0x55555697a5a0,
normals=normals@entry=0x55555697a5b8, triangles=...) at /home/gtheler/codigos/3ros/build/gmsh/Geo/GModelIO_OCC.cpp:3779
#10 0x0000555555a6bd54 in OCC_Internals::makeFaceSTL (this=this@entry=0x5555568766f0, s=..., vertices_uv=..., vertices=...,
normals=..., triangles=...) at /home/gtheler/codigos/3ros/build/gmsh/Geo/GModelIO_OCC.cpp:3865
#11 0x00005555559f2eed in OCCFace::buildSTLTriangulation (this=0x55555697a0c0, force=<optimized out>)
at /home/gtheler/codigos/3ros/build/gmsh/Geo/OCCFace.cpp:410
#12 0x00005555559f36e2 in OCCFace::containsParam (this=0x55555697a0c0, pt=...)
at /home/gtheler/codigos/3ros/build/gmsh/Geo/OCCFace.cpp:442
#13 0x0000555555be4ccb in optimalPointFrontalB (gf=gf@entry=0x55555697a0c0, worst=worst@entry=0x555556eb85d0,
active_edge=<optimized out>, data=..., newPoint=newPoint@entry=0x7fffffffd010, metric=metric@entry=0x7fffffffd020)
at /home/gtheler/codigos/3ros/build/gmsh/Mesh/meshGFaceDelaunayInsertion.cpp:1390
#14 0x0000555555be9fc7 in bowyerWatsonFrontal (gf=gf@entry=0x55555697a0c0, equivalence=equivalence@entry=0x0,
parametricCoordinates=parametricCoordinates@entry=0x0)
at /home/gtheler/codigos/3ros/build/gmsh/Mesh/meshGFaceDelaunayInsertion.cpp:1459
#15 0x0000555555bc7e8f in meshGenerator (gf=gf@entry=0x55555697a0c0, RECUR_ITER=RECUR_ITER@entry=0,
repairSelfIntersecting1dMesh=<optimized out>, onlyInitialMesh=<optimized out>, debug=<optimized out>,
replacement_edges=replacement_edges@entry=0x0) at /home/gtheler/codigos/3ros/build/gmsh/Mesh/meshGFace.cpp:1478
#16 0x0000555555bcd38a in meshGFace::operator() (this=this@entry=0x7fffffffdc76, gf=gf@entry=0x55555697a0c0, print=print@entry=true)
at /home/gtheler/codigos/3ros/build/gmsh/Mesh/meshGFace.cpp:2569
#17 0x00005555559d54b0 in GFace::mesh (this=0x55555697a0c0, verbose=true) at /home/gtheler/codigos/3ros/build/gmsh/Geo/GFace.cpp:1500
#18 0x0000555555bb503e in Mesh2D (m=<optimized out>) at /home/gtheler/codigos/3ros/build/gmsh/Mesh/Generator.cpp:453
#19 GenerateMesh (m=m@entry=0x55555685c2e0, ask=2) at /home/gtheler/codigos/3ros/build/gmsh/Mesh/Generator.cpp:1033
#20 0x0000555555a0be79 in GModel::mesh (this=this@entry=0x55555685c2e0, dimension=<optimized out>)
at /home/gtheler/codigos/3ros/build/gmsh/Geo/GModel.cpp:858
#21 0x0000555555879c72 in GmshBatch () at /home/gtheler/codigos/3ros/build/gmsh/Common/GmshGlobal.cpp:316
---Type <return> to continue, or q <return> to quit---
#22 0x000055555587a987 in GmshMainFLTK (argc=3, argv=0x7fffffffe088) at /home/gtheler/codigos/3ros/build/gmsh/Common/GmshGlobal.cpp:477
#23 0x00007fffec76ca87 in __libc_start_main (main=0x55555586c370 <main(int, char**)>, argc=3, argv=0x7fffffffe088,
init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe078) at ../csu/libc-start.c:310
#24 0x0000555555878e4a in _start ()
(gdb) quit
A debugging session is active.
Inferior 1 [process 27210] will be killed.
Again, when linking against OCE, Gmsh does not fail with these inputs.
BTW, I am writing this issue as Belgium leads 1-0 to England :-)