Segmentation Fault in linux with topologicpy and ifcopenshell

Hi @topologic, we are having problems with combining the libraries ifcopenshell and topologicpy (both with the last version available in pip) in a linux system. We are using the build of topologic explained here.

The linuxtest3.py script attached works well in Windows and MacOS but in Ubuntu we get a Segmentation Fault ("Core dumped"). If we change the order of the libraries import (topologicpy before ifcopenshell), the Segmentation Fault appears in a different point of the execution.

@topologic, how we should change the implementation in order to avoid this error?

Comments

  • I’m not a Linux expert sadly. My only suggestion is to check that the software on Linux and Windows are built against the same version of OCCT?

  • edited December 2023

    @agonzalezesteve what's your python version (python --version)? Is it the same as on Windows/Mac?

  • @topologic @knotsruen in both linux and windows we are using the versions 7.7.2 of occt and 3.10.13 of python.

  • @agonzalezesteve Hi. I did a bit of testing and sadly it seems on linux, the methods dealing with creating a BREP string are not functioning and crashing the whole kernel. This has nothing to do with ifcopenshell. So, as a temporary workaround, please use Topology.ByGeometry and give it a list of vertices, edges, and faces (aka mesh data).
    topology = Topology.ByGeometry(vertices=[], edges=[], faces=[], color=[1.0, 1.0, 1.0, 1.0], id=None, name=None, lengthUnit='METERS', outputMode='default', tolerance=0.0001)

    Here is an example of a 1x1x1 cell centered around the origin

    {'vertices': [[-0.5, -0.5, -0.5], [0.5, -0.5, -0.5], [0.5, 0.5, -0.5], [-0.5, 0.5, -0.5], [0.5, -0.5, 0.5], [-0.5, -0.5, 0.5], [0.5, 0.5, 0.5], [-0.5, 0.5, 0.5]], 'edges': [[1, 0], [2, 1], [3, 2], [0, 3], [1, 4], [4, 5], [5, 0], [2, 6], [6, 4], [3, 7], [7, 6], [5, 7]], 'faces': [[0, 1, 2, 3], [0, 1, 4, 5], [1, 2, 6, 4], [2, 3, 7, 6], [3, 0, 5, 7], [5, 4, 6, 7]]}

    agonzalezesteve
  • @agonzalezesteve Some more testing revelead that this is an issue that happens with jupyter notebook. Running the same script in python directly seems to work. Can you confirm please? Thanks

  • Here is the smallest script that triggers the bug:
    from topologicpy.Vertex import Vertex
    from topologicpy.Topology import Topology
    v = Vertex.ByCoordinates(0,0,0)
    s = Topology.BREPString(v)
    print(s)

  • Dear @agonzalezesteve. I tracked the bug down and sadly, I am now convinced it is a bug with OPENCASCADE and not with topologic. Specifically with this method: BRepTools::Write(GetOcctShape(), oss, false, true, TopTools_FormatVersion_VERSION_3);
    This bug is manifesting itself only on Linux and only through Jupyter notebook so it will be difficult to solve without the help of the OPENCASCADE team. The bug will be reported to them in the hope that they can solve it.

    knotsruen
  • @topologic said:
    @agonzalezesteve Some more testing revelead that this is an issue that happens with jupyter notebook. Running the same script in python directly seems to work. Can you confirm please? Thanks

    We don't use jupyter notebook. The script in python directly with linux fails.

  • @topologic we are trying ByGeometry and in the topologicpy version 0.4.39 seems to work but in version 0.4.54 fails.

    The error comes from this line of code that was added some motnhs ago. The error is: ValueError: operands could not be broadcast together with shapes (3,) (0,). What about using the length of the array to filter empty values, instead of using the operand ==?

  • @agonzalezesteve said:

    @topologic said:
    @agonzalezesteve Some more testing revelead that this is an issue that happens with jupyter notebook. Running the same script in python directly seems to work. Can you confirm please? Thanks

    We don't use jupyter notebook. The script in python directly with linux fails.

    I am still convinced that this is a bug with OPENCASCADE on Linux as the same code works well on Windows and MacOS.

  • @agonzalezesteve said:
    @topologic we are trying ByGeometry and in the topologicpy version 0.4.39 seems to work but in version 0.4.54 fails.

    The error comes from this line of code that was added some motnhs ago. The error is: ValueError: operands could not be broadcast together with shapes (3,) (0,). What about using the length of the array to filter empty values, instead of using the operand ==?

    For bugs, it is best if you raise an issue on github? And please point me to the offending file and exact line of code? If you can suggest exact alternative code, that will be very helpful. Thanks.

  • @agonzalezesteve I just fixed the code for Topology.ByGeometry and uploaded to github. Can you please replace your Topology.py file in your installation with the one from Github to test and let me know if it works better now? If so, this will be included in the next release of topologicpy. Thanks!

  • @topologic said:
    For bugs, it is best if you raise an issue on github?

    Yes, sure!

Sign In or Register to comment.