Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 880083 - media-gfx/freecad: crash in dev-python/pivy cast_internal
Summary: media-gfx/freecad: crash in dev-python/pivy cast_internal
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal critical (vote)
Assignee: Bernd
URL:
Whiteboard:
Keywords:
Depends on: 867763
Blocks:
  Show dependency tree
 
Reported: 2022-11-06 19:57 UTC by KosmiK
Modified: 2022-12-12 07:04 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Gdb Log (pasterbin_gdb_Freecad_segfault.txt,53.91 KB, text/plain)
2022-11-06 19:58 UTC, KosmiK
Details

Note You need to log in before you can comment on or make changes to this bug.
Description KosmiK 2022-11-06 19:57:17 UTC
kosmik2001@Nekrobook ~ $ freecad

/**blablabla**/

Program received signal SIGSEGV, Segmentation fault.
#0  /lib64/libc.so.6(+0x3d4b0) [0x7f09471a84b0]

I noticed it by accident. After a major update, I checked all programs to run (just out of boredom). Both Freecad and Librecad suddenly fell into a segfault.
I have a copy of the system on a hard drive where everything works (I didn't update there). I rolled back to this backup. Works. OK.
emerge --sync.
And package after package, I updated manually.
So I found out that zstd after recompilation became the cause of this segfault.

From the backup disk, I made a quickpkg zstd and transferred it to the current system. and Freecad and Librecad have earned.
I also found out that the launch of both Freecad and Librecad through strace and gdb - in general, they run without visible problems.
Then, according to the manual from the wiki, I rebuilt zstd and Freecad with all the necessary options for debugging.
And again - direct launch - segfault. Running through gdb and strace works.
And then I ran "gdb --args freecad --run-test 0".
Having eaten a lot of memory, it seems like Freecad started up, worked something out and ... I saw Thread 1 "freecad" received signal SIGSEGV, Segmentation fault.





Reproducible: Always

Steps to Reproduce:
1. Update system to actual.
2. run FreeCad.
Actual Results:  
Program received signal SIGSEGV, Segmentation fault.
#0  /lib64/libc.so.6(+0x3d4b0) [0x7f09471a84b0]


Expected Results:  
Working Application.

https://pastebin.com/xEN0nagE
Comment 1 KosmiK 2022-11-06 19:58:54 UTC
Created attachment 828141 [details]
Gdb Log
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-06 20:08:18 UTC
- Please include emerge --info.
- Are you saying a zstd upgrade caused it or not? If so, what version works, and which version doesn't?
Comment 4 Larry the Git Cow gentoo-dev 2022-11-06 20:13:04 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9ca76b61e63037637892f18a0d7f6e11d273d7e1

commit 9ca76b61e63037637892f18a0d7f6e11d273d7e1
Author:     Bernd Waibel <waebbl-gentoo@posteo.net>
AuthorDate: 2022-09-01 05:23:54 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-11-06 20:12:52 +0000

    dev-python/pivy: add 0.6.8
    
    Closes: https://bugs.gentoo.org/880083
    Closes: https://bugs.gentoo.org/867763
    Closes: https://github.com/gentoo/gentoo/pull/27101
    Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net>
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-python/pivy/Manifest          |  1 +
 dev-python/pivy/pivy-0.6.8.ebuild | 59 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+)
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-06 20:13:43 UTC
Please try again with dev-python/pivy-0.6.8.
Comment 6 KosmiK 2022-11-06 20:35:36 UTC
(In reply to Sam James from comment #5)
> Please try again with dev-python/pivy-0.6.8.

Program received signal SIGSEGV, Segmentation fault.
#0  /lib64/libc.so.6(+0x3d4b0) [0x7f3a0c5b94b0]

Same. Just builded from local_overlay. pivy-0.6.8

The problem is that a simple launch leads to a crash. Run via gdb or strace - no crash.
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-06 20:38:11 UTC
(In reply to KosmiK from comment #6)
> (In reply to Sam James from comment #5)
> > Please try again with dev-python/pivy-0.6.8.
> 
> Program received signal SIGSEGV, Segmentation fault.
> #0  /lib64/libc.so.6(+0x3d4b0) [0x7f3a0c5b94b0]
> 
> Same. Just builded from local_overlay. pivy-0.6.8
> 
> The problem is that a simple launch leads to a crash. Run via gdb or strace
> - no crash.

That backtrace isn't sufficient. Please share the full output. Your previous output was definitely a crash in pivy's cast_internal where they were doing something naughty with Py_ssize_t.
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-06 20:39:24 UTC
(Also, ideally, please enable debugging symbols for glibc + python 3.10 + pivy + freecad).
Comment 9 KosmiK 2022-11-06 20:44:02 UTC
(In reply to Sam James from comment #8)
> (Also, ideally, please enable debugging symbols for glibc + python 3.10 +
> pivy + freecad).


Okay, I'll put in a nightly rebuild of glibc and pivy with debug.conf
Comment 10 KosmiK 2022-11-06 20:45:45 UTC
(In reply to Sam James from comment #7)
> (In reply to KosmiK from comment #6)
> > (In reply to Sam James from comment #5)
> > > Please try again with dev-python/pivy-0.6.8.
> > 
> > Program received signal SIGSEGV, Segmentation fault.
> > #0  /lib64/libc.so.6(+0x3d4b0) [0x7f3a0c5b94b0]
> > 
> > Same. Just builded from local_overlay. pivy-0.6.8
> > 
> > The problem is that a simple launch leads to a crash. Run via gdb or strace
> > - no crash.
> 
> That backtrace isn't sufficient. Please share the full output. Your previous
> output was definitely a crash in pivy's cast_internal where they were doing
> something naughty with Py_ssize_t.

This is because a simple launch does not result in a crash. But the launch from test 0 - gave out such an exhaust.

Actually the question is, how then to debug a program that works under debugging ???
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-06 20:51:39 UTC
I don't understand how you obtained the previous backtrace then. Are you saying there were multiple problems?

You haven't shared emerge --info, but if you're using systemd, coredumpctl can be helpful here. If using openrc, try minicoredumper.
Comment 12 KosmiK 2022-11-07 08:36:03 UTC
(In reply to Sam James from comment #11) 
> You haven't shared emerge --info, but if you're using systemd, coredumpctl
> can be helpful here. If using openrc, try minicoredumper.

Nekrobook /home/kosmik2001 # emerge --info
Portage 3.0.38.1 (python 3.10.8-final-0, default/linux/amd64/17.1/desktop/systemd, gcc-11.3.0, glibc-2.35-r8, 5.15.75-gentoo x86_64)
=================================================================
System uname: Linux-5.15.75-gentoo-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T9300_@_2.50GHz-with-glibc2.35
KiB Mem:     4030052 total,     57572 free
KiB Swap:   18874356 total,  18873332 free
Timestamp of repository gentoo: Sun, 06 Nov 2022 19:45:01 +0000
Head commit of repository gentoo: 192feaa6ce3298158238a077b78bd9b797dac35d
Head commit of repository compiz-reloaded: ac5fb6fd84401ebd99d4238192e8063b602e6d89

Head commit of repository nvidia-legacy: a1cba083e9f884716872e0fa97767f5b02648298

sh bash 5.1_p16-r2
ld GNU ld (Gentoo 2.38 p4) 2.38
ccache version 4.5.1 [enabled]
app-misc/pax-utils:        1.3.5::gentoo
app-shells/bash:           5.1_p16-r2::gentoo
dev-java/java-config:      2.3.1::gentoo
dev-lang/perl:             5.34.1-r4::gentoo
dev-lang/python:           2.7.18_p16::gentoo, 3.8.15_p2::gentoo, 3.10.8_p2::gentoo
dev-lang/rust-bin:         1.60.0::gentoo
dev-util/ccache:           4.5.1::gentoo
dev-util/cmake:            3.24.2::gentoo
dev-util/meson:            0.63.2-r1::gentoo
sys-apps/baselayout:       2.8::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-apps/systemd:          251.4::gentoo
sys-devel/autoconf:        2.71-r1::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.38-r2::gentoo
sys-devel/binutils-config: 5.4.1::gentoo
sys-devel/clang:           14.0.6-r1::gentoo
sys-devel/gcc:             11.3.0::gentoo
sys-devel/gcc-config:      2.8::gentoo
sys-devel/libtool:         2.4.7::gentoo
sys-devel/llvm:            14.0.6-r2::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  5.15-r3::gentoo (virtual/os-headers)
sys-libs/glibc:            2.35-r8::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.ru.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-extra-opts: 

compiz-reloaded
    location: /var/db/repos/compiz-reloaded
    sync-type: git
    sync-uri: https://github.com/ethus3h/compiz-reloaded-overlay.git
    masters: gentoo

my_local
    location: /var/db/repos/my_local
    masters: gentoo

nvidia-legacy
    location: /var/db/repos/nvidia-legacy
    sync-type: git
    sync-uri: https://gitlab.com/shibotto/nvidia-legacy
    masters: gentoo

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -mtune=native -fomit-frame-pointer -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=native -mtune=native -fomit-frame-pointer -pipe"
DISTDIR="/var/tmp/distfiles"
EMERGE_DEFAULT_OPTS="--jobs 1 --quiet-build=y"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -march=native -mtune=native -fomit-frame-pointer -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live candy ccache cgroup collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync metadata-transfer multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -march=native -mtune=native -fomit-frame-pointer -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="ru_RU.UTF-8"
LC_ALL="ru_RU.UTF-8"
LDFLAGS="-Wl,--as-needed"
LINGUAS="ru ru_RU"
MAKEOPTS="-j 2"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="X a52 aac acl acpi alsa amd64 apng appindicator bluetooth branding bzip2 cairo cdda cdr cli crypt dbus dri dts dvd dvdr encode exif flac fontconfig fortran gdbm gif gnome-keyring gpm gtk gtk3 gui iconv icu introspection ithreads jpeg jpeg2k lcms libglvnd libkms libnotify libtirpc lz4 lzma lzo mad mng mp3 mp4 mpeg multilib ncurses netspeed nls nptl ogg opengl pam pango pcre pdf pm-utils png policykit ppds pulseaudio qt5 readline sdl seccomp spell split-usr ssl startup-notification svg syslog systemd test-rust threads tiff truetype udev udisks unicode upower usb vorbis vulcan wayland wmf wxwidgets x264 xattr xcb xinerama xml xmp xv xvid zlib zstd" ABI_X86="64" ADA_TARGET="gnat_2020" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_core authn_file authz_core authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid charset_lite deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif socache_shmcb speling status unique_id unixd userdir usertrack vhost_alias auth_digest cache_disk ratelimit remoteip slotmem_shm proxy proxy_connect proxy_http proxy_http2 proxy_scgi proxy_wstunne" APACHE2_MPMS="worker" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 sse4_1 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" L10N="ru" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="NVPTX" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" QEMU_USER_TARGETS="x86_64" RUBY_TARGETS="ruby27" USERLAND="GNU" VIDEO_CARDS="nouveau nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LD, LEX, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 13 KosmiK 2022-11-07 08:42:46 UTC
(In reply to Sam James from comment #11)
> I don't understand how you obtained the previous backtrace then. Are you
> saying there were multiple problems?

The problem is that when Freecad crashes, no coredump is created.
I am using systemd. Included everything that is possible to get a dump. Checked for sleep 10 & killall -s sigsegv sleep.
The dump is being created.

I received the attached backtrace when I realized that there was no way to get it naturally. And I decided to run test 0, in the hope that there will be a trace from gdb. And freecad crashed. But now, as I understand it - I got into some other error, not related to the main one.
The question is, what are the differences in running through gdb and directly. And how is /usr/bin/pzstd involved?
Comment 14 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-07 08:50:29 UTC
I still don't get how zstd is related here at all. Explain it again?

As for the coredump: you said it's being created. So do you see it in coredumpctl?

You may need to follow this: https://unix.stackexchange.com/questions/688000/core-dump-not-written-on-segmentation-fault.

The reason crashes sometimes happen only not under a debugger is because debuggers slow things down.

Also, is the crash you were able to give me a stacktrace for earlier fixed at least?
Comment 15 KosmiK 2022-11-07 09:41:29 UTC
(In reply to Sam James from comment #14)
> I still don't get how zstd is related here at all. Explain it again?
I rolled back to the working state of the system.
And start to update one package at a time.
After updating zstd, Freecad started crashing.
Then I returned zstd from the zstd-1.5.2.tbz2 backup.
Freecad is up and running. I rebuilt zstd again. Freecad crashed. And compared for each file. The differences were in pzstd.
 
> As for the coredump: you said it's being created. So do you see it in
> coredumpctl?
No, he doesn't. Although the coredump files are in /tmp/.
 
> Also, is the crash you were able to give me a stacktrace for earlier fixed
> at least?
No, here is link to new one
https://pastebin.com/Pt6hePi0
Comment 16 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-07 09:48:49 UTC
What was the bad version of zstd?
Comment 17 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-07 09:49:27 UTC
If the core dumps are in /tmp, run gdb on them to get a backtrace.
Comment 18 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-07 09:52:29 UTC
Also, if you rebuild freecad after upgrading zstd, does that help?

(FWIW your pastebin backtrace is different from the original, which is good)
Comment 19 KosmiK 2022-11-07 09:54:04 UTC
(In reply to Sam James from comment #16)
> What was the bad version of zstd?
Problem not in version. Problem in fact of recompilation.
Comment 20 KosmiK 2022-11-07 09:54:58 UTC
(In reply to Sam James from comment #17)
> If the core dumps are in /tmp, run gdb on them to get a backtrace.

These are coredump from the killed sleep 20 command. Not from FreeCad.
Comment 21 KosmiK 2022-11-07 09:59:18 UTC
(In reply to Sam James from comment #18)
> Also, if you rebuild freecad after upgrading zstd, does that help?
> 
> (FWIW your pastebin backtrace is different from the original, which is good)
Sure thing, i rebuilded. And also did try on -9999 ebuild. Useless.

I have a feeling that something global has changed. But I have no idea what and where to pick. And I don't have any experience with it.
Comment 22 KosmiK 2022-11-07 09:59:25 UTC
(In reply to Sam James from comment #18)
> Also, if you rebuild freecad after upgrading zstd, does that help?
> 
> (FWIW your pastebin backtrace is different from the original, which is good)
Sure thing, i rebuilded. And also did try on -9999 ebuild. Useless.

I have a feeling that something global has changed. But I have no idea what and where to pick. And I don't have any experience with it.
Comment 23 KosmiK 2022-11-07 10:19:38 UTC
It seems to me, or did I erase someone's comment and duplicate my own?
Comment 24 KosmiK 2022-11-08 10:32:45 UTC
looks like problem not just in /usr/bin/pzstd, but in /usr/lib64/libzstd** also.
And ldd -d /usr/bin/freecad showing link to dat lib.
Comment 25 Bernd 2022-12-12 07:04:32 UTC
According to lddtree, the path for FC to libzstd is like

freecad -> libFreeCADGui.so -> libCoin.so.80 -> libsimage.so.20 -> libtiff.so.5 -> libzstd.so.1

Pivy, being python bindings to coin, eventually is just the messenger of an issue somewhere else.