cgg-bern / AlgoHex

GNU Affero General Public License v3.0
18 stars 6 forks source link

double free in the function: modify_frame_field #16

Open yanyiss opened 5 months ago

yanyiss commented 5 months ago

I'm not familiar with googletest, so I remark some lines about it in theCMakeLists.txt

option(ALGOHEX_BUILD_TESTS "Build AlgoHex unit tests" ${ALGOHEX_IS_ROOT}) if (ALGOHEX_BUILD_TESTS) enable_testing() add_subdirectory(tests) endif ()

Then I install some but not all libraries in the cmake output info and cmake .. make

and get the output: [100%] Linking CXX executable ../../Build/bin/LocalMeshabilityCheck [100%] Built target LocalMeshabilityCheck [100%] Linking CXX executable ../../Build/bin/HexMeshing [100%] Built target HexMeshing`

But when I execute HexMeshing: ./Build/bin/HexMeshing -i ../demo/HexMeshing/cylinder.ovm -o /path/to/cylinder_hex.ovm

I got `Invalid MIT-MAGIC-COOKIE-1 keyEnd of file reached while searching for input! ######## openvolumemesh info #########

vertices: 2275

edges: 13240

faces: 20730

cells: 9764

###################################### No prescribed feature tags found. Set boundary faces to feature faces and edges w.r.t. dihedral angle threshold 70 to feature edges.

Splitting w.r.t. feature...

Solving for Spherical Harmonic Coefficients...
Start Iterating...

iteration 0 energy: 2504.61 iteration 1 energy: 2420.9 iteration 2 energy: 2357.76 iteration 3 energy: 2301.51 iteration 4 energy: 2254.38 iteration 5 energy: 2219.42 iteration 6 energy: 2192.52 iteration 7 energy: 2168.09 iteration 8 energy: 2142.39 iteration 9 energy: 2115 iteration 10 energy: 2088.92 iteration 11 energy: 2065.17 iteration 12 energy: 2041.18 iteration 13 energy: 2016.73 iteration 14 energy: 1994.5 iteration 15 energy: 1974 iteration 16 energy: 1953.28 iteration 17 energy: 1932.3 iteration 18 energy: 1913.38 iteration 19 energy: 1898.31 iteration 20 energy: 1885.65 iteration 21 energy: 1873.34 iteration 22 energy: 1860.42 iteration 23 energy: 1847.87 iteration 24 energy: 1837.55 iteration 25 energy: 1829.46 iteration 26 energy: 1822.63 iteration 27 energy: 1816.38 iteration 28 energy: 1810.37 iteration 29 energy: 1804.42 iteration 30 energy: 1798.58 iteration 31 energy: 1793.04 iteration 32 energy: 1788.06 iteration 33 energy: 1783.64 iteration 34 energy: 1779.67 iteration 35 energy: 1776 iteration 36 energy: 1772.49 iteration 37 energy: 1769.1 iteration 38 energy: 1765.72 iteration 39 energy: 1762.37 iteration 40 energy: 1759.14 iteration 41 energy: 1756.18 iteration 42 energy: 1753.64 iteration 43 energy: 1751.58 iteration 44 energy: 1749.96 iteration 45 energy: 1748.69 iteration 46 energy: 1747.68 iteration 47 energy: 1746.86 iteration 48 energy: 1746.19 iteration 49 energy: 1745.67 iteration 50 energy: 1745.24 iteration 51 energy: 1744.86 iteration 52 energy: 1744.54 iteration 53 energy: 1744.27 iteration 54 energy: 1744.03 iteration 55 energy: 1743.84 iteration 56 energy: 1743.67 iteration 57 energy: 1743.51 iteration 58 energy: 1743.35 iteration 59 energy: 1743.2 iteration 60 energy: 1743.05 iteration 61 energy: 1742.9 iteration 62 energy: 1742.74 iteration 63 energy: 1742.57 iteration 64 energy: 1742.4 iteration 65 energy: 1742.18 iteration 66 energy: 1741.97 iteration 67 energy: 1741.71 iteration 68 energy: 1741.41 iteration 69 energy: 1741.08 iteration 70 energy: 1740.7 iteration 71 energy: 1740.27 iteration 72 energy: 1739.81 iteration 73 energy: 1739.35 iteration 74 energy: 1738.94 iteration 75 energy: 1738.6 iteration 76 energy: 1738.34 iteration 77 energy: 1738.17 iteration 78 energy: 1738.06 iteration 79 energy: 1737.96 iteration 80 energy: 1737.96 Stop iteration due to convergence after 80 of 500 iterations. Field generation 5892 ms, n = 3 ├ SpH Projection 191 ms, n = 81 ├ Linear system setup 2921 ms, n = 81 │ ├ Smoothness term 1739 ms, n = 81 │ ├ Normal constraints 254 ms, n = 81 │ ├ Full constraints 0 ms, n = 81 │ ├ Local linearisation 906 ms, n = 80 │ ╰ (unaccounted) 20 ms ├ Linear system solve 2639 ms, n = 81 ╰ (unaccounted) 140 ms

Generating singular graph...

splitting (edge length ratio: 0.6)... performed 691 edge split Performed 665 face split interpolating for cell quaternions... compute transitions... Tetmesh cells: 18237 Tetmesh faces: 37705 Tetmesh edges: 23612 Tetmesh vertices: 4145

Min/Max cell volume: 0.0003828471664531804108 / 5.437474463805225255. Min volume cell: 15890 Min/Max cell dihedral angle: 4.550134206201103204 / 170.7187337193283554 Max dihedral angle cell: 12682 Preprocessing quaternions... Checking face alignment error: Done! Done! compute transitions...

Preprocessing...

Fix misalignment at feature edges ...

Fix misalignment at feature face sectors ...

Pushing boundary singular edges which are not on feature arcs to interior ...

Removing singular triangles ...

Pipeline (Quaternion) iter 0 ...

Fixing local invalid at first stage...

Fix non-meshable footprint on ff ...

Fix complex singular edges non ff ...

########Fix invalid nodes on boundary... ########Fix invalid singular vertices on feature surface... ########Fix fully constrained parabolic sectors... ########Fix constrained zero sectors1... ########Push sgv to interior...

Fixed!

Min/Max cell volume: 0.0003828471664531804108 / 5.437474463805225255. Min volume cell: 15890 Min/Max cell volume: 0.00100063651835194823 / 5.437474463805225255. Min volume cell: 13248 ***** optimize via Newton (infeasible start version) with 1260 unknowns and 260 linear constraints (initial residuals r_primal = ||Ax-b||^2 = 0, r_dual = ||g+A^T nue||^2 = 59179.806486924223) using linear solver Umfpack double free or corruption (!prev)

[yanyisheshou:50812] Process received signal [yanyisheshou:50812] Signal: Aborted (6) [yanyisheshou:50812] Signal code: (-6) [yanyisheshou:50812] [ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0x14420)[0x7f9ae9d7f420] [yanyisheshou:50812] [ 1] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7f9ae982c00b] [yanyisheshou:50812] [ 2] /lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7f9ae980b859] [yanyisheshou:50812] [ 3] /lib/x86_64-linux-gnu/libc.so.6(+0x8d26e)[0x7f9ae987626e] [yanyisheshou:50812] [ 4] /lib/x86_64-linux-gnu/libc.so.6(+0x952fc)[0x7f9ae987e2fc] [yanyisheshou:50812] [ 5] /lib/x86_64-linux-gnu/libc.so.6(+0x96fac)[0x7f9ae987ffac] [yanyisheshou:50812] [ 6] /lib/x86_64-linux-gnu/libumfpack.so.5(umfdi_get_memory+0x158)[0x7f9aea356448] [yanyisheshou:50812] [ 7] /lib/x86_64-linux-gnu/libumfpack.so.5(umfdi_store_lu+0x8e5)[0x7f9aea3611c5] [yanyisheshou:50812] [ 8] /lib/x86_64-linux-gnu/libumfpack.so.5(umfdi_kernel+0x2d5)[0x7f9aea356bb5] [yanyisheshou:50812] [ 9] /lib/x86_64-linux-gnu/libumfpack.so.5(umfpack_di_numeric+0xccf)[0x7f9aea36443f] [yanyisheshou:50812] [10] /home/yanyisheshou/Program/AlgoHex/build/Build/lib/libCoMISo.so(_ZN6COMISO12NewtonSolver23numerical_factorizationERN5Eigen12SparseMatrixIdLi0EiEE+0x3ef)[0x7f9aea5c665f] [yanyisheshou:50812] [11] /home/yanyisheshou/Program/AlgoHex/build/Build/lib/libCoMISo.so(_ZN6COMISO12NewtonSolver9factorizeERKN5Eigen12SparseMatrixIdLi0EiEERKNS1_6MatrixIdLin1ELi1ELi0ELin1ELi1EEES5_S9_ddb+0x7c4)[0x7f9aea5c8254] [yanyisheshou:50812] [12] /home/yanyisheshou/Program/AlgoHex/build/Build/lib/libCoMISo.so(_ZN6COMISO12NewtonSolver22solve_infeasible_startEPNS_17NProblemInterfaceERKN5Eigen12SparseMatrixIdLi0EiEERKNS3_6MatrixIdLin1ELi1ELi0ELin1ELi1EEE+0xca4)[0x7f9aea5cc734] [yanyisheshou:50812] [13] ./Build/bin/HexMeshing(+0x356fde)[0x5574e7819fde] [yanyisheshou:50812] [14] ./Build/bin/HexMeshing(+0x35963b)[0x5574e781c63b] [yanyisheshou:50812] [15] ./Build/bin/HexMeshing(+0x35b9a0)[0x5574e781e9a0] [yanyisheshou:50812] [16] ./Build/bin/HexMeshing(+0xafa1a)[0x5574e7572a1a] [yanyisheshou:50812] [17] ./Build/bin/HexMeshing(+0x9e3e0)[0x5574e75613e0] [yanyisheshou:50812] [18] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7f9ae980d083] [yanyisheshou:50812] [19] ./Build/bin/HexMeshing(+0x9ed8e)[0x5574e7561d8e] [yanyisheshou:50812] End of error message I found "double free or corruption" occurs in the function: modify_frame_field in ./demo/HexMeshing/HexMeshing.cc It is also worth mentioning that I cmake without many libraries, like Mosek,MPI... Does this have anything to do with my program crashing? So do I have to install all the libraries in the cmake output info? Thanks for your help!

mheistermann commented 5 months ago

Hello! Thanks for your crash report, let's try to find out what's happening here.

First of all, it's not related to a lack of libraries, this is a memory corruption issue, most likely due to a simple bug (or possibly some library incompatibility).

Side note: Mosek and MPI are optional (for AlgoHex itself; dependencies may depend on MPI); most other libraries listed in CMake output are only things supported by our optimization library CoMISo, but not used in AlgoHex.

To resolve this issue, the sanitizers built into modern compilers will probably be the most helpful. Could you recompile with the following CMake options (either by running cmake with-Doption=value, or setting it in cmake-gui/ccmake) and see if more debug info is produced?

CMAKE_CXX_FLAGS="-fsanitize=address -fno-omit-frame-pointer"
CMAKE_EXE_LINKER_FLAGS="-fsanitize=address"
CMAKE_SHARED_LINKER_FLAGS="-fsanitize=address"

If you do get more output, consider also setting CMAKE_BUILD_TYPE=Debug; this will create a much slower program, but may give more valuable debug info. Would recommend a release build at first though to see if those sanitizer settings work (I'm going from memory here).