UG4 / ugcore

The core functionality of UG4. Includes sources, build-scripts, and utility scripts.
https://github.com/UG4/ugcore
Other
36 stars 23 forks source link

ResolveTriangleIntersection(...) segfault #40

Open stephanmg opened 3 years ago

stephanmg commented 3 years ago

For some of my triangular geometries the ResolveTriangleIntersections(...) function segfaults within ug (HEAD). However using the same parameters for the function in ProMesh 4.3.18 works fine.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff5bfa9f8 in ug::ntree<3, 3, ug::Face*, ug::NTreeGridData<3> >::update_loose_bounding_box(ug::ntree<3, 3, ug::Face*, ug::NTreeGridData<3> >::Node&) ()
   from /home/stephan/Code/git/ug4/ugcore/cmake/../../lib/libug4.so
(gdb) bt
#0  0x00007ffff5bfa9f8 in ug::ntree<3, 3, ug::Face*, ug::NTreeGridData<3> >::update_loose_bounding_box(ug::ntree<3, 3, ug::Face*, ug::NTreeGridData<3> >::Node&)
    () from /home/stephan/Code/git/ug4/ugcore/cmake/../../lib/libug4.so
#1  0x00007ffff5bfe5cd in ug::ntree<3, 3, ug::Face*, ug::NTreeGridData<3> >::rebalance() () from /home/stephan/Code/git/ug4/ugcore/cmake/../../lib/libug4.so
#2  0x00007ffff288e8a5 in bool ug::ResolveTriangleIntersections<ug::Attachment<ug::MathVector<3ul, double> > >(ug::Grid&, ug::GenericGridObjectIterator<ug::Triangle*, ug::AttachedElementListIterator<ug::AttachmentAccessor<ug::Face*, ug::Attachment<ug::AttachedElementList<ug::AttachmentPipe<ug::Face*, ug::ElementStorage<ug::Face> > >::Entry>, ug::ElementStorage<ug::Face> > > >, ug::GenericGridObjectIterator<ug::Triangle*, ug::AttachedElementListIterator<ug::AttachmentAccessor<ug::Face*, ug::Attachment<ug::AttachedElementList<ug::AttachmentPipe<ug::Face*, ug::ElementStorage<ug::Face> > >::Entry>, ug::ElementStorage<ug::Face> > > >, double, ug::Attachment<ug::MathVector<3ul, double> >&) [clone .constprop.2097] () from /home/stephan/Code/git/ug4/bin/../bin/plugins/libneuro_collection.so
#3  0x00007ffff289a835 in ug::neuro_collection::test_import_swc_general_var_for_vr_var(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, double, bool, double, unsigned long, bool, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double) () from /home/stephan/Code/git/ug4/bin/../bin/plugins/libneuro_collection.so
#4  0x00007ffff25b7fbc in ug::bridge::FunctionProxy<void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, double, bool, double, unsigned long, bool, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double), void>::apply(void*, ug::bridge::ParameterStack const&, ug::bridge::ParameterStack&) () from /home/stephan/Code/git/ug4/bin/../bin/plugins/libneuro_collection.so                    
#5  0x00007ffff481dee1 in ug::bridge::lua::LuaProxyFunction(lua_State*) () from /home/stephan/Code/git/ug4/ugcore/cmake/../../lib/libug4.so                      
#6  0x00007ffff484d472 in luaD_precall () from /home/stephan/Code/git/ug4/ugcore/cmake/../../lib/libug4.so                                                       
#7  0x00007ffff486d5c1 in luaV_execute () from /home/stephan/Code/git/ug4/ugcore/cmake/../../lib/libug4.so
#8  0x00007ffff484dfdd in luaD_call () from /home/stephan/Code/git/ug4/ugcore/cmake/../../lib/libug4.so
#9  0x00007ffff484c50e in luaD_rawrunprotected () from /home/stephan/Code/git/ug4/ugcore/cmake/../../lib/libug4.so
#10 0x00007ffff484e24a in luaD_pcall () from /home/stephan/Code/git/ug4/ugcore/cmake/../../lib/libug4.so
#11 0x00007ffff4840d16 in lua_pcall () from /home/stephan/Code/git/ug4/ugcore/cmake/../../lib/libug4.so
#12 0x00007ffff47eda11 in ug::script::ParseAndExecuteBuffer(char const*, char const*) () from /home/stephan/Code/git/ug4/ugcore/cmake/../../lib/libug4.so
#13 0x00000000004070e6 in ugshell_main(int, char**) ()
#14 0x00007ffff3312840 in __libc_start_main (main=0x405480 <main>, argc=3, argv=0x7fffffffdc98, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffffffdc88) at ../csu/libc-start.c:291
#15 0x0000000000405689 in _start ()

I will later try to provide the output from a debug build.

anaegel commented 3 years ago

Since 5258d092345265ad5509d38e0af0e25b99d5559a MathVectors default to 0.0. Could this be a potential source of error?

stephanmg commented 3 years ago

@anaegel I am not sure about this, I will try to do a git bisect.

stephanmg commented 3 years ago

Okay, your commit fixes the problem I think. I will confirm later. Cannot confirm: Problem still exists.