meshpy icon indicating copy to clipboard operation
meshpy copied to clipboard

mesh build crash

Open JaniKallankari opened this issue 8 years ago • 5 comments

I'm using windows:MeshPy‑2016.1.2+unstable‑cp35‑cp35m‑win_amd64.whl. Following code crash python:

from meshpy.tet import MeshInfo, build mesh_info = MeshInfo() mesh_info.set_points([(0,0,0), (2,0,0), (2,2,0)]) mesh_info.set_facets([[0,1,2]]) mesh = build(mesh_info)

What I'm doing wrong?

JaniKallankari avatar Apr 23 '17 15:04 JaniKallankari

Can you provide a backtrace?

inducer avatar Apr 23 '17 17:04 inducer

Ubuntu 16.04 and new meshpy from git same problem, segment fault. Could you provide instructions how to get backtrace? If you have everything setup it might be faster that you try out those five lines though.

JaniKallankari avatar Apr 23 '17 18:04 JaniKallankari

The crash is in tetgenmesh::orient3dfast when indexing pd[0], which is not valid. The tetgenmesh::incrementaldelaunay passes permutarray[i] with i=3 to tetgenmesh::orient3dfast, but permutarray is only allocated for 3 points.

 	_tetgen.cp36-win_amd64.pyd!tetgenmesh::orient3dfast(double * pa, double * pb, double * pc, double * pd) Line 6308	C++
>	_tetgen.cp36-win_amd64.pyd!tetgenmesh::incrementaldelaunay(long & tv) Line 11666	C++
 	_tetgen.cp36-win_amd64.pyd!tetrahedralize(tetgenbehavior * b, tetgenio * in, tetgenio * out, tetgenio * addin, tetgenio * bgmin) Line 30901	C++
 	_tetgen.cp36-win_amd64.pyd!`anonymous namespace'::tetrahedralizeWrapper(tetgenbehavior & bhv, `anonymous-namespace'::tMeshInfo & in, `anonymous-namespace'::tMeshInfo & out, `anonymous-namespace'::tMeshInfo * addin) Line 220	C++
 	_tetgen.cp36-win_amd64.pyd!boost::python::detail::invoke<int,void (__cdecl*)(tetgenbehavior & __ptr64,`anonymous namespace'::tMeshInfo & __ptr64,`anonymous namespace'::tMeshInfo & __ptr64,A0xd08dc9b3::tMeshInfo * __ptr64),boost::python::arg_from_python<tetgenbehavior & __ptr64>,boost::python::arg_from_python<`anonymous namespace'::tMeshInfo & __ptr64>,boost::python::arg_from_python<`anonymous namespace'::tMeshInfo & __ptr64>,boost::python::arg_from_python<`anonymous namespace'::tMeshInfo * __ptr64> >(boost::python::detail::invoke_tag_<1,0> __formal, const int & __formal, void(*)(tetgenbehavior &, `anonymous-namespace'::tMeshInfo &, `anonymous-namespace'::tMeshInfo &, `anonymous-namespace'::tMeshInfo *) & f, boost::python::arg_from_python<tetgenbehavior &> & ac0, boost::python::arg_from_python<`anonymous namespace'::tMeshInfo &> & ac1, boost::python::arg_from_python<`anonymous namespace'::tMeshInfo &> & ac2, boost::python::arg_from_python<`anonymous namespace'::tMeshInfo *> & ac3) Line 82	C++
 	_tetgen.cp36-win_amd64.pyd!boost::python::detail::caller_arity<4>::impl<void (__cdecl*)(tetgenbehavior & __ptr64,`anonymous namespace'::tMeshInfo & __ptr64,`anonymous namespace'::tMeshInfo & __ptr64,A0xd08dc9b3::tMeshInfo * __ptr64),boost::python::default_call_policies,boost::mpl::vector5<void,tetgenbehavior & __ptr64,`anonymous namespace'::tMeshInfo & __ptr64,A0xd08dc9b3::tMeshInfo & __ptr64,A0xd08dc9b3::tMeshInfo * __ptr64> >::operator()(_object * args_, _object * __formal) Line 218	C++
 	_tetgen.cp36-win_amd64.pyd!boost::python::objects::caller_py_function_impl<boost::python::detail::caller<void (__cdecl*)(tetgenbehavior & __ptr64,`anonymous namespace'::tMeshInfo & __ptr64,`anonymous namespace'::tMeshInfo & __ptr64,A0xd08dc9b3::tMeshInfo * __ptr64),boost::python::default_call_policies,boost::mpl::vector5<void,tetgenbehavior & __ptr64,`anonymous namespace'::tMeshInfo & __ptr64,A0xd08dc9b3::tMeshInfo & __ptr64,A0xd08dc9b3::tMeshInfo * __ptr64> > >::operator()(_object * args, _object * kw) Line 39	C++

cgohlke avatar Apr 25 '17 20:04 cgohlke

@cgohlke, thanks for tracking that down! That looks like an upstream (TetGen) bug. I've emailed Hang Si.

inducer avatar Apr 25 '17 22:04 inducer

Great to see some progress. This was not only happening with this tiny point data set. I did find some other data sets also caused crashing too.

JaniKallankari avatar Apr 26 '17 20:04 JaniKallankari