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

[BUG] Crash on creating sketch #395

Open
ffernn-dev opened this issue Jun 17, 2023 · 17 comments
Open

[BUG] Crash on creating sketch #395

ffernn-dev opened this issue Jun 17, 2023 · 17 comments
Labels
Bounty - Small https://www.cadsketcher.com/cad-sketcher-bounty-board bug Something isn't working

Comments

@ffernn-dev
Copy link

ffernn-dev commented Jun 17, 2023

Contact Details

hihi.fernguy@gmail.com

Description

Just installed on Arch linux, installed the pip module with paru -S python-py-slvs (rather than using pip as advised by Arch), and am getting a crash while attempting to create a sketch in the sidebar.

/usr/include/c++/13.1.1/bits/stl_vector.h:1125: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = Slvs_Constraint; _Alloc = std::allocator<Slvs_Constraint>; reference = Slvs_Constraint&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
[1]    105499 IOT instruction (core dumped)  blender

I get this error in my console when it crashes

Addon Version

0.27.2 - latest

Blender Version

3.5.1

What platform are you running on?

Linux

@ffernn-dev ffernn-dev added the bug Something isn't working label Jun 17, 2023
@hlorus
Copy link
Owner

hlorus commented Jun 18, 2023

Might be the wrong solver, this is the correct one:
https://pypi.org/project/py-slvs/

@JulianGmp
Copy link

JulianGmp commented Jun 27, 2023

I can confirm that this issue occurs for me as well.
I noticed that this also happens when I press the "Force Update" button, with similar output:
2023-06-27_18:58:59

> blender --log-level -1
Read prefs: "/home/julian/.config/blender/3.6/config/userpref.blend"
Failed to open dir (No such file or directory): /run/user/1000/gvfs/
CAD_Sketcher-main:{INFO}: Logging into: /tmp/CAD_Sketcher-main-julian.log
/usr/include/c++/13.1.1/bits/stl_vector.h:1125: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = Slvs_Param; _Alloc = std::allocator<Slvs_Param>; reference = Slvs_Param&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
zsh: IOT instruction (core dumped)  blender --log-level -1

I am using the python-py-slvs AUR package, which uses the same source as the pypi package.

Addon Version

0.27.2 (latest gumroad download)

Blender Version

3.6.0

What platform are you running on?

Arch Linux 2023-06-27, all packages updated.

Edit

Just after commenting I noticed that the aur package for py-slvs is at version 1.0.5, which is the only tag in the realthunder/slvs_py repo.
However, on pypi you can see that there's a 1.0.6 version.

I'll try to install it through pypi and see if it that resolves the problem. Though I'm not sure why the repo doesn't have tags for the other releases of the package.

@JulianGmp
Copy link

Update: the issue is resolved when using py-slvs 1.0.6.

I don't know how easy/hard it is to do in python, but I would suggest adding a version check to the addon to see if it's running with the right version of the module.

@bury52
Copy link

bury52 commented Jul 3, 2023


Read prefs: "/home/bogusz/.config/blender/3.6/config/userpref.blend"
CAD_Sketcher-main:{INFO}: Logging into: /tmp/CAD_Sketcher-main-bogusz.log
Info: Deleted 3 object(s)

/usr/include/c++/13.1.1/bits/stl_vector.h:1125: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = Slvs_Constraint; _Alloc = std::allocator<Slvs_Constraint>; reference = Slvs_Constraint&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
fish: Job 1, 'blender' terminated by signal SIGABRT (Przerwij)

yay -S python-py-slvs-git

AUR - python-py-slvs-git-1.0.6.r1.gb704719-1

Addon Version
0.27.2 (latest gumroad download)

Blender Version
3.6.0

What platform are you running on?
Arch Linux 2023-07-03, all packages updated.

@ffernn-dev
Copy link
Author

Hey sorry I haven't responded to this. I was able to get it working by forcefully installing the pypi package, but with complain from Arch. It is much preferable to use AUR or official Arch packages for python software due to the way the system operates, which is why pressing the "install slvs" button in the settings menu doesn't do anything (it errors when trying to run pip install)

@chuck-flowers
Copy link

I'm seeing the same issue on Arch using both the python-py-slvs-git and the python-py-slvs AUR packages (the latter which I maintain so if there's an issue with the package let me know). When I run blender from the command line, I see the following error message which might provide some insight.

Read prefs: "/home/cflowers/.config/blender/3.6/config/userpref.blend"
cad-sketcher:{INFO}: Logging into: /tmp/cad-sketcher-cflowers.log
/usr/include/c++/13.1.1/bits/stl_vector.h:1125: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = Slvs_Constraint; _Alloc = std::allocator<Slvs_Constraint>; reference = Slvs_Constraint&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
Aborted (core dumped)

@linkdom
Copy link

linkdom commented Jul 9, 2023

I can confirm that I get the exact same error with both AUR packages, if I can provide any further help let me know and I will do my best!

Blender 3.6.0
build date: 2023-07-02
build time: 18:04:48
build commit date: 2023-06-27
build commit time: 08:08
build hash: c7fc78b81ecb
build platform: Linux
build type: Release

CAD Sketcher 0.27.2

@hlorus
Copy link
Owner

hlorus commented Jul 10, 2023

I'm seeing the same issue on Arch using both the python-py-slvs-git and the python-py-slvs AUR packages (the latter which I maintain so if there's an issue with the package let me know). When I run blender from the command line, I see the following error message which might provide some insight.

Read prefs: "/home/cflowers/.config/blender/3.6/config/userpref.blend"
cad-sketcher:{INFO}: Logging into: /tmp/cad-sketcher-cflowers.log
/usr/include/c++/13.1.1/bits/stl_vector.h:1125: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = Slvs_Constraint; _Alloc = std::allocator<Slvs_Constraint>; reference = Slvs_Constraint&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
Aborted (core dumped)

I'm guessing the package doesn't include the latest fix, see: realthunder/slvs_py@3df1c87

@chuck-flowers
Copy link

Thanks for the heads up. I'll get python-py-slvs repackaged after I get off work today.

@Jakobu5
Copy link

Jakobu5 commented Jul 29, 2023

Is there any update regarding the crashing? Blender crashes with version py-slvs 1.0.6 (installed via AUR):

blender --log-level 1
Read prefs: "/home/jakobu5/.config/blender/3.6/config/userpref.blend"
Failed to open dir (No such file or directory): /run/user/1000/gvfs/
Traceback (most recent call last):
  File "/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 333, in enable
    mod = import(module_name)
          ^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'cad-sketcher'
CAD_Sketcher-main:{INFO}: Logging into: /tmp/CAD_Sketcher-main-jakobu5.log
/usr/include/c++/13.1.1/bits/stl_vector.h:1125: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = Slvs_Constraint; _Alloc = std::allocator<Slvs_Constraint>; reference = Slvs_Constraint&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
Aborted (core dumped)

[jakobu5@archlinux ~]$ blender --version
Blender 3.6.0
        build date: 2023-07-07
        build time: 13:20:07
        build commit date: 2023-06-27
        build commit time: 08:08
        build hash: c7fc78b81ecb
        build platform: Linux
        build type: Release
        [...]

[jakobu5@archlinux ~]$ pip list
Package      Version
------------ -------
[...]
py-slvs      1.0.6
[...]

@chuck-flowers
Copy link

@Jakobu5 I don't think we've gotten an answer on what the problem is yet. Your error seems to imply that cad-sketcher is not installed given the message ModuleNotFoundError: No module named 'cad-sketcher'

It might be worth reinstalling the cad-sketcher plugin to see if the error message changes.

@Aggeloz
Copy link

Aggeloz commented Aug 1, 2023

I have the exact same but with this terminal output as well

/usr/include/c++/13.1.1/bits/stl_vector.h:1125: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = Slvs_Constraint; _Alloc = std::allocator<Slvs_Constraint>; reference = Slvs_Constraint&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
[1]    12339 IOT instruction (core dumped)  blender

@Jakobu5
Copy link

Jakobu5 commented Aug 2, 2023

@Jakobu5 I don't think we've gotten an answer on what the problem is yet. Your error seems to imply that cad-sketcher is not installed given the message ModuleNotFoundError: No module named 'cad-sketcher'

It might be worth reinstalling the cad-sketcher plugin to see if the error message changes.

I think that’s because i’ve enabled the plugin right before clicking on „New Sketch“ in the CAD Sketcher UI.
After enabling the plugin and reopening Blender it crashes exactly the same, without the ModuleNotFoundError:

blender --log-level 1
Read prefs: "/home/jakobu5/.config/blender/3.6/config/userpref.blend"
CAD_Sketcher-main:{INFO}: Logging into: /tmp/CAD_Sketcher-main-jakobu5.log
/usr/include/c++/13.1.1/bits/stl_vector.h:1125: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = Slvs_Constraint; _Alloc = std::allocator<Slvs_Constraint>; reference = Slvs_Constraint&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
Aborted (core dumped)

The Logfile CAD_Sketcher-main-jakobu5.log is empty.

@vitrvvivs
Copy link

vitrvvivs commented Aug 19, 2023

Easiest way to reproduce is with this

>>> import py_slvs.slvs
>>> py_slvs.slvs.System().solve()
/usr/include/c++/13.2.1/bits/stl_vector.h:1125: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = Slvs_Param; _Alloc = std::allocator<Slvs_Param>; reference = Slvs_Param&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.

@chuck-flowers
Dirty Solution:

--- a/PKGBUILD
+++ b/PKGBUILD
@@ -40,6 +40,7 @@ prepare() {
 build() {
        cd "$srcdir/$pkgname"

+       export CXXFLAGS="-U_GLIBCXX_ASSERTIONS"
        python setup.py build
 }

Reason:
The bug is upstream in solvespace.
In the Arch default /etc/makepkg.conf : CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS".
-D_GLIBCXX_ASSERTIONS adds out-of-bounds checks when accessing vectors. This is generally a good thing, better than undefined behaviour.

I believe the offending line is in the python-C++ interface. https://github.com/realthunder/solvespace/blob/526a260b0c45586c0319de208fd7e97c43c49bf4/src/swig/slvs_swig.hpp#L51 . It's the only place in the project with an std::vector of Constraints. When there are no constraints yet added, that [0] access should fail.

@Vermoot
Copy link

Vermoot commented Aug 20, 2023

Still having this issue as well. Downloaded the latest CAD sketcher (0.27.2), and different versions of py-slvs from the AUR, nothing fixed it.

@chuck-flowers
Copy link

@vitrvvivs Thanks for sharing this. I wonder if the default values CXXFLAGS for Arch Linux's /etc/makepkg.conf have changed recently. I'll look into this if I have time later today. If I find a quick solution, I'll post here. Finding a more long term solution for everyone using the AUR directly might take a little bit more time.

@chuck-flowers
Copy link

@vitrvvivs sorry for the delay in getting back to this. Your solution with the CXX_FLAGS seems to work. I modified it slightly to include the -Wp and $CFLAGS values originally defined in /etc/makepkg.conf. I have published a change to the python-py-slvs package. I don't control the python-py-slvs-git package so I can't update that one.

If anyone else has any problems they believe could be related to my package, let me know.

@hlorus hlorus added the Bounty - Small https://www.cadsketcher.com/cad-sketcher-bounty-board label Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bounty - Small https://www.cadsketcher.com/cad-sketcher-bounty-board bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants