Python3 QT application on Arch Linux - Segmentation fault (core dumped)

EDIT:
This issue appears to only occur when running on Arch Linux, which is where I do my development. I tested the Snap on Ubuntu 18.04 host and it worked fine! Why would that be?

I’m not thinking the issue has to do with this warning: Fontconfig warning: FcPattern object weight does not accept value [40 210) which I have seen in other issues on related to AppImages and Arch Linux.

ORIGINAL POST:
I’m have a Snap which seems to work well, except for when I try to run the QT python3 application. Running the QT python3 application returns a Segmentation fault (core dumped).

How should I go about trying to debug this? At first I thought it had to do with Wayland but I tried on a computer without wayland and I also had the same issue. I also tried the kde-neon extension, which also crashed with a Segmentation fault (core dumped).

Output:

$ joinmarket.joinmarket-qt 
Starting JoinMarket GUI
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
User data location: /home/david/snap/joinmarket/x13/.joinmarket/
Fontconfig warning: FcPattern object weight does not accept value [40 210)
Segmentation fault (core dumped)
# snapcraft.yaml
name: joinmarket
base: core18
version: master
summary: Software to assist in creating bitcoin CoinJoin transactions
description: |
  JoinMarket is software to create a special kind of bitcoin transaction called a CoinJoin transaction. It's aim is to improve the confidentiality and privacy of bitcoin transactions.
confinement: devmode
grade: devel
#icon: icon.png

apps:
  joinmarket-qt:
    extensions:
      - gnome-3-28
    command: usr/bin/jm
    plugs:
      - network
      - network-bind
      - home

parts:
  joinmarket:
    plugin: python
    source: .
    requirements:
      - requirements/gui.txt
    override-build: |
      snapcraftctl build

      mkdir -p /root/parts/joinmarket/install/opt/joinmarket
      cp -r /root/parts/joinmarket/build/jmbase /root/parts/joinmarket/install/opt/joinmarket
      cp -r /root/parts/joinmarket/build/jmclient /root/parts/joinmarket/install/opt/joinmarket
      cp -r /root/parts/joinmarket/build/jmdaemon /root/parts/joinmarket/install/opt/joinmarket
      cp -r /root/parts/joinmarket/build/jmbitcoin /root/parts/joinmarket/install/opt/joinmarket
      cp -r /root/parts/joinmarket/build/scripts /root/parts/joinmarket/install/opt/joinmarket

      mkdir -p /root/parts/joinmarket/install/opt/joinmarket/snap/local
      cp /root/parts/joinmarket/build/snap/local/jm /root/parts/joinmarket/install/opt/joinmarket/snap/local

    organize:
      opt/joinmarket/snap/local/jm: usr/bin/jm
    stage-packages:
      - python3
      - libnspr4
      - libnss3
      - libnss3-tools
      - libodbc1
      - libpq5
      - libpulse-dev
      - mime-support
      - libspeechd2
      - libxkbcommon-x11-0
    build-packages:
      - python3
      - python3-pip
# jm script
#!/bin/sh

echo "Starting JoinMarket GUI"
python3 "$SNAP/opt/joinmarket/scripts/joinmarket-qt.py"

Does editing /etc/nsswitch.conf like this help?

No, I still had a segmentation fault after editing the file like you suggested.

I’m assuming I didn’t need to rebuild the snap. I just changed the file and tried to run the snap again.

Looks like you’re going to have to do it the hard way. Running snap run --gdb <snap> will invoke the debugger. There you will be able to see the backtrace and investigate.

I’m not sure what to do with the debug output. Can you make sense of it?

$ snap run --gdb joinmarket
[sudo] password for david:
GNU gdb (GDB) 8.3.1
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/lib/snapd/snap-confine...
(No debugging symbols found in /usr/lib/snapd/snap-confine)
Starting program: /usr/lib/snapd/snap-confine --base core18 snap.joinmarket.joinmarket /usr/lib/snapd/snap-exec --command=gdb joinmarket
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[Detaching after fork from child process 43387]
[Detaching after fork from child process 43388]
process 43382 is executing new program: /usr/lib/snapd/snap-exec
[New LWP 43396]
[New LWP 43397]
[New LWP 43398]
[New LWP 43399]
[New LWP 43400]
[New LWP 43401]
[LWP 43401 exited]
[LWP 43400 exited]
[LWP 43399 exited]
[LWP 43398 exited]
[LWP 43397 exited]
[LWP 43396 exited]
process 43382 is executing new program: /bin/dash
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
process 43382 is executing new program: /bin/bash
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Detaching after fork from child process 43407]
[Detaching after fork from child process 43408]
[Detaching after fork from child process 43411]
[Detaching after fork from child process 43412]
/snap/joinmarket/x7/snap/command-chain/desktop-launch: line 49: /root/.config/user-dirs.dirs: No such file or directory
[Detaching after fork from child process 43414]
[Detaching after fork from child process 43415]
[Detaching after fork from child process 43416]
[Detaching after fork from child process 43417]
[Detaching after fork from child process 43418]
[Detaching after fork from child process 43419]
[Detaching after fork from child process 43420]
[Detaching after fork from child process 43421]
[Detaching after fork from child process 43422]
[Detaching after fork from child process 43423]
[Detaching after fork from child process 43424]
[Detaching after fork from child process 43425]
[Detaching after fork from child process 43426]
[Detaching after fork from child process 43427]
[Detaching after fork from child process 43428]
[Detaching after fork from child process 43429]
[Detaching after fork from child process 43430]
[Detaching after fork from child process 43431]
[Detaching after fork from child process 43432]
[Detaching after fork from child process 43433]
[Detaching after fork from child process 43434]
[Detaching after fork from child process 43437]
[Detaching after fork from child process 43442]
[Detaching after fork from child process 43444]
[Detaching after fork from child process 43446]
[Detaching after fork from child process 43449]
[Detaching after fork from child process 43452]
[Detaching after fork from child process 43455]
[Detaching after fork from child process 43457]
[Detaching after fork from child process 43461]
[Detaching after fork from child process 43462]
[Detaching after fork from child process 43465]
process 43382 is executing new program: /usr/lib/snapd/snap-gdb-shim
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?


Welcome to `snap run --gdb`.
You are right before your application is execed():
- set any options you may need
- use 'cont' to start



Thread 1 "snap-gdb-shim" received signal SIGTRAP, Trace/breakpoint trap.
0x00007f1d8dc10e97 in raise () from target:/lib/x86_64-linux-gnu/libc.so.6
Catchpoint 1 (exec)
Continuing.
process 43382 is executing new program: /bin/bash

Thread 1 "jm" hit Catchpoint 1 (exec'd /bin/bash), 0x00007f9c981b1090 in ?? () from target:/lib64/ld-linux-x86-64.so.2
(gdb) c
Continuing.
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Detaching after fork from child process 44426]
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
qt.qpa.wayland: EGL not available
User data location: /home/david/snap/joinmarket/x7/.joinmarket/
Fontconfig warning: FcPattern object weight does not accept value [40 210)
/snap/joinmarket/x7/usr/bin/jm: line 59: 44426 Segmentation fault      (core dumped) $END_COMMAND
[Inferior 1 (process 43382) exited with code 0213]
(gdb) c
The program is not being run.
(gdb)

I’d suggest starting with the backtrace. Once you get to the point when there’s: /snap/joinmarket/x7/usr/bin/jm: line 59: 44426 Segmentation fault, try calling bt, this should show the backtrace of all stack frames.

Can you also publish the snap somewhere?

I’m not sure if I’m using gdb correctly. Here is what I got with bt.

Thread 1 "jm" hit Catchpoint 1 (exec'd /bin/bash), 0x00007f5e0270d090 in ?? () from target:/lib64/ld-linux-x86-64.so.2
(gdb) bt
#0  0x00007f5e0270d090 in ?? () from target:/lib64/ld-linux-x86-64.so.2
#1  0x0000000000000002 in ?? ()
#2  0x00007ffc7b6fe9b8 in ?? ()
#3  0x00007ffc7b6fe9c2 in ?? ()
#4  0x0000000000000000 in ?? ()
(gdb) c
Continuing.
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Detaching after fork from child process 98456]
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
qt.qpa.wayland: EGL not available
User data location: /home/david/snap/joinmarket/x8/.joinmarket/
Fontconfig warning: FcPattern object weight does not accept value [40 210)
/snap/joinmarket/x8/usr/bin/jm: line 59: 98456 Segmentation fault      (core dumped) $END_COMMAND
[Inferior 1 (process 98158) exited with code 0213]
(gdb) bt
No stack.
(gdb) 

I’m committing my code for the Snap here: https://github.com/dmp1ce/joinmarket-clientserver

A Manjaro user yesterday reported me the same issue with my application https://snapcraft.io/red-app
Here is the link to the issue:
https://github.com/keshavbhatt/red/issues/1