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

Crash after closing the last of multiple windows in --single-process mode #1898

Open
gunterkoenigsmann opened this issue Mar 5, 2024 · 9 comments

Comments

@gunterkoenigsmann
Copy link
Member

Backtrace:

==596973== Invalid read of size 8
==596973==    at 0x5795E70: pubsync (streambuf:278)
==596973==    by 0x5795E70: std::ostream::flush() (ostream.tcc:237)
==596973==    by 0x5713715: std::ios_base::Init::~Init() (ios_init.cc:134)
==596973==    by 0x5A21371: __cxa_finalize (cxa_finalize.c:82)
==596973==    by 0x56FCAD6: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.33)
==596973==    by 0x40010F1: _dl_call_fini (dl-call_fini.c:43)
==596973==    by 0x4005577: _dl_fini (dl-fini.c:114)
==596973==    by 0x5A21A65: __run_exit_handlers (exit.c:108)
==596973==    by 0x5A21BAD: exit (exit.c:138)
==596973==    by 0x5A041D0: (below main) (libc_start_call_main.h:74)
==596973==  Address 0x151fcfe8 is 712 bytes inside an unallocated block of size 1,776 in arena "client"
==596973== 
==596973== Invalid read of size 8
==596973==    at 0x5795E70: pubsync (streambuf:278)
==596973==    by 0x5795E70: std::ostream::flush() (ostream.tcc:237)
==596973==    by 0x579600F: std::ostream::sentry::sentry(std::ostream&) (ostream.tcc:52)
==596973==    by 0x5795E5A: std::ostream::flush() (ostream.tcc:231)
==596973==    by 0x5713721: std::ios_base::Init::~Init() (ios_init.cc:135)
==596973==    by 0x5A21371: __cxa_finalize (cxa_finalize.c:82)
==596973==    by 0x56FCAD6: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.33)
==596973==    by 0x40010F1: _dl_call_fini (dl-call_fini.c:43)
==596973==    by 0x4005577: _dl_fini (dl-fini.c:114)
==596973==    by 0x5A21A65: __run_exit_handlers (exit.c:108)
==596973==    by 0x5A21BAD: exit (exit.c:138)
==596973==    by 0x5A041D0: (below main) (libc_start_call_main.h:74)
==596973==  Address 0x151fcfe8 is 712 bytes inside an unallocated block of size 1,776 in arena "client"
==596973== 
==596973== 

std::ios_base is used for internal housekeeping of c++ streams: https://en.cppreference.com/w/cpp/io/ios_base/Init

Possible reasons for this crash:

  • Something overwrites an internal pointer of libstdc++ in a way that it points to the wrong location on exiting the program. Argument against it: This error follows us for years. It is inprobable that we always manage to overwrite the exact memory location this pointer is in while the rest seems to work.
  • Linking with concurring libraries: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236344
  • Some library wxMaxima uses creates that internal object too late - which means it is destroyed too early
@gunterkoenigsmann
Copy link
Member Author

The libraries my wxMaxima is linked with according to ldd:

        linux-vdso.so.1 (0x00007ffeab1aa000)
        libwx_gtk3u_richtext-3.2.so.0 => /lib/x86_64-linux-gnu/libwx_gtk3u_richtext-3.2.so.0 (0x00007750b3000000)
        libwx_gtk3u_aui-3.2.so.0 => /lib/x86_64-linux-gnu/libwx_gtk3u_aui-3.2.so.0 (0x00007750b3cd4000)
        libwx_gtk3u_webview-3.2.so.0 => /lib/x86_64-linux-gnu/libwx_gtk3u_webview-3.2.so.0 (0x00007750b3ca7000)
        libwx_gtk3u_core-3.2.so.0 => /lib/x86_64-linux-gnu/libwx_gtk3u_core-3.2.so.0 (0x00007750b2600000)
        libwx_baseu_xml-3.2.so.0 => /lib/x86_64-linux-gnu/libwx_baseu_xml-3.2.so.0 (0x00007750b3c93000)
        libwx_baseu_net-3.2.so.0 => /lib/x86_64-linux-gnu/libwx_baseu_net-3.2.so.0 (0x00007750b3c3a000)
        libwx_baseu-3.2.so.0 => /lib/x86_64-linux-gnu/libwx_baseu-3.2.so.0 (0x00007750b2200000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007750b1e00000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007750b3317000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007750b3c0d000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007750b1a00000)
        libwx_gtk3u_html-3.2.so.0 => /lib/x86_64-linux-gnu/libwx_gtk3u_html-3.2.so.0 (0x00007750b324a000)
        libgtk-3.so.0 => /lib/x86_64-linux-gnu/libgtk-3.so.0 (0x00007750b1200000)
        libgdk-3.so.0 => /lib/x86_64-linux-gnu/libgdk-3.so.0 (0x00007750b2f05000)
        libgobject-2.0.so.0 => /lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007750b2ea2000)
        libgio-2.0.so.0 => /lib/x86_64-linux-gnu/libgio-2.0.so.0 (0x00007750b1c32000)
        libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007750b24b7000)
        libwebkit2gtk-4.1.so.0 => /lib/x86_64-linux-gnu/libwebkit2gtk-4.1.so.0 (0x00007750aca00000)
        libjavascriptcoregtk-4.1.so.0 => /lib/x86_64-linux-gnu/libjavascriptcoregtk-4.1.so.0 (0x00007750aae00000)
        libpangocairo-1.0.so.0 => /lib/x86_64-linux-gnu/libpangocairo-1.0.so.0 (0x00007750b3bf8000)
        libpango-1.0.so.0 => /lib/x86_64-linux-gnu/libpango-1.0.so.0 (0x00007750b2e37000)
        libcairo.so.2 => /lib/x86_64-linux-gnu/libcairo.so.2 (0x00007750b20b9000)
        libgdk_pixbuf-2.0.so.0 => /lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 (0x00007750b321c000)
        libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007750aacc2000)
        libSM.so.6 => /lib/x86_64-linux-gnu/libSM.so.6 (0x00007750b3beb000)
        libxkbcommon.so.0 => /lib/x86_64-linux-gnu/libxkbcommon.so.0 (0x00007750b246e000)
        libnotify.so.4 => /lib/x86_64-linux-gnu/libnotify.so.4 (0x00007750b3bde000)
        libXtst.so.6 => /lib/x86_64-linux-gnu/libXtst.so.6 (0x00007750b3bd4000)
        libpangoft2-1.0.so.0 => /lib/x86_64-linux-gnu/libpangoft2-1.0.so.0 (0x00007750b2454000)
        libfontconfig.so.1 => /lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007750b11af000)
        libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007750b2081000)
        libjpeg.so.8 => /lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007750b112c000)
        libtiff.so.6 => /lib/x86_64-linux-gnu/libtiff.so.6 (0x00007750ac973000)
        libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007750b19d5000)
        libcurl.so.4 => /lib/x86_64-linux-gnu/libcurl.so.4 (0x00007750aac01000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007750b1c13000)
        liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007750b10fa000)
        libpcre2-32.so.0 => /lib/x86_64-linux-gnu/libpcre2-32.so.0 (0x00007750aab7b000)
        /lib64/ld-linux-x86-64.so.2 (0x00007750b3da9000)
        libgmodule-2.0.so.0 => /lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007750b3215000)
        libharfbuzz.so.0 => /lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007750aaa6e000)
        libfribidi.so.0 => /lib/x86_64-linux-gnu/libfribidi.so.0 (0x00007750ac955000)
        libcairo-gobject.so.2 => /lib/x86_64-linux-gnu/libcairo-gobject.so.2 (0x00007750b320a000)
        libatk-1.0.so.0 => /lib/x86_64-linux-gnu/libatk-1.0.so.0 (0x00007750aaa45000)
        libepoxy.so.0 => /lib/x86_64-linux-gnu/libepoxy.so.0 (0x00007750aa910000)
        libXi.so.6 => /lib/x86_64-linux-gnu/libXi.so.6 (0x00007750aa8fd000)
        libatk-bridge-2.0.so.0 => /lib/x86_64-linux-gnu/libatk-bridge-2.0.so.0 (0x00007750aa8c1000)
        libXfixes.so.3 => /lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007750b244c000)
        libwayland-client.so.0 => /lib/x86_64-linux-gnu/libwayland-client.so.0 (0x00007750ac944000)
        libwayland-cursor.so.0 => /lib/x86_64-linux-gnu/libwayland-cursor.so.0 (0x00007750b19cb000)
        libwayland-egl.so.1 => /lib/x86_64-linux-gnu/libwayland-egl.so.1 (0x00007750b3205000)
        libXext.so.6 => /lib/x86_64-linux-gnu/libXext.so.6 (0x00007750aa8ac000)
        libXcursor.so.1 => /lib/x86_64-linux-gnu/libXcursor.so.1 (0x00007750aa8a0000)
        libXdamage.so.1 => /lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007750b2e32000)
        libXcomposite.so.1 => /lib/x86_64-linux-gnu/libXcomposite.so.1 (0x00007750b19c6000)
        libXrandr.so.2 => /lib/x86_64-linux-gnu/libXrandr.so.2 (0x00007750aa893000)
        libXinerama.so.1 => /lib/x86_64-linux-gnu/libXinerama.so.1 (0x00007750aa88e000)
        libffi.so.8 => /lib/x86_64-linux-gnu/libffi.so.8 (0x00007750aa882000)
        libmount.so.1 => /lib/x86_64-linux-gnu/libmount.so.1 (0x00007750aa835000)
        libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007750aa808000)
        libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007750aa76d000)
        libdrm.so.2 => /lib/x86_64-linux-gnu/libdrm.so.2 (0x00007750aa756000)
        libicui18n.so.74 => /lib/x86_64-linux-gnu/libicui18n.so.74 (0x00007750aa400000)
        libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007750aa321000)
        libicuuc.so.74 => /lib/x86_64-linux-gnu/libicuuc.so.74 (0x00007750aa000000)
        libxml2.so.2 => /lib/x86_64-linux-gnu/libxml2.so.2 (0x00007750a9e1e000)
        libsqlite3.so.0 => /lib/x86_64-linux-gnu/libsqlite3.so.0 (0x00007750a9cb6000)
        libxslt.so.1 => /lib/x86_64-linux-gnu/libxslt.so.1 (0x00007750aa2e0000)
        liblcms2.so.2 => /lib/x86_64-linux-gnu/liblcms2.so.2 (0x00007750aa27d000)
        libwoff2dec.so.1.0.2 => /lib/x86_64-linux-gnu/libwoff2dec.so.1.0.2 (0x00007750aa271000)
        libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007750a9bea000)
        libharfbuzz-icu.so.0 => /lib/x86_64-linux-gnu/libharfbuzz-icu.so.0 (0x00007750aa751000)
        libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007750a9aa2000)
        libgstallocators-1.0.so.0 => /lib/x86_64-linux-gnu/libgstallocators-1.0.so.0 (0x00007750aa26a000)
        libgstapp-1.0.so.0 => /lib/x86_64-linux-gnu/libgstapp-1.0.so.0 (0x00007750aa255000)
        libgstbase-1.0.so.0 => /lib/x86_64-linux-gnu/libgstbase-1.0.so.0 (0x00007750a9a1e000)
        libgstreamer-1.0.so.0 => /lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 (0x00007750a98ce000)
        libgstpbutils-1.0.so.0 => /lib/x86_64-linux-gnu/libgstpbutils-1.0.so.0 (0x00007750aa211000)
        libgstaudio-1.0.so.0 => /lib/x86_64-linux-gnu/libgstaudio-1.0.so.0 (0x00007750a984e000)
        libgsttag-1.0.so.0 => /lib/x86_64-linux-gnu/libgsttag-1.0.so.0 (0x00007750a980d000)
        libgstvideo-1.0.so.0 => /lib/x86_64-linux-gnu/libgstvideo-1.0.so.0 (0x00007750a9741000)
        libgstgl-1.0.so.0 => /lib/x86_64-linux-gnu/libgstgl-1.0.so.0 (0x00007750a96ba000)
        libgstfft-1.0.so.0 => /lib/x86_64-linux-gnu/libgstfft-1.0.so.0 (0x00007750a96af000)
        libopenjp2.so.7 => /lib/x86_64-linux-gnu/libopenjp2.so.7 (0x00007750a964f000)
        libwebpdemux.so.2 => /lib/x86_64-linux-gnu/libwebpdemux.so.2 (0x00007750a9648000)
        libwebp.so.7 => /lib/x86_64-linux-gnu/libwebp.so.7 (0x00007750a95cd000)
        libsoup-3.0.so.0 => /lib/x86_64-linux-gnu/libsoup-3.0.so.0 (0x00007750a9534000)
        libenchant-2.so.2 => /lib/x86_64-linux-gnu/libenchant-2.so.2 (0x00007750a9527000)
        libsecret-1.so.0 => /lib/x86_64-linux-gnu/libsecret-1.so.0 (0x00007750a94c9000)
        libtasn1.so.6 => /lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007750a94b2000)
        libhyphen.so.0 => /lib/x86_64-linux-gnu/libhyphen.so.0 (0x00007750a94ab000)
        libwayland-server.so.0 => /lib/x86_64-linux-gnu/libwayland-server.so.0 (0x00007750a9495000)
        libmanette-0.2.so.0 => /lib/x86_64-linux-gnu/libmanette-0.2.so.0 (0x00007750a9465000)
        libseccomp.so.2 => /lib/x86_64-linux-gnu/libseccomp.so.2 (0x00007750a9445000)
        libgbm.so.1 => /lib/x86_64-linux-gnu/libgbm.so.1 (0x00007750a9434000)
        libatomic.so.1 => /lib/x86_64-linux-gnu/libatomic.so.1 (0x00007750a942a000)
        libthai.so.0 => /lib/x86_64-linux-gnu/libthai.so.0 (0x00007750a941d000)
        libXrender.so.1 => /lib/x86_64-linux-gnu/libXrender.so.1 (0x00007750a9410000)
        libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007750a93e6000)
        libxcb-render.so.0 => /lib/x86_64-linux-gnu/libxcb-render.so.0 (0x00007750a93d8000)
        libxcb-shm.so.0 => /lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007750a93d3000)
        libpixman-1.so.0 => /lib/x86_64-linux-gnu/libpixman-1.so.0 (0x00007750a9325000)
        libICE.so.6 => /lib/x86_64-linux-gnu/libICE.so.6 (0x00007750a9308000)
        libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007750a92fe000)
        libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007750a9247000)
        libLerc.so.4 => /lib/x86_64-linux-gnu/libLerc.so.4 (0x00007750a91c0000)
        libjbig.so.0 => /lib/x86_64-linux-gnu/libjbig.so.0 (0x00007750a91ad000)
        libdeflate.so.0 => /lib/x86_64-linux-gnu/libdeflate.so.0 (0x00007750a919a000)
        libnghttp2.so.14 => /lib/x86_64-linux-gnu/libnghttp2.so.14 (0x00007750a916f000)
        libidn2.so.0 => /lib/x86_64-linux-gnu/libidn2.so.0 (0x00007750a914d000)
        librtmp.so.1 => /lib/x86_64-linux-gnu/librtmp.so.1 (0x00007750a912e000)
        libssh.so.4 => /lib/x86_64-linux-gnu/libssh.so.4 (0x00007750a90bb000)
        libpsl.so.5 => /lib/x86_64-linux-gnu/libpsl.so.5 (0x00007750a90a7000)
        libssl.so.3 => /lib/x86_64-linux-gnu/libssl.so.3 (0x00007750a9002000)
        libcrypto.so.3 => /lib/x86_64-linux-gnu/libcrypto.so.3 (0x00007750a8a00000)
        libgssapi_krb5.so.2 => /lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007750a8fae000)
        libldap.so.2 => /lib/x86_64-linux-gnu/libldap.so.2 (0x00007750a8f51000)
        liblber.so.2 => /lib/x86_64-linux-gnu/liblber.so.2 (0x00007750a8f3f000)
        libbrotlidec.so.1 => /lib/x86_64-linux-gnu/libbrotlidec.so.1 (0x00007750a8f31000)
        libgraphite2.so.3 => /lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007750a8f0b000)
        libatspi.so.0 => /lib/x86_64-linux-gnu/libatspi.so.0 (0x00007750a89c8000)
        libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007750a8979000)
        libblkid.so.1 => /lib/x86_64-linux-gnu/libblkid.so.1 (0x00007750a893e000)
        libcap.so.2 => /lib/x86_64-linux-gnu/libcap.so.2 (0x00007750a8efc000)
        liblz4.so.1 => /lib/x86_64-linux-gnu/liblz4.so.1 (0x00007750a891b000)
        libicudata.so.74 => /lib/x86_64-linux-gnu/libicudata.so.74 (0x00007750a6a00000)
        libwoff2common.so.1.0.2 => /lib/x86_64-linux-gnu/libwoff2common.so.1.0.2 (0x00007750a8916000)
        libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007750a8900000)
        libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007750a88db000)
        libunwind.so.8 => /lib/x86_64-linux-gnu/libunwind.so.8 (0x00007750a88bf000)
        libdw.so.1 => /lib/x86_64-linux-gnu/libdw.so.1 (0x00007750a880c000)
        liborc-0.4.so.0 => /lib/x86_64-linux-gnu/liborc-0.4.so.0 (0x00007750a8773000)
        libGL.so.1 => /lib/x86_64-linux-gnu/libGL.so.1 (0x00007750a6979000)
        libEGL.so.1 => /lib/x86_64-linux-gnu/libEGL.so.1 (0x00007750a6966000)
        libX11-xcb.so.1 => /lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007750a876c000)
        libgudev-1.0.so.0 => /lib/x86_64-linux-gnu/libgudev-1.0.so.0 (0x00007750a6958000)
        libsharpyuv.so.0 => /lib/x86_64-linux-gnu/libsharpyuv.so.0 (0x00007750a8764000)
        libevdev.so.2 => /lib/x86_64-linux-gnu/libevdev.so.2 (0x00007750a693a000)
        libxcb-randr.so.0 => /lib/x86_64-linux-gnu/libxcb-randr.so.0 (0x00007750a6928000)
        libdatrie.so.1 => /lib/x86_64-linux-gnu/libdatrie.so.1 (0x00007750a691f000)
        libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007750a6919000)
        libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007750a6911000)
        libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007750a68fb000)
        libunistring.so.5 => /lib/x86_64-linux-gnu/libunistring.so.5 (0x00007750a674e000)
        libgnutls.so.30 => /lib/x86_64-linux-gnu/libgnutls.so.30 (0x00007750a6555000)
        libhogweed.so.6 => /lib/x86_64-linux-gnu/libhogweed.so.6 (0x00007750a650c000)
        libnettle.so.8 => /lib/x86_64-linux-gnu/libnettle.so.8 (0x00007750a64b7000)
        libgmp.so.10 => /lib/x86_64-linux-gnu/libgmp.so.10 (0x00007750a6430000)
        libkrb5.so.3 => /lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007750a6367000)
        libk5crypto.so.3 => /lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007750a633b000)
        libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007750a6335000)
        libkrb5support.so.0 => /lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007750a6328000)
        libsasl2.so.2 => /lib/x86_64-linux-gnu/libsasl2.so.2 (0x00007750a630c000)
        libbrotlicommon.so.1 => /lib/x86_64-linux-gnu/libbrotlicommon.so.1 (0x00007750a62e9000)
        libelf.so.1 => /lib/x86_64-linux-gnu/libelf.so.1 (0x00007750a62cc000)
        libGLdispatch.so.0 => /lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007750a6214000)
        libGLX.so.0 => /lib/x86_64-linux-gnu/libGLX.so.0 (0x00007750a61e1000)
        libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007750a61ac000)
        libmd.so.0 => /lib/x86_64-linux-gnu/libmd.so.0 (0x00007750a619d000)
        libp11-kit.so.0 => /lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007750a5ff9000)
        libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007750a5ff2000)
        libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007750a5fdf000)

@gunterkoenigsmann
Copy link
Member Author

Resolved with 8cea574

@gunterkoenigsmann
Copy link
Member Author

  • Seems it isn't the ordering in which wxWidgets modules are linked
  • Compiling our own wxWidgets seems not to solve this problem
  • wxWidgets current git head seems not to solve this problem

@gunterkoenigsmann
Copy link
Member Author

Tried a git bisect but to no avail: All versions that are new enough to work on my system either seem to crash even earlier or according to valgrind show this bug, even if it has no symptoms.

@gunterkoenigsmann
Copy link
Member Author

Today's backtrace reads:

#0  0x00007ffff6b50e73 in std::basic_streambuf<char, std::char_traits<char> >::pubsync
    (this=0x555556208848)
    at /build/gcc-14-kKbQBI/gcc-14-14-20240303/build/x86_64-linux-gnu/libstdc++-v3/include/streambuf:278
#1  std::basic_ostream<char, std::char_traits<char> >::flush (this=0x555555d5c940 <std::cout@GLIBCXX_3.4>)
    at /build/gcc-14-kKbQBI/gcc-14-14-20240303/build/x86_64-linux-gnu/libstdc++-v3/include/bits/ostream.tcc:237
#2  0x00007ffff6ace716 in std::ios_base::Init::~Init (this=<optimized out>, __in_chrg=<optimized out>)
    at ../../../../../src/libstdc++-v3/src/c++98/ios_init.cc:134
#3  0x00007ffff6647372 in __cxa_finalize (d=0x7ffff6c78100) at ./stdlib/cxa_finalize.c:82
#4  0x00007ffff6ab7ad7 in __do_global_dtors_aux () at /lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007fffffffd220 in ??? ()
#6  0x00007ffff7fc60f2 in _dl_call_fini (closure_map=0x7ffff7e56ab0) at ./elf/dl-call_fini.c:43

__do_global_dtors_aux would point to call the destructor of a static variable near the end of the process of closing the program.

@gunterkoenigsmann
Copy link
Member Author

asan seems to unable to find this issue which might mean that it really is a crash in a destructor of a static object: asan works mainly on dynamically created stuff.

@gunterkoenigsmann
Copy link
Member Author

Switching to gcc-14 and enabling -Wall -Wextra -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -ftrivial-auto-var-init=pattern -fPIE -pie -Wl,-z,relro,-z,now -fstack-protector-strong -fstack-clash-protection -fcf-protection=full resulted in no new information:

0x00007ffff6b50e73 in std::basic_streambuf<char, std::char_traits<char> >::pubsync (this=0x555556205c08)    
    at /build/gcc-14-kKbQBI/gcc-14-14-20240303/build/x86_64-linux-gnu/libstdc++-v3/include/streambuf:278
warning: 278    /build/gcc-14-kKbQBI/gcc-14-14-20240303/build/x86_64-linux-gnu/libstdc++-v3/include/streambuf: No such file or directory
(gdb) backtrace 
#0  0x00007ffff6b50e73 in std::basic_streambuf<char, std::char_traits<char> >::pubsync
    (this=0x555556205c08)
    at /build/gcc-14-kKbQBI/gcc-14-14-20240303/build/x86_64-linux-gnu/libstdc++-v3/include/streambuf:278
#1  std::basic_ostream<char, std::char_traits<char> >::flush (this=0x555555d3c900 <std::cout@GLIBCXX_3.4>)
    at /build/gcc-14-kKbQBI/gcc-14-14-20240303/build/x86_64-linux-gnu/libstdc++-v3/include/bits/ostream.tcc:237
#2  0x00007ffff6ace716 in std::ios_base::Init::~Init (this=<optimized out>, __in_chrg=<optimized out>)
    at ../../../../../src/libstdc++-v3/src/c++98/ios_init.cc:134
#3  0x00007ffff6647372 in __cxa_finalize (d=0x7ffff6c78100) at ./stdlib/cxa_finalize.c:82
#4  0x00007ffff6ab7ad7 in __do_global_dtors_aux () at /lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007fffffffd220 in ??? ()
#6  0x00007ffff7fc60f2 in _dl_call_fini (closure_map=0x7ffff7e55ab0) at ./elf/dl-call_fini.c:43

@gunterkoenigsmann
Copy link
Member Author

Fun fact: According to gdb wxMaxima creates exactly 2 Standard C++ streams in the teststep it sometimes crashes in. My guess would be: One for stdout and one for stderr. Flushing those on exiting wxMaxima doesn't crash, though...

@gunterkoenigsmann
Copy link
Member Author

Ok... ...according to valgrind the memory corruption that can cause the crash

  • only appears in --single_process mode when multiple windows are handled by the same wxMaxima process.
  • happens on closing the last window, but only if the first window that was opened was closed first.
  • still happens, if the worksheets are all completely empty => nothing in cells/ is involved in the crash.
  • still happens, if none of the sidebars are created => nothing in sidebars/ is involved in the crash
  • still happens, if no dialogues are used => nothing in dialogs/ is involved in the crash
  • still happens, if we don't create background threads => no race condition here is the cause of the crash
  • happens with two wxWidgets versions, two gcc versions,
  • seems to be quite robust: If I move code around we still get exactly the same crash.

Seems like we can rule out quite a bit of things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant