Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mesher crashes when run as a file upon exit #738

Open
jdegenstein opened this issue Oct 16, 2024 · 2 comments
Open

Mesher crashes when run as a file upon exit #738

jdegenstein opened this issue Oct 16, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@jdegenstein
Copy link
Collaborator

This is a non-critical issue since the crash occurs AFTER all of the script has run. I currently believe the crash occurs while resources are being freed up as the python interpreter exits. Here is a test-case e.g. crashtest.py:

from build123d import *

with BuildPart() as board:
    Box(1, 2, 3)

exporter = Mesher() # generates one exception
exporter.add_shape(board.part) # generates a second exception

Run like:

$ python crashtest.py
Exception ignored in: <function Base.__del__ at 0x7f0458f61120>
Traceback (most recent call last):
  File "/home/oem/miniconda3/envs/ocp_vscode2/lib/python3.11/site-packages/py_lib3mf/Lib3MF.py", line 4327, in __del__
  File "/home/oem/miniconda3/envs/ocp_vscode2/lib/python3.11/site-packages/py_lib3mf/Lib3MF.py", line 4091, in Release
  File "/home/oem/miniconda3/envs/ocp_vscode2/lib/python3.11/site-packages/py_lib3mf/Lib3MF.py", line 4026, in checkError
AttributeError: 'NoneType' object has no attribute 'SUCCESS'
Exception ignored in: <function Base.__del__ at 0x7f0458f61120>
Traceback (most recent call last):
  File "/home/oem/miniconda3/envs/ocp_vscode2/lib/python3.11/site-packages/py_lib3mf/Lib3MF.py", line 4327, in __del__
  File "/home/oem/miniconda3/envs/ocp_vscode2/lib/python3.11/site-packages/py_lib3mf/Lib3MF.py", line 4091, in Release
  File "/home/oem/miniconda3/envs/ocp_vscode2/lib/python3.11/site-packages/py_lib3mf/Lib3MF.py", line 4026, in checkError
AttributeError: 'NoneType' object has no attribute 'SUCCESS'

I currently suspect that some logic can be added to class Mesher that will solve this problem (such as to free up resources as the script exits somehow). It also could be a problem with the lib3mf python bindings.

@gumyr gumyr added the bug Something isn't working label Oct 22, 2024
@gumyr gumyr added this to the Not Gating Release 1.0.0 milestone Oct 22, 2024
@gautaz
Copy link

gautaz commented Nov 4, 2024

Hello,

I just ran into this issue with the following source code:

from build123d import *

length, width, thickness = 80.0, 60.0, 10.0
center_hole_dia = 22.0

with BuildPart() as ex2:
    Box(length, width, thickness)
    Cylinder(radius=center_hole_dia / 2, height=thickness, mode=Mode.SUBTRACT)

exporter = Mesher()
exporter.add_shape(ex2)
exporter.write("test.3mf")

As the file test.3mf is not generated by the script, I am not sure how to interpret the following:

This is a non-critical issue since the crash occurs AFTER all of the script has run.

As I have no previous experience with build123d, this might also be a PEBKAC issue.

@gautaz
Copy link

gautaz commented Nov 4, 2024

And I just realized that this was in fact a PEBKAC issue, I missed the .part in the add_shape.
My apologies for polluting the thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants