You are not logged in.

#1 2021-03-17 05:52:51

wittawat
Member
Registered: 2021-02-14
Posts: 7

[solved] QT5 application crash due std::bad_alloc

This system previously installed on (Pentium 4417U) and moved to this system.
Old machine everything work fine.

$ yay -S barrier-git # community/barrier also not work
$ barrier

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Aborted (core dumped)
$ uname -a 
# stock kernel also not work
Linux arch 5.11.6-xanmod1-cacule-1-cacule #1 SMP PREEMPT Tue, 16 Mar 2021 15:18:06 +0000 x86_64 GNU/Linux
Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz Sandy Bridge
NVIDIA GeForce GT 730

how can I fix it?

edit: change title from "some AUR application random crash due std::bad_alloc" because I found that qt5 cause this problem

fixed  :
    gcc on my os compiled with native optimized for kabylake cpu so I reinstall gcc and it's work again

Last edited by wittawat (2021-03-18 13:32:51)

Offline

#2 2021-03-17 07:35:22

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,343

Re: [solved] QT5 application crash due std::bad_alloc

That's an error thrown when the program can't allocate new memory. How much RAM do you have and what does it's usage  look like when the issue happens? Do you see the OOM killer being invoked in dmesg or so?

Maybe also post the core dump contents. FWIW what is the differences between the "old system" and the "new system" HW wise?

Last edited by V1del (2021-03-17 08:01:13)

Offline

#3 2021-03-17 13:58:57

wittawat
Member
Registered: 2021-02-14
Posts: 7

Re: [solved] QT5 application crash due std::bad_alloc

V1del wrote:

How much RAM do you have and what does it's usage  look like when the issue happens?

$ free -h
               total        used        free      shared  buff/cache   available
Mem:            15Gi       796Mi        14Gi        56Mi       725Mi        14Gi
Swap:          8.3Gi          0B       8.3Gi
V1del wrote:

Do you see the OOM killer being invoked in dmesg or so?

no?

[  203.637893] audit: type=1701 audit(1615986107.371:79): auid=1000 uid=1000 gid=985 ses=1 subj==unconfined pid=1369 comm="barrier" exe="/usr/bin/barrier" sig=6 res=1
[  203.651477] audit: type=1334 audit(1615986107.385:80): prog-id=14 op=LOAD
[  203.651696] audit: type=1334 audit(1615986107.385:81): prog-id=15 op=LOAD
[  203.652614] audit: type=1130 audit(1615986107.387:82): pid=1 uid=0 auid=4294967295 ses=4294967295 subj==unconfined msg='unit=systemd-coredump@0-1374-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  203.886837] audit: type=1131 audit(1615986107.621:83): pid=1 uid=0 auid=4294967295 ses=4294967295 subj==unconfined msg='unit=systemd-coredump@0-1374-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
V1del wrote:

Maybe also post the core dump contents.

reading this seem any qt based application will crash due std::bad_alloc

           PID: 2594 (barrier)
           UID: 1000 (wittawat)
           GID: 985 (users)
        Signal: 6 (ABRT)
     Timestamp: Wed 2021-03-17 20:15:55 +07 (2min 32s ago)
  Command Line: barrier
    Executable: /usr/bin/barrier
 Control Group: /user.slice/user-1000.slice/session-1.scope
          Unit: session-1.scope
         Slice: user-1000.slice
       Session: 1
     Owner UID: 1000 (wittawat)
       Boot ID: cea29b5e050d467e9b948d2d8265f43a
    Machine ID: 5c22b4268b134d168197137997059125
      Hostname: arch
       Storage: /var/lib/systemd/coredump/core.barrier.1000.cea29b5e050d467e9b948d2d8265f43a.2594.1615986955000000.zst
       Message: Process 2594 (barrier) of user 1000 dumped core.
                
                Stack trace of thread 2594:
                #0  0x00007fed4a5e0ef5 raise (libc.so.6 + 0x3cef5)
                #1  0x00007fed4a5ca862 abort (libc.so.6 + 0x26862)
                #2  0x00007fed4a821855 _ZN9__gnu_cxx27__verbose_terminate_handlerEv (libstdc++.so.6 + 0x96855)
                #3  0x00007fed4a82ddda _ZN10__cxxabiv111__terminateEPFvvE (libstdc++.so.6 + 0xa2dda)
                #4  0x00007fed4a82de47 _ZSt9terminatev (libstdc++.so.6 + 0xa2e47)
                #5  0x00007fed4a82e0ed __cxa_throw (libstdc++.so.6 + 0xa30ed)
                #6  0x00007fed4a8214b8 _ZnwmSt11align_val_t (libstdc++.so.6 + 0x964b8)
                #7  0x00007fed4a8f8366 _ZNSt3pmr15memory_resource8allocateEmm (libstdc++.so.6 + 0x16d366)
                #8  0x00007fed4a8f84ff _ZNSt3pmr25monotonic_buffer_resource11do_allocateEmm (libstdc++.so.6 + 0x16d4ff)
                #9  0x00007fed473f03bd n/a (libQt5XcbQpa.so.5 + 0x963bd)
                #10 0x00007fed473f2aa0 n/a (libQt5XcbQpa.so.5 + 0x98aa0)
                #11 0x00007fed4b0e7265 n/a (libQt5Gui.so.5 + 0x227265)
                #12 0x00007fed4b0e8921 _ZN13QFontDatabase8findFontERK8QFontDefi (libQt5Gui.so.5 + 0x228921)
                #13 0x00007fed4b0e9006 _ZN13QFontDatabase4loadEPK12QFontPrivatei (libQt5Gui.so.5 + 0x229006)
                #14 0x00007fed4b0babec _ZNK12QFontPrivate15engineForScriptEi (libQt5Gui.so.5 + 0x1fabec)
                #15 0x00007fed4b0ef122 n/a (libQt5Gui.so.5 + 0x22f122)
                #16 0x00007fed4b14e0e6 n/a (libQt5Gui.so.5 + 0x28e0e6)
                #17 0x00007fed4b14f585 n/a (libQt5Gui.so.5 + 0x28f585)
                #18 0x00007fed4b157585 n/a (libQt5Gui.so.5 + 0x297585)
                #19 0x00007fed4b157bb6 n/a (libQt5Gui.so.5 + 0x297bb6)
                #20 0x00007fed4b158218 _ZN19QTextDocumentLayout8doLayoutEiii (libQt5Gui.so.5 + 0x298218)
                #21 0x00007fed4b1599ba _ZN19QTextDocumentLayout15documentChangedEiii (libQt5Gui.so.5 + 0x2999ba)
                #22 0x00007fed4be5e8f8 n/a (libQt5Widgets.so.5 + 0x3248f8)
                #23 0x000055da08ad1ee0 n/a (barrier + 0x34ee0)
                #24 0x000055da08ad15b8 n/a (barrier + 0x345b8)
                #25 0x000055da08ad728a n/a (barrier + 0x3a28a)
                #26 0x000055da08aba8b9 n/a (barrier + 0x1d8b9)
                #27 0x00007fed4a5cbb25 __libc_start_main (libc.so.6 + 0x27b25)
                #28 0x000055da08abaf5e n/a (barrier + 0x1df5e)
                
                Stack trace of thread 2598:
                #0  0x00007fed4a69837f __poll (libc.so.6 + 0xf437f)
                #1  0x00007fed49971baf n/a (libglib-2.0.so.0 + 0xa7baf)
                #2  0x00007fed4991c3b1 g_main_context_iteration (libglib-2.0.so.0 + 0x523b1)
                #3  0x00007fed4ac77691 _ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE (libQt5Core.so.5 + 0x30e691)
                #4  0x00007fed4ac1d3ac _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE (libQt5Core.so.5 + 0x2b43ac)
                #5  0x00007fed4aa35d12 _ZN7QThread4execEv (libQt5Core.so.5 + 0xccd12)
                #6  0x00007fed472a0098 n/a (libQt5DBus.so.5 + 0x17098)
                #7  0x00007fed4aa36eff n/a (libQt5Core.so.5 + 0xcdeff)
                #8  0x00007fed4a447299 start_thread (libpthread.so.0 + 0x9299)
                #9  0x00007fed4a6a3053 __clone (libc.so.6 + 0xff053)
                
                Stack trace of thread 2596:
                #0  0x00007fed4a69837f __poll (libc.so.6 + 0xf437f)
                #1  0x00007fed49971baf n/a (libglib-2.0.so.0 + 0xa7baf)
                #2  0x00007fed4991c3b1 g_main_context_iteration (libglib-2.0.so.0 + 0x523b1)
                #3  0x00007fed4991c402 n/a (libglib-2.0.so.0 + 0x52402)
                #4  0x00007fed4994afc1 n/a (libglib-2.0.so.0 + 0x80fc1)
                #5  0x00007fed4a447299 start_thread (libpthread.so.0 + 0x9299)
                #6  0x00007fed4a6a3053 __clone (libc.so.6 + 0xff053)
                
                Stack trace of thread 2595:
                #0  0x00007fed4a69837f __poll (libc.so.6 + 0xf437f)
                #1  0x00007fed4a2f363b n/a (libxcb.so.1 + 0xc63b)
                #2  0x00007fed4a2f537b xcb_wait_for_event (libxcb.so.1 + 0xe37b)
                #3  0x00007fed473b8131 n/a (libQt5XcbQpa.so.5 + 0x5e131)
                #4  0x00007fed4aa36eff n/a (libQt5Core.so.5 + 0xcdeff)
                #5  0x00007fed4a447299 start_thread (libpthread.so.0 + 0x9299)
                #6  0x00007fed4a6a3053 __clone (libc.so.6 + 0xff053)
                
                Stack trace of thread 2597:
                #0  0x00007fed4a69837f __poll (libc.so.6 + 0xf437f)
                #1  0x00007fed49971baf n/a (libglib-2.0.so.0 + 0xa7baf)
                #2  0x00007fed4991d0d3 g_main_loop_run (libglib-2.0.so.0 + 0x530d3)
                #3  0x00007fed45ed1d18 n/a (libgio-2.0.so.0 + 0x101d18)
                #4  0x00007fed4994afc1 n/a (libglib-2.0.so.0 + 0x80fc1)
                #5  0x00007fed4a447299 start_thread (libpthread.so.0 + 0x9299)
                #6  0x00007fed4a6a3053 __clone (libc.so.6 + 0xff053)
V1del wrote:

FWIW what is the differences between the "old system" and the "new system" HW wise?

maybe it's not your ask but I'm sure that new HW is better than old HW.

previously I used kabylake pentium laptop and 8gb ram because it's very cheap laptop (at jun 2018). and then this year (feb 2021) I thought I want to learn linux agressively by use arch linux as primary OS, but I've fun with configuring/recompile kernel and application, and then I found that used-ancient xeon is cheap but having a better multicore score than corei at the same price.
so I use my savings to buy this ancient system (cpu+16 gb ecc ram+motherboard is only 137 usd, and gpu I borrow gt730 from my friend).

maybe it's problem at qt5 and nvidia

Last edited by wittawat (2021-03-17 14:53:39)

Offline

#4 2021-03-17 15:01:21

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,550

Re: [solved] QT5 application crash due std::bad_alloc

Could easily be a stack corruption.
Do other Qt applications crash (with similar backtraces)?

QTextDocumentLayout::doLayout
…
QFontDatabase::findFont
libQt5XcbQpa.so.5

Crashes in the xcb QPA when attempting to resolve a font.
a) fc-match sans
b) echo $XDG_SESSION_TYPE; loginctl session-status # wayland?

Offline

#5 2021-03-17 15:43:41

wittawat
Member
Registered: 2021-02-14
Posts: 7

Re: [solved] QT5 application crash due std::bad_alloc

seth wrote:

Do other Qt applications crash (with similar backtraces)?

yes

$ wireshark
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Aborted (core dumped)

$ qjackctl 
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Aborted (core dumped)
$ fc-match sans
Verdana.TTF: "Verdana" "Regular"

$ echo $XDG_SESSION_TYPE
x11

$ loginctl session-status
2 - wittawat (1000)
           Since: Wed 2021-03-17 22:39:36 +07; 1min 31s ago
          Leader: 600 (lightdm)
            Seat: seat0; vc7
         Display: :0
         Service: lightdm; type x11; class user
         Desktop: xfce
           State: active

Offline

#6 2021-03-17 16:09:09

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,550

Re: [solved] QT5 application crash due std::bad_alloc

pacman -Qikk qt5-base
ldd /usr/bin/qjackctl

Do you use a 3rd party visual style?

Offline

#7 2021-03-17 16:44:53

wittawat
Member
Registered: 2021-02-14
Posts: 7

Re: [solved] QT5 application crash due std::bad_alloc

seth wrote:

Do you use a 3rd party visual style?

no

$ pacman -Qikk qt5-base
Name            : qt5-base
Version         : 5.15.2-5
Description     : A cross-platform application and UI framework
Architecture    : x86_64
URL             : https://www.qt.io
Licenses        : GPL3  LGPL3  FDL  custom
Groups          : qt  qt5
Provides        : None
Depends On      : libjpeg-turbo  xcb-util-keysyms  xcb-util-renderutil  libgl  fontconfig  xdg-utils  shared-mime-info
                  xcb-util-wm  libxrender  libxi  sqlite  xcb-util-image  mesa  tslib  libinput  libxkbcommon-x11
                  libproxy  libcups  double-conversion  md4c
Optional Deps   : qt5-svg: to use SVG icon themes [installed]
                  qt5-wayland: to run Qt applications in a Wayland session
                  qt5-translations: for some native UI translations
                  postgresql-libs: PostgreSQL driver [installed]
                  mariadb-libs: MariaDB driver [installed]
                  unixodbc: ODBC driver
                  libfbclient: Firebird/iBase driver
                  freetds: MS SQL driver
                  gtk3: GTK platform plugin [installed]
                  perl: for fixqt4headers and syncqt [installed]
Required By     : barrier-git  multimc5  python-pyqt5  qt5-declarative  qt5-multimedia  qt5-sensors  qt5-svg  qt5-tools
                  qt5-websockets  qt5-x11extras  shotcut  vlc
Optional For    : avahi  cmake  doxygen  graphviz  libde265  openal  pinentry  v4l-utils
Conflicts With  : qtchooser
Replaces        : None
Installed Size  : 64.02 MiB
Packager        : Antonio Rojas <arojas@archlinux.org>
Build Date      : Thu 11 Feb 2021 04:18:45 AM +07
Install Date    : Wed 17 Mar 2021 08:23:25 PM +07
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature

qt5-base: 3861 total files, 0 altered files

$ ldd /usr/bin/qjackctl
	linux-vdso.so.1 (0x00007fffc32c9000)
	libjack.so.0 => /usr/lib/libjack.so.0 (0x00007f2d80dc8000)
	libasound.so.2 => /usr/lib/libasound.so.2 (0x00007f2d80ce9000)
	libQt5Widgets.so.5 => /usr/lib/libQt5Widgets.so.5 (0x00007f2d80655000)
	libQt5Gui.so.5 => /usr/lib/libQt5Gui.so.5 (0x00007f2d7ff87000)
	libQt5DBus.so.5 => /usr/lib/libQt5DBus.so.5 (0x00007f2d7ff01000)
	libQt5Network.so.5 => /usr/lib/libQt5Network.so.5 (0x00007f2d7fd7f000)
	libQt5Xml.so.5 => /usr/lib/libQt5Xml.so.5 (0x00007f2d7fd3a000)
	libQt5Core.so.5 => /usr/lib/libQt5Core.so.5 (0x00007f2d7f7e5000)
	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f2d7f7c4000)
	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f2d7f5e6000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007f2d7f4a1000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f2d7f487000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f2d7f2b8000)
	libdb-5.3.so => /usr/lib/libdb-5.3.so (0x00007f2d7f0f9000)
	libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f2d7f0f2000)
	librt.so.1 => /usr/lib/librt.so.1 (0x00007f2d7f0e7000)
	/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f2d80f56000)
	libGL.so.1 => /usr/lib/libGL.so.1 (0x00007f2d7f061000)
	libpng16.so.16 => /usr/lib/libpng16.so.16 (0x00007f2d7f02a000)
	libz.so.1 => /usr/lib/libz.so.1 (0x00007f2d7f00e000)
	libharfbuzz.so.0 => /usr/lib/libharfbuzz.so.0 (0x00007f2d7ef3a000)
	libmd4c.so.0 => /usr/lib/libmd4c.so.0 (0x00007f2d7ef25000)
	libdbus-1.so.3 => /usr/lib/libdbus-1.so.3 (0x00007f2d7eed0000)
	libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00007f2d7ee7b000)
	libssl.so.1.1 => /usr/lib/libssl.so.1.1 (0x00007f2d7edea000)
	libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1 (0x00007f2d7eb0a000)
	libsystemd.so.0 => /usr/lib/libsystemd.so.0 (0x00007f2d7ea54000)
	libdouble-conversion.so.3 => /usr/lib/libdouble-conversion.so.3 (0x00007f2d7ea3d000)
	libicui18n.so.68 => /usr/lib/libicui18n.so.68 (0x00007f2d7e71e000)
	libicuuc.so.68 => /usr/lib/libicuuc.so.68 (0x00007f2d7e52f000)
	libpcre2-16.so.0 => /usr/lib/libpcre2-16.so.0 (0x00007f2d7e4a4000)
	libzstd.so.1 => /usr/lib/libzstd.so.1 (0x00007f2d7e3c8000)
	libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007f2d7e293000)
	libGLdispatch.so.0 => /usr/lib/libGLdispatch.so.0 (0x00007f2d7e1dc000)
	libGLX.so.0 => /usr/lib/libGLX.so.0 (0x00007f2d7e1a9000)
	libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f2d7e0d5000)
	libgraphite2.so.3 => /usr/lib/libgraphite2.so.3 (0x00007f2d7e0ae000)
	libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00007f2d7dfc8000)
	libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00007f2d7df97000)
	libcom_err.so.2 => /usr/lib/libcom_err.so.2 (0x00007f2d7df91000)
	libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00007f2d7df82000)
	libkeyutils.so.1 => /usr/lib/libkeyutils.so.1 (0x00007f2d7df7b000)
	libresolv.so.2 => /usr/lib/libresolv.so.2 (0x00007f2d7df5f000)
	liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007f2d7df37000)
	liblz4.so.1 => /usr/lib/liblz4.so.1 (0x00007f2d7df14000)
	libcap.so.2 => /usr/lib/libcap.so.2 (0x00007f2d7df09000)
	libgcrypt.so.20 => /usr/lib/libgcrypt.so.20 (0x00007f2d7ddd7000)
	libicudata.so.68 => /usr/lib/libicudata.so.68 (0x00007f2d7c294000)
	libpcre.so.1 => /usr/lib/libpcre.so.1 (0x00007f2d7c222000)
	libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f2d7c0e1000)
	libbz2.so.1.0 => /usr/lib/libbz2.so.1.0 (0x00007f2d7c0ce000)
	libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x00007f2d7c0a7000)
	libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f2d7c07b000)
	libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f2d7c076000)
	libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f2d7c06e000)

Last edited by wittawat (2021-03-17 16:47:21)

Offline

#8 2021-03-17 21:31:20

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,550

Re: [solved] QT5 application crash due std::bad_alloc

Nothing obviously wrong there.

This system previously installed on (Pentium 4417U) and moved to this system.

Does that mean you cloned the system or moved the HDD/SSD?
Do you get similar bugs w/ a fresh user account?

Offline

#9 2021-03-18 00:32:53

wittawat
Member
Registered: 2021-02-14
Posts: 7

Re: [solved] QT5 application crash due std::bad_alloc

Does that mean you cloned the system or moved the HDD/SSD?

yes I moved ssd to new system.

Last edited by wittawat (2021-03-18 01:34:06)

Offline

#10 2021-03-18 07:01:38

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,550

Re: [solved] QT5 application crash due std::bad_alloc

seth wrote:

Do you get similar bugs w/ a fresh user account?

Offline

#11 2021-03-18 12:46:56

wittawat
Member
Registered: 2021-02-14
Posts: 7

Re: [solved] QT5 application crash due std::bad_alloc

seth wrote:
seth wrote:

Do you get similar bugs w/ a fresh user account?

yes

via.

sudo useradd -m -g users -G wheel test

and relogin produce same issue.

*sorry about late reply, I'm at school all the day I can't test it and reply you quickly.

Offline

#12 2021-03-18 13:30:19

wittawat
Member
Registered: 2021-02-14
Posts: 7

Re: [solved] QT5 application crash due std::bad_alloc

solved by using

sudo pacman -S gcc-d gcc-ada gcc-fortran gcc-go gcc-objc lib32-gcc-libs

I guess I recompiled gcc as native optimized on kabylake cpu and it won't run on Sandy Bridge

found issue by analyze this stack trace

                #5  0x00007f1844ad30ed __cxa_throw (libstdc++.so.6 + 0xa30ed)
                      # yep it's failed here
                #6  0x00007f1844ac64b8 _ZnwmSt11align_val_t (libstdc++.so.6 + 0x964b8)
                #7  0x00007f1844b9d366 _ZNSt3pmr15memory_resource8allocateEmm (libstdc++.so.6 + 0x16d366)
                #8  0x00007f1844b9d4ff _ZNSt3pmr25monotonic_buffer_resource11do_allocateEmm (libstdc++.so.6 + 0x16d4ff) 
                      # 2. libstdc++.so try to allocate memory (which is some package from gcc)
                #9  0x00007f18416973bd n/a (libQt5XcbQpa.so.5 + 0x963bd) 
                      # 1. qt want some memory

Offline

Board footer

Powered by FluxBB