← Back to team overview

yade-dev team mailing list archive

[Bug 1380103] Re: polyhedral code, segmentation fault & memory leak

 

Sway,
your solution looks reasonable, two years ago I remember some scaling attempts as well. But then I moved somewhere else where finally everything worked for me. I am suprised by the position of the error, I have never seen it there. But I still do not understand what exactly the problem is. 
Anyway, this scaling might help you also with the high stiffness. As I wrote before, there are several check points that returns no contact if the overlap is extremely small to prevent CGAL error. But for high stiffnesses, it would result in unstable behavior. When you scale the whole problem, you actually decrease also the limits for return and help to restore stable situation.
Thanks for solving it, I do not have much time now to go again deeply into it. I am very happy that someone uses my code, understand it and even improve it. Good luck with your work.
Jan

-- 
You received this bug notification because you are a member of Yade
developers, which is subscribed to Yade.
https://bugs.launchpad.net/bugs/1380103

Title:
  polyhedral code, segmentation fault & memory leak

Status in Yet Another Dynamic Engine:
  New

Bug description:
  YADE version:1.11.1
  I simulated a packing with Polyhedra shape recently. When running about 50,000 (not constant ) steps, a bug occurred casting information as follow:
      Error in `/usr/bin/python': malloc(): memory corruption (fast): 0x00007fc6780762d8
  So give me some hints to find the reason, please.

  gdb:

  Program received signal SIGABRT, Aborted.
  [Switching to Thread 0x7f3257fff700 (LWP 3066)]
  0x00007f32b7760bb9 in __GI_raise (sig=sig@entry=6)
      at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
  56	../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
  (gdb) bt
  #0  0x00007f32b7760bb9 in __GI_raise (sig=sig@entry=6)
      at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
  #1  0x00007f32b7763fc8 in __GI_abort () at abort.c:89
  #2  0x00007f32b779de14 in __libc_message (do_abort=do_abort@entry=1,
      fmt=fmt@entry=0x7f32b78ac668 "*** Error in `%s': %s: 0x%s ***\n")
      at ../sysdeps/posix/libc_fatal.c:175
  #3  0x00007f32b77a8b77 in malloc_printerr (action=<optimized out>,
      str=0x7f32b78aca08 "malloc(): memory corruption (fast)",
      ptr=<optimized out>) at malloc.c:4996
  #4  0x00007f32b77ab884 in _int_malloc (av=0x7f3250000020, bytes=48)
      at malloc.c:3359
  #5  0x00007f32b77ad230 in __GI___libc_malloc (bytes=48) at malloc.c:2891
  #6  0x00007f32b1639f2d in operator new(unsigned long) ()
     from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
  #7  0x00007f32b441cb23 in void CGAL::In_place_list<CGAL::HalfedgeDS_in_place_list_vertex<CGAL::I_Polyhedron_vertex<CGAL::HalfedgeDS_vertex_base<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Point_3<CGAL::Epick> > > >, false, std::allocator<CGAL::HalfedgeDS_in_place_list_vertex<CGAL::I_Polyhedron_vertex<CGAL::HalfedgeDS_vertex_base<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Point_3<CGAL::Epick> > > > > >::insert<CGAL::internal::In_place_list_const_iterator<CGAL::HalfedgeDS_in_place_list_vert---Type <return> to continue, or q <return> to quit---
  ex<CGAL::I_Polyhedron_vertex<CGAL::HalfedgeDS_vertex_base<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Point_3<CGAL::Epick> > > >, std::allocator<CGAL::HalfedgeDS_in_place_list_vertex<CGAL::I_Polyhedron_vertex<CGAL::HalfedgeDS_vertex_base<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Point_3<CGAL::Epick> > > > > > >(CGAL::internal::In_place_list_iterator<CGAL::HalfedgeDS_in_place_list_vertex<CGAL::I_Polyhedron_vertex<CGAL::HalfedgeDS_vertex_base<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Point_3<CGAL::Epick> > > >, std::allocator<CGAL::HalfedgeDS_in_place_list_vertex<CGAL::I_Polyhedron_vertex<CGAL::HalfedgeDS_vertex_base<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Point_3<CGAL::Epick> > > > > >, CGAL::internal::In_place_list_const_iterator<CGAL::HalfedgeDS_in_place_list_vertex<CGAL::I_Polyhedron_vertex<CGAL::HalfedgeDS_vertex_base<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Point_3<CGAL::Epick> > > >, std::allocator<CGAL::HalfedgeDS_in_place_list_vertex<CGAL::I_Polyhedron_vertex<CGAL::HalfedgeDS_vertex_base<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Point_3<CGAL::Epick> > > > > >, CGAL::internal::In_place_list_const_iterator<CGAL::HalfedgeDS_in_---Type <return> to continue, or q <return> to quit---
  place_list_vertex<CGAL::I_Polyhedron_vertex<CGAL::HalfedgeDS_vertex_base<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Point_3<CGAL::Epick> > > >, std::allocator<CGAL::HalfedgeDS_in_place_list_vertex<CGAL::I_Polyhedron_vertex<CGAL::HalfedgeDS_vertex_base<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Point_3<CGAL::Epick> > > > > >) ()
     from .../temp-install/lib/x86_64-linux-gnu/yade-1.11.1/libyade.so
  #8  0x00007f32b442abc4 in CGAL::HalfedgeDS_list<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >::HalfedgeDS_list(CGAL::HalfedgeDS_list<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> > const&) ()
     from .../temp-install/lib/x86_64-linux-gnu/yade-1.11.1/libyade.so
  #9  0x00007f32b49118e2 in Simplify(CGAL::Polyhedron_3<CGAL::Epick, CGAL::Polyhedron_items_3, CGAL::HalfedgeDS_default, std::allocator<int> >, double) ()
     from .../temp-install/lib/x86_64-linux-gnu/yade-1.11.1/libyade.so
  #10 0x00007f32b4915e21 in Polyhedron_Plane_intersection(CGAL::Polyhedron_3<CGAL::Epick, CGAL::Polyhedron_items_3, CGAL::HalfedgeDS_default, std::allocator<int> >, CGAL::Plane_3<CGAL::Epick>, CGAL::Point_3<CGAL::Epick>, CGAL::Point_3<CGAL::Epick>) ()
     from .../temp-install/lib/x86_64-linux-gnu/yade-1.11.1/libyade.so
  #11 0x00007f32b48ea0f8 in Ig2_Wall_Polyhedra_PolyhedraGeom::go(boost::shared_ptr<Shape> const&, boost::shared_ptr<Shape> const&, State const&, State const&, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&, bool const&, boost::shared_ptr<Interaction> const&) ()

  Something wrong in function "Simplify" within Polyhedra_support.cpp:

  Polyhedron Simplify(Polyhedron P, double limit){
   bool elimination = true;
   while(elimination){
    elimination = false;
    for (Polyhedron::Edge_iterator hei = P.edges_begin(); hei!=P.edges_end(); ++hei){
     if (PlaneDifference(hei->facet()->plane(),hei->opposite()->facet()->plane()) < limit){
      if (hei->vertex()->vertex_degree() < 3) hei = P.erase_center_vertex(hei);
      else if(hei->opposite()->vertex()->vertex_degree() < 3) hei = P.erase_center_vertex(hei->opposite());
      else hei = P.join_facet(hei);
      elimination = true;
      break;
     }
    }
   }
   if (P.size_of_facets() < 4) P.clear();
   return P;
  }

To manage notifications about this bug go to:
https://bugs.launchpad.net/yade/+bug/1380103/+subscriptions


Follow ups

References