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

Sketcher: Crash when creating B-spline #16729

Open
2 tasks done
sslupsky opened this issue Sep 22, 2024 · 22 comments
Open
2 tasks done

Sketcher: Crash when creating B-spline #16729

sslupsky opened this issue Sep 22, 2024 · 22 comments
Labels
Mod: Sketcher Related to the Sketcher Workbench OS: macOS Status: Needs confirmation Missing confirmation from other testers Type: Has workaround

Comments

@sslupsky
Copy link

sslupsky commented Sep 22, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Problem description

B-Splines are crashing in 1.0.0RC1.38642 and 1.1.0dev.38794:

Might be a regression of the problem reported here #14945 ?

To reproduce:
create a sketch,
click first point in b-spline (anywhere, does not need to be origin)
click second point (anywhere),
right click

FreeCAD crashes at this point.

Full version info

OS: macOS 14.6.1
Word size of FreeCAD: 64-bit
Version: 1.1.0dev.38794 (Git)
Build type: Release
Branch: main
Hash: a47800d9ccd7d7a7cdb1779d56de03d3c64cd76e
Python 3.11.9, Qt 5.15.13, Coin 4.0.3, Vtk 9.2.6, OCC 7.7.2
Locale: C/Default (C)
Stylesheet/Theme/QtStyle: FreeCAD Dark.qss/FreeCAD Dark/Qt default
Installed mods: 
  * kicadStepUpMod 11.3.2

Subproject(s) affected?

Sketcher

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@sslupsky sslupsky added the Status: Needs triage Missing triage label Sep 22, 2024
@sslupsky
Copy link
Author

sslupsky commented Sep 22, 2024

I went back to 1.0.0RC1 and the same problem exists.

OS: macOS 14.6.1
Word size of FreeCAD: 64-bit
Version: 1.0.0RC1.38642 (Git)
Build type: Release
Branch: (HEAD detached at 1.0rc1)
Hash: 60a2513
Python 3.11.9, Qt 5.15.13, Coin 4.0.2, Vtk 9.2.6, OCC 7.7.2
Locale: C/Default (C)
Installed mods:

  • kicadStepUpMod 11.3.2

@sslupsky
Copy link
Author

Trying to find a work around, I clicked several points and then clicked the "close" button. The sketch closed and FreeCAD did not crash but there was no b-spline rendered in the sketch. The control points were in the sketch when I reopened it but there was no b-spline.

@sslupsky
Copy link
Author

Build 0.22.0dev.38495 crashes.
Build 0.21.2dev.33711 works.

@sslupsky
Copy link
Author

sslupsky commented Sep 23, 2024

I disabled auto constraints and the crash still occurs so I believe the problem is not related to auto constraints per PR #14954

The original fix in PR #14951 appears to exempt the special case when there is only one control point. If you only have one control point there is no crash. When there are two or more control points, the crash occurs.

@sslupsky
Copy link
Author

It appears this issue appears to be related to the machine. I attempted creating a BSpline on the same OS (macOS 14.6.1) but different architecture (arm64 M2 Max MBP) and creating the BSpline does not crash FreeCAD. So, this issue appears to be specific to the x86 version.

@sslupsky sslupsky changed the title crash when creating b-spline in sketcher crash when creating b-spline in sketcher on x86 macOS Sep 23, 2024
@maxwxyz
Copy link
Collaborator

maxwxyz commented Sep 23, 2024

@AjinkyaDahale @chennes FYI

@maxwxyz maxwxyz added Status: Needs confirmation Missing confirmation from other testers Mod: Sketcher Related to the Sketcher Workbench OS: macOS and removed Status: Needs triage Missing triage labels Sep 23, 2024
@luzpaz
Copy link
Contributor

luzpaz commented Sep 23, 2024

@JohnOCFII could you reproduce on macOS ? TIA!

@sslupsky
Copy link
Author

Here is a screen recording.
Screen Recording 2024-09-23 at 1 17 10 PM-Animated Image (Large)

@JohnOCFII
Copy link

No crash with my M1/arm Mac. As @sslupsky mentioned, this might be an architecture-related crash and only impacting the Intel Macs.

OS: macOS 15.0
Word size of FreeCAD: 64-bit
Version: 1.1.0dev.38794 (Git)
Build type: Release
Branch: main
Hash: a47800d9ccd7d7a7cdb1779d56de03d3c64cd76e
Python 3.11.9, Qt 5.15.13, Coin 4.0.3, Vtk 9.2.6, OCC 7.7.2
Locale: C/Default (C)
Stylesheet/Theme/QtStyle: OpenDark.qss/OpenDark/Fusion
Installed mods: 
  * FeedsAndSpeeds 0.5.0
  * OpenTheme 2024.9.1
  * fasteners 0.5.29
  * Curves 0.6.47
Screenshot 2024-09-23 at 7 34 45 PM

@chennes
Copy link
Member

chennes commented Sep 24, 2024

No crash on my Intel Mac:

OS: macOS 13.7
Word size of FreeCAD: 64-bit
Version: 1.0.0RC1.38758 (Git)
Build type: Release
Branch: releases/FreeCAD-1-0
Hash: e19f583e7724c535c6e035d6173f2016ce601f6d
Python 3.11.8, Qt 5.15.8, Coin 4.0.2, Vtk 9.2.6, OCC 7.6.3
Locale: English/United States (en_US)
Stylesheet/Theme/QtStyle: unset/FreeCAD Classic/Qt default

@sslupsky
Copy link
Author

My Mac is a MP 6,1. Could it be compiler related? Compiler settings maybe using AVX2 instructions?

@chennes
Copy link
Member

chennes commented Sep 24, 2024

Mine is MacBookPro16,4, so definitely different. Can you try self-compiling? If you've never done it before, I'd install Miniforge then follow the instructions here (but I know this is a big ask, getting things set up and compiling can be a headache, so if you don't have time I understand).

@sslupsky
Copy link
Author

sslupsky commented Sep 24, 2024

I tried it on two other Intel machines (MBP 10,1 and MacMini 6,1) running 14.6.1 and OCLP and it works fine. So it appears to be something to do with the MP 6,1. Seems like it could be a QT related issue:

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libQt5Gui.5.15.13.dylib       	       0x10b182e7c QCursor::QCursor(QCursor const&) + 30
1   SketcherGui.so                	       0x4297a78f8 SketcherGui::DrawSketchDefaultHandler<SketcherGui::DrawSketchHandlerBSpline, SketcherGui::StateMachines::TwoSeekEnd, 2, SketcherGui::ConstructionMethods::BSplineConstructionMethod>::finish() + 24
2   SketcherGui.so                	       0x4298debcb SketcherGui::ViewProviderSketch::mouseButtonPressed(int, bool, SbVec2s const&, Gui::View3DInventorViewer const*) + 1339
3   libFreeCADGui.dylib           	       0x10bd1a622 Gui::ViewProvider::eventCallback(void*, SoEventCallback*) + 674

I'll look into compiling it on the MP and see what that does. But, this appears to be a very specific machine issue.

@sslupsky
Copy link
Author

sslupsky commented Sep 24, 2024

@chennes I am running into a problem with installation of one of the dependencies (netgen) when I follow the instructions you linked to. Is there some way to work around this dependency? I get an error when cmake attempts to link Mod/Fem/Fem.so:

Undefined symbols for architecture x86_64:
  "fmt::v11::report_error(char const*)", referenced from:
      void fmt::v11::detail::vprintf<char, fmt::v11::basic_printf_context<char>>(fmt::v11::detail::buffer<char>&, fmt::v11::basic_string_view<char>, fmt::v11::basic_format_args<fmt::v11::basic_printf_context<char>>) in FemMeshShapeNetgenObject.cpp.o

FreeCAD/homebrew-freecad#561

@chennes
Copy link
Member

chennes commented Sep 24, 2024

Honestly for now I'd just disable building FEM (e.g. -DBUILD_FEM=Off if you are using cMake on the command line).

@sslupsky
Copy link
Author

sslupsky commented Sep 24, 2024

Yeah, I turned off BUILD_FEM_NETGEN in the CMakePresets.json file. I was able to compile and there is no crash.

OS: macOS 14.6.1
Word size of FreeCAD: 64-bit
Version: 1.1.0dev.38834 (Git)
Build type: Release
Branch: main
Hash: 490d6c5abc41bb61fa5bf47398df142a8ac2519e
Python 3.11.8, Qt 5.15.8, Coin 4.0.2, Vtk , OCC 7.6.3
Locale: English/Canada (en_CA)
Stylesheet/Theme/QtStyle: FreeCAD Dark.qss/FreeCAD Dark/Qt default
Installed mods: 
  * kicadStepUpMod 11.3.2

I noticed a new build (38827) was posted to the bundle repo a few minutes ago so I downloaded that build and it still crashes.

OS: macOS 14.6.1
Word size of FreeCAD: 64-bit
Version: 1.1.0dev.38827 (Git)
Build type: Release
Branch: main
Hash: abd5c3ca31539f8ed37ac3dec2b9abd252a5310d
Python 3.11.9, Qt 5.15.13, Coin 4.0.3, Vtk 9.2.6, OCC 7.7.2
Locale: C/Default (C)
Stylesheet/Theme/QtStyle: FreeCAD Dark.qss/FreeCAD Dark/Qt default
Installed mods: 
  * kicadStepUpMod 11.3.2

I compiled today so I am not sure why the dependency versions are different.

@sslupsky
Copy link
Author

sslupsky commented Oct 18, 2024

Crash is still occurring in build 38946.

I found a work around of sorts by drawing a line or arc in the sketch and then converting the arc to a bspline. I can then edit and manipulate the bspline without crashing FreeCAD.

@luzpaz luzpaz changed the title crash when creating b-spline in sketcher on x86 macOS Sketcher: Crash when creating B-spline Oct 18, 2024
@depthoffocus
Copy link

No crash for me -- a 13" 2018 Intel MacBook Pro with 16gb RAM, Sonoma.

OS: macOS 14.6.1
Word size of FreeCAD: 64-bit
Version: 1.1.0dev.38991 (Git)
Build type: Release
Branch: main
Hash: ef2156d0f6d116b1642a5531a2d44fc6b7d17042
Python 3.11.9, Qt 5.15.13, Coin 4.0.3, Vtk 9.2.6, OCC 7.7.2
Locale: C/Default (C)
Stylesheet/Theme/QtStyle: FreeCAD Dark.qss/FreeCAD Dark/Fusion
Installed mods: 
  * ThreadProfile 1.92.0
  * freecad.gears 1.3.0
  * OpenTheme 2024.9.1
  * Manipulator 1.5.7
  * fasteners 0.5.29
  * lattice2 1.0.0
  * CurvedShapes 1.0.12
  * Curves 0.6.50
Screen.Recording.2024-10-21.at.23.02.11.mov

@sslupsky
Copy link
Author

I downloaded build 38991 (same build as @depthoffocus) and it is still crashing for me.

@depthoffocus
Copy link

depthoffocus commented Oct 21, 2024

@sslupsky you're using OCLP, right? So this could be something to do with that. AVX2 maybe (not sure if I understand that). Or Legacy Metal?

Have you tried "use Software OpenGL" to see if that solves it?

The only other thing I wonder is if it crashes without KiCad StepUp installed. That's the only add-on you list, and none of us above appear to be using it.

@sslupsky
Copy link
Author

@depthoffocus Yes, I am running OCLP. I tried it on a couple other machines running OCLP and didn't have a problem. So uncertain if it is OCLP related or something specific to the MP 6,1. I have D500 GPU's.

I removed KiCad StepUp but it did not make a difference.

I also tried the "use Software OpenGL" preference but that didn't make a difference either.

When I compiled FreeCAD from source on the MP 6,1, it did not crash. It might have something to do with a compiler flag and AVX2. But, I think I would have seen the same problem on the Mini 6,1 and MBP 10,1 since those CPU's do not support AVX2 either?

@sslupsky
Copy link
Author

Are the weekly builds archived somewhere? If I could download older builds, I might be able to zero in on the build where the problem started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mod: Sketcher Related to the Sketcher Workbench OS: macOS Status: Needs confirmation Missing confirmation from other testers Type: Has workaround
Projects
None yet
Development

No branches or pull requests

6 participants