MantisBT - Community
View Issue Details
0027259Community[OCCT] OCCT:Modeling Datapublic2016-03-14 17:502016-03-29 17:34
rhplaxis 
abv 
normalcrash 
closedfixed 
WindowsVC++ 201364 bit
[OCCT] 7.0.0 
[OCCT] 7.0.0[OCCT] 7.0.0 
0027259: crash intersecting simple objects in occ7.0.0rc
While testing the 7.0.0rc there were several crashes in simple intersections (BOPAlgo_Builder) Strangely complex cases seen to work without a hitch.

one of the simplest cases (as reproduced in code below) is a box and two planar surfaces.

Not tessellating the box and not using parallellization in BOPAlgo_Builder seem to prevent the bug. (not really a solution we can use)
Also the problem only occurred in release mode.

the stacktrace:
7fee53b3 +011 TKernel.dll ?SubType@Standard_Type@@QEBAIAEBV?$handle@VStandard_Type@@@opencascade@@@Z
7fee9655 +09f TKBRep.dll ?EmptyCopy@BRep_TEdge@@UEBA?AV?$handle@VTopoDS_TShape@@@opencascade@@XZ
7fee4699 +083 TKBO.dll ?MakeSplitEdge@BOPTools_AlgoTools@@SAXAEBVTopoDS_Edge@@AEBVTopoDS_Vertex@@N1NAEAV2@@Z
7fef1e25 +18d MSVCR120.dll _endthreadex


The problem occurred with the VS 2013. 64-bit binaries from http://dev.opencascade.org/index.php?q=node/1151 [^]
I am working with VS2013 update 5 on windows 7 (64-bits)
#include <gtest/gtest.h>

#include <TopoDS_Shape.hxx>
#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
#include <BOPAlgo_Builder.hxx>
#include <BRepPrimAPI_MakePrism.hxx>
#include <BRepMesh_IncrementalMesh.hxx>
#include <BRepBuilderAPI_MakePolygon.hxx>
#include <gce_MakePln.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>

TEST(PlayGround, soilVolume)
{
  //contour 0 0 12 8
  auto contour = makePolygonFace({
    {0.0, 0.0, -4.0},
    {12.0, 0.0, -4.0},
    {12.0, 8.0, -4.0},
    {0.0, 8.0, -4.0}});

  gp_Vec displacement(0.0, 0.0, 5.0);
  BRepPrimAPI_MakePrism prismMaker(contour, displacement);

  prismMaker.Build();

  if (!prismMaker.IsDone() || prismMaker.Shape().IsNull())
  {
    FAIL();
  }

  // box from z = -4 to 1
  auto box = prismMaker.Shape();
 
// Tessellator::simpleTessellate(box);
  BRepTools::Clean(box);
  BRepMesh_IncrementalMesh BRepMesher(box, 0.01, Standard_True, M_PI / 18.0, true);

  // two surfaces bigger than the box
  auto top = makePolygonFace({
    {-2.0, -2.0, 0.0},
    {14.0, -2.0, 0.0},
    {14.0, 10.0, 0.0},
    {-2.0, 10.0, 0.0}});

  auto bottom = makePolygonFace({
    {-2.0, -2.0, -3.0},
    {14.0, -2.0, -3.0},
    {14.0, 10.0, -3.0},
    {-2.0, 10.0, -3.0}});

//intersection
  BOPAlgo_Builder builder;

  builder.AddArgument(box);
  builder.AddArgument(top);
  builder.AddArgument(bottom);

  builder.SetRunParallel(true);
  builder.Perform();
}

TopoDS_Face makePolygonFace(const std::vector<gp_Pnt> &points)
{
  assert(points.size() >= 3);

  if (points.size() < 3)
  {
    return {};
  }

  BRepBuilderAPI_MakePolygon polygon{};

  for (const auto &point: points)
  {
    polygon.Add(point);
  }
  polygon.Close();

  TopoDS_Wire contourWire = polygon.Wire();
  if (contourWire.IsNull())
  {
    return {};
  }

  // plane
  gp_Pln plane = gce_MakePln(points[0], points[1], points[2]);

  //make face
  BRepBuilderAPI_MakeFace faceBuilder(plane, contourWire, Standard_True);
  if (!faceBuilder.IsDone())
  {
    return {};
  }

  TopoDS_Face face = faceBuilder.Face();
  if (face.IsNull())
  {
    return {};
  }

  return face;
}
No tags attached.
duplicate of 0027254closed abv [Regression] 7.0 types initialization mechanism is not thread-safe on VS2013 
Issue History
2016-03-14 17:50rhplaxisNew Issue
2016-03-14 17:50rhplaxisAssigned To => msv
2016-03-14 17:56rhplaxisDescription Updatedbug_revision_view_page.php?rev_id=13174#r13174
2016-03-15 08:03gitNote Added: 0051609
2016-03-15 11:20gitNote Added: 0051620
2016-03-15 11:20abvNote Deleted: 0051620
2016-03-15 11:20abvNote Deleted: 0051609
2016-03-15 11:21abvRelationship addedduplicate of 0027254
2016-03-15 11:24abvNote Added: 0051621
2016-03-15 11:25abvStatusnew => resolved
2016-03-15 11:25abvTarget Version7.1.0 => 7.0.0
2016-03-16 10:31abvAssigned Tomsv => abv
2016-03-29 17:34abvStatusresolved => closed
2016-03-29 17:34abvResolutionopen => fixed
2016-03-29 17:34abvFixed in Version => 7.0.0

Notes
(0051621)
abv   
2016-03-15 11:24   
The cause of problem is apparently the same as previously reported in 0027254: due to wrong check for capabilities of VS 2013 compiler, OCCT type system turned to be non-thread safe with VS 2013. The fix in branch CR27254 eliminates this problem (tested on the above reproducer).