[Finally DONE] conda: vtk9 / occt7.5 / python3.9 / boost1.74 migration

This subforum is specifically to discuss packaging issues on different platforms (windows, mac, linux), and using different packaging systems (conda, etc...)
user1234
Veteran
Posts: 3345
Joined: Mon Jul 11, 2016 5:08 pm

Re: [DONE] conda: vtk9 / occt7.5 / python3.9 / boost1.74 migration

Post by user1234 »

Hello!
looo wrote: Sat Oct 02, 2021 4:01 pm The issue occures during the creation of a mesh. (eg meshing a box)
Maybe related to this but have nothing to do with conda: https://forum.freecadweb.org/viewtopic.php?t=62566. Here also FreeCAD fails in combination of vtk9 and smesh. The log was:

Code: Select all

Active analysis found: Analysis
  ElementDimension: 3
  No Group meshing for analysis.
  /tmp/fcfem_wm1eparl/Box_Geometry.brep
  /tmp/fcfem_wm1eparl/Box_Mesh.unv
  /tmp/fcfem_wm1eparl/shape2mesh.geo
  /home/user/Programs/gmsh-4.8.4/bin/gmsh
2021-10-01 19:43:25.670 (  48.073s) [        2BB67640]       vtkCellArray.cxx:551    ERR| vtkCellArray (0x56322fccc390): Invalid location.
.....
.....
.....
2021-10-01 19:43:25.760 (  48.164s) [        2BB67640]       vtkCellArray.cxx:551    ERR| vtkCellArray (0x56322fccc390): Invalid location.
FreeCAD: /home/user/Programs/FreeCAD/sourcecode/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkEdge.cpp:119: virtual int SMDS_VtkEdge::NbNodes() const: Assertion `nbPoints >= 2' failed.
Aborted
. I am not at the computer at the moment, so i can not make a strace. Maybe the 3rdParty source of salomemesh must be replaced? (i am not a c++ expert, just saying).

Greetings
user1234
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: [C++ EXPERT NEEDED!!!!] conda: vtk9 / occt7.5 / python3.9 / boost1.74 migration

Post by looo »

I guess gmsh can be affected by a smesh issue only during import export. At least this was the case some time ago.

Not sure if this is related.
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: [C++ EXPERT NEEDED!!!!] conda: vtk9 / occt7.5 / python3.9 / boost1.74 migration

Post by looo »

here is a better backtrace. Still there is a message that optimization is involved...:

Code: Select all

Process 27126 launched: '/Users/lo/miniconda3/conda-bld/debug_1633249932673/work/SMESH/test/tests/test_StdMeshers' (x86_64)
libSMDS.dylib was compiled with optimization - stepping may behave oddly; variables may not be available.
Process 27126 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    frame #0: 0x00000001029fe874 libSMDS.dylib`SMDS_MeshElement::~SMDS_MeshElement(this=0x00000001070097f8) at SMDS_MeshElement.hxx:55 [opt]
Target 0: (test_StdMeshers) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
  * frame #0: 0x00000001029fe874 libSMDS.dylib`SMDS_MeshElement::~SMDS_MeshElement(this=0x00000001070097f8) at SMDS_MeshElement.hxx:55 [opt]
    frame #1: 0x00000001029fe7c9 libSMDS.dylib`SMDS_ElementChunk::~SMDS_ElementChunk(this=<unavailable>) at SMDS_ElementFactory.cxx:545 [opt]
    frame #2: 0x00000001029fe899 libSMDS.dylib`SMDS_ElementChunk::~SMDS_ElementChunk(this=<unavailable>) at SMDS_ElementFactory.cxx:544 [opt]
    frame #3: 0x0000000102a007b3 libSMDS.dylib`void boost::checked_delete<SMDS_ElementChunk const>(x=<unavailable>) at checked_delete.hpp:36 [opt]
    frame #4: 0x0000000102a00799 libSMDS.dylib`void boost::delete_clone<SMDS_ElementChunk>(r=<unavailable>) at clone_allocator.hpp:45 [opt]
    frame #5: 0x0000000102a00749 libSMDS.dylib`void boost::heap_clone_allocator::deallocate_clone<SMDS_ElementChunk>(r=<unavailable>) at clone_allocator.hpp:63 [opt]
    frame #6: 0x0000000102a006b4 libSMDS.dylib`void boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<SMDS_ElementChunk, std::__1::vector<void*, std::__1::allocator<void*> > >, boost::heap_clone_allocator>::remove<boost::void_ptr_iterator<std::__1::__wrap_iter<void**>, SMDS_ElementChunk> >(this=<unavailable>, i=<unavailable>) at reversible_ptr_container.hpp:237 [opt]
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [C++ EXPERT NEEDED!!!!] conda: vtk9 / occt7.5 / python3.9 / boost1.74 migration

Post by wmayer »

looo wrote: Sat Oct 02, 2021 8:19 pm ok, the error is clearly related to the deletion of the object at the end of the file. Commenting out this section makes the test pass:

Code: Select all

	delete mesh;
	delete gen;

Looking at the backtrace again, my interpretation is that the destructor (SMDS_ElementChunk::~SMDS_ElementChunk()) is called twice. So the question is: Is it possible to avoid such cases?
This can only happen if a pointer to the SMDS_ElementChunk object isn't nullified. What might help is to add this line

Code: Select all

printf("~SMDS_ElementChunk: %p\n", this);
into the destructor. If the same address appears twice we will definitely know that double destruction is the problem.
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: [C++ EXPERT NEEDED!!!!] conda: vtk9 / occt7.5 / python3.9 / boost1.74 migration

Post by looo »

With this destructor:

Code: Select all

SMDS_ElementChunk::~SMDS_ElementChunk()
{
  printf("~SMDS_ElementChunk: %p\n", this);
  delete [] myElements;
  myFactory->myChunksWithUnused.erase( this );
}
running the test I get this output:

Code: Select all

./test_StdMeshers
~SMDS_ElementChunk: 0x7fa8615114a0

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test_StdMeshers is a Catch v2.13.7 host application.
Run with -? for options

-------------------------------------------------------------------------------
Mesh an edge of a box.
-------------------------------------------------------------------------------
/Users/lo/miniconda3/conda-bld/debug_1633249932673/work/SMESH/test/src/StdMeshers.t.cpp:16
...............................................................................

/Users/lo/miniconda3/conda-bld/debug_1633249932673/work/SMESH/test/src/StdMeshers.t.cpp:16: FAILED:
  {Unknown expression after the reported line}
due to a fatal error condition:
  SIGILL - Illegal instruction signal

===============================================================================
test cases: 1 | 1 failed
assertions: 3 | 2 passed | 1 failed

Illegal instruction: 4
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: [C++ EXPERT NEEDED!!!!] conda: vtk9 / occt7.5 / python3.9 / boost1.74 migration

Post by looo »

The issue is related to this line inside the SMDS_ElementChunk destructor:

Code: Select all

delete [] myElements;
Commenting out this line makes the test pass. Any ideas what's the issue with this line?
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [C++ EXPERT NEEDED!!!!] conda: vtk9 / occt7.5 / python3.9 / boost1.74 migration

Post by wmayer »

No idea what else could be the problem. I have built the latest version including the tests with the option "-fsanitize=address" (that performs some extra memory checks) and for me all tests have passed.
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: [C++ EXPERT NEEDED!!!!] conda: vtk9 / occt7.5 / python3.9 / boost1.74 migration

Post by looo »

wmayer wrote: Mon Oct 04, 2021 11:52 am No idea what else could be the problem. I have built the latest version including the tests with the option "-fsanitize=address" (that performs some extra memory checks) and for me all tests have passed.
Isn't it possible that "myElements" is deleted twice. At least removing this line makes the test work. But I am not sure if this will lead to memory issues.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [C++ EXPERT NEEDED!!!!] conda: vtk9 / occt7.5 / python3.9 / boost1.74 migration

Post by wmayer »

Isn't it possible that "myElements" is deleted twice.
When looking at the code I don't see how this should be possible. In the constructor of SMDS_ElementChunk an array of SMDS_MeshElement is created and in the destructor deleted again. And there is no way that one SMDS_ElementChunk object could take ownership of the SMDS_MeshElement array of another instance.
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: [C++ EXPERT NEEDED!!!!] conda: vtk9 / occt7.5 / python3.9 / boost1.74 migration

Post by looo »

http://cplusplus.com/forum/general/22393/

do we have a similar case here?
Post Reply