xpilot-project / xpilot

Open-source, cross-platform X-Plane pilot client for VATSIM.
https://xpilot-project.org
GNU General Public License v3.0
119 stars 36 forks source link

beta.42 fails on Linux Mint 20.1 Mate #145

Closed IBAV8N closed 1 year ago

IBAV8N commented 1 year ago

Installs but will not execute: image

justinshannon commented 1 year ago

Did you successfully use previous version of xPilot, or is this your first time running xPilot?

anthraxn8b commented 1 year ago

@IBAV8N, maybe this is the same problem as mine (https://github.com/xpilot-project/xpilot/issues/144). Could you please start it from commandline and post the output?

IBAV8N commented 1 year ago

-Justin>

Yes, I reinstalled .41 and it works well on this computer.

justinshannon commented 1 year ago

And you get the error if you upgrade to beta 42?

IBAV8N commented 1 year ago

And you get the error if you upgrade to beta 42?

Correct. When I execute it from command line it returns 'Segmentation fault (core dumped)'.

IBAV8N commented 1 year ago

$ ./xPilot.AppImage Segmentation fault (core dumped)

justinshannon commented 1 year ago

Can you run xPilot via gdb and paste the exception stacktrace?

IBAV8N commented 1 year ago

If you can tell what command to type I can.

justinshannon commented 1 year ago

gdb ./xPilot.AppImage

This will start the gdb session.

Next enter the command run to start the xPilot executable. This should print out the exception stacktrace.

IBAV8N commented 1 year ago

(gdb) run Starting program: /home/me/xPilot/xPilot.AppImage [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [Detaching after fork from child process 348781] process 348777 is executing new program: /tmp/.mount_xPilot2u1E65/AppRun process 348777 is executing new program: /tmp/.mount_xPilot2u1E65/usr/bin/xpilot [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7ffff6055700 (LWP 348786)] [New Thread 0x7ffff550a700 (LWP 348787)]

Thread 1 "xpilot" received signal SIGSEGV, Segmentation fault. 0x0000555555932a08 in ma_context_get_device_info_source_callback__pulse(ma_pa_context, ma_pa_source_info const, int, void*) ()

jonaseberle commented 1 year ago

Then, after the crash within the gdb shell, type bt for the backtrace.

IBAV8N commented 1 year ago

(gdb) run Starting program: /home/me/xPilot/xPilot.AppImage [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [Detaching after fork from child process 355655] process 355651 is executing new program: /tmp/.mount_xPilotlhOQJR/AppRun process 355651 is executing new program: /tmp/.mount_xPilotlhOQJR/usr/bin/xpilot [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7ffff6055700 (LWP 355660)] [New Thread 0x7ffff550a700 (LWP 355661)]

Thread 1 "xpilot" received signal SIGSEGV, Segmentation fault. 0x0000555555932a08 in ma_context_get_device_info_source_callback__pulse(ma_pa_context, ma_pa_source_info const, int, void*) () (gdb) bt

0 0x0000555555932a08 in ma_context_get_device_info_source_callback__pulse(ma_pa_context, ma_pa_source_info const, int, void*) ()

1 0x00007ffff426ee8e in () at /lib/x86_64-linux-gnu/libpulse.so.0

2 0x00007ffff4054be3 in ()

at /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-13.99.so

3 0x00007ffff4054f5f in pa_pdispatch_run ()

at /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-13.99.so

4 0x00007ffff42625f3 in () at /lib/x86_64-linux-gnu/libpulse.so.0

5 0x00007ffff4057947 in ()

at /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-13.99.so

6 0x00007ffff405a72b in ()

at /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-13.99.so

7 0x00007ffff405aaea in ()

at /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-13.99.so

8 0x00007ffff405b37a in ()

at /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-13.99.so

9 0x00007ffff4277ba3 in pa_mainloop_dispatch ()

at /lib/x86_64-linux-gnu/libpulse.so.0

10 0x00007ffff4277ed2 in pa_mainloop_iterate ()

at /lib/x86_64-linux-gnu/libpulse.so.0

11 0x0000555555932670 in ma_context_get_device_info__pulse(ma_context, ma_device_type, ma_device_id const, ma_device_info*) ()

12 0x0000555555933dc0 in ma_context_get_device_info ()

--Type for more, q to quit, c to continue without paging--

13 0x000055555594dbfd in afv_native::audio::MiniAudioAudioDevice::getCompatibleOutputDevices() ()

14 0x000055555594e857 in afv_native::audio::AudioDevice::getCompatibleOutputDevicesForApi(unsigned int) ()

15 0x0000555555894104 in xpilot::AudioForVatsim::configureAudioDevices() ()

16 0x0000555555896fdf in xpilot::AudioForVatsim::AudioForVatsim(QObject*) ()

17 0x000055555588c698 in xpilot::Main(int, char**) ()

18 0x00007ffff6dd5083 in __libc_start_main (main=

0x555555859af0 <main>, argc=1, argv=0x7fffffffd9b8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffd9a8)
at ../csu/libc-start.c:308

19 0x0000555555861cee in _start ()

(gdb)

justinshannon commented 1 year ago

I was able to reproduce this with a vanilla install of Mint on a VM. It appears to be a pulseaudio permission issue; I was able to successfully launch xPilot via sudo.

I'd be curious to know if running pulseaudio -vvv in your command line yields the same results as me:

justin@justin-VirtualBox:~$ pulseaudio -vvv
I: [pulseaudio] main.c: setrlimit(RLIMIT_NICE, (31, 31)) failed: Operation not permitted
I: [pulseaudio] main.c: setrlimit(RLIMIT_RTPRIO, (9, 9)) failed: Operation not permitted
D: [pulseaudio] core-rtclock.c: Timer slack is set to 50 us.
D: [pulseaudio] core-util.c: RealtimeKit worked.
I: [pulseaudio] core-util.c: Successfully gained nice level -11.
I: [pulseaudio] main.c: This is PulseAudio 13.99.1
D: [pulseaudio] main.c: Compilation host: x86_64-pc-linux-gnu
D: [pulseaudio] main.c: Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/pulseaudio-rCGjZv/pulseaudio-13.99.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -W -Wextra -pipe -Wno-long-long -Wno-overlength-strings -Wunsafe-loop-optimizations -Wundef -Wformat=2 -Wlogical-op -Wsign-compare -Wformat-security -Wmissing-include-dirs -Wformat-nonliteral -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-align -Wstrict-aliasing -Wwrite-strings -Wno-unused-parameter -fno-common -fdiagnostics-show-option -fdiagnostics-color=auto
D: [pulseaudio] main.c: Running on host: Linux x86_64 5.4.0-58-generic #64-Ubuntu SMP Wed Dec 9 08:16:25 UTC 2020
D: [pulseaudio] main.c: Found 2 CPUs.
I: [pulseaudio] main.c: Page size is 4096 bytes
D: [pulseaudio] main.c: Compiled with Valgrind support: no
D: [pulseaudio] main.c: Running in valgrind mode: no
D: [pulseaudio] main.c: Running in VM: yes
D: [pulseaudio] main.c: Running from build tree: no
D: [pulseaudio] main.c: Optimized build: yes
D: [pulseaudio] main.c: FASTPATH defined, only fast path asserts disabled.
I: [pulseaudio] main.c: Machine ID is 2a4b02270e3742148865b3f7bd5aa46f.
I: [pulseaudio] main.c: Session ID is c1.
I: [pulseaudio] main.c: Using runtime directory /run/user/1000/pulse.
I: [pulseaudio] main.c: Using state directory /home/justin/.config/pulse.
I: [pulseaudio] main.c: Using modules directory /usr/lib/pulse-13.99.1/modules.
I: [pulseaudio] main.c: Running in system mode: no
E: [pulseaudio] pid.c: Daemon already running.
E: [pulseaudio] main.c: pa_pid_file_create() failed.

A quick Google search of the pa_pid_file_create() failed error has lots of results, but I couldn't find a solution that worked for me.

IBAV8N commented 1 year ago

$ pulseaudio -vvv I: [pulseaudio] main.c: setrlimit(RLIMIT_NICE, (31, 31)) failed: Operation not permitted I: [pulseaudio] main.c: setrlimit(RLIMIT_RTPRIO, (9, 9)) failed: Operation not permitted D: [pulseaudio] core-rtclock.c: Timer slack is set to 50 us. D: [pulseaudio] core-util.c: RealtimeKit worked. I: [pulseaudio] core-util.c: Successfully gained nice level -11. I: [pulseaudio] main.c: This is PulseAudio 13.99.1 D: [pulseaudio] main.c: Compilation host: x86_64-pc-linux-gnu D: [pulseaudio] main.c: Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/pulseaudio-rCGjZv/pulseaudio-13.99.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -W -Wextra -pipe -Wno-long-long -Wno-overlength-strings -Wunsafe-loop-optimizations -Wundef -Wformat=2 -Wlogical-op -Wsign-compare -Wformat-security -Wmissing-include-dirs -Wformat-nonliteral -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-align -Wstrict-aliasing -Wwrite-strings -Wno-unused-parameter -fno-common -fdiagnostics-show-option -fdiagnostics-color=auto D: [pulseaudio] main.c: Running on host: Linux x86_64 5.15.0-56-generic #62~20.04.1-Ubuntu SMP Tue Nov 22 21:24:20 UTC 2022 D: [pulseaudio] main.c: Found 12 CPUs. I: [pulseaudio] main.c: Page size is 4096 bytes D: [pulseaudio] main.c: Compiled with Valgrind support: no D: [pulseaudio] main.c: Running in valgrind mode: no D: [pulseaudio] main.c: Running in VM: no D: [pulseaudio] main.c: Running from build tree: no D: [pulseaudio] main.c: Optimized build: yes D: [pulseaudio] main.c: FASTPATH defined, only fast path asserts disabled. I: [pulseaudio] main.c: Machine ID is 2a4b02270e3742148865b3f7bd5aa46f. I: [pulseaudio] main.c: Session ID is c2. I: [pulseaudio] main.c: Using runtime directory /run/user/1000/pulse. I: [pulseaudio] main.c: Using state directory /home/me/.config/pulse. I: [pulseaudio] main.c: Using modules directory /usr/lib/pulse-13.99.1/modules. I: [pulseaudio] main.c: Running in system mode: no E: [pulseaudio] pid.c: Daemon already running. E: [pulseaudio] main.c: pa_pid_file_create() failed.

IBAV8N commented 1 year ago

And mine will launch via sudo.

justinshannon commented 1 year ago

Same result I see. I’m not a Linux user so my knowledge ends here as to why pulseaudio is acting up. I’ll see about adding additional error checking so xPilot doesn’t segfault.

jonaseberle commented 1 year ago

Since a pulseaudio user daemon is already running in Mint I believe that outcome is normal.

I would try like this:

# stop it first
pulseaudio -k 
# run it in foreground with verbose output
pulseaudio -vvv

It's weird that a user program cannot connect to pulseaudio, but when run with sudo it can?

In order to rule out any AppImage shenanigans, you can also try the plain executable from the Artifacts-2.0.0-beta.42.zip from https://github.com/xpilot-project/xpilot/releases/tag/v2.0.0-beta.42.

anthraxn8b commented 1 year ago

Same problem for me (FED36). Executing xPilot with SUDO helps but should not be the appropriate way to run it.

Completely stopping pulseaudio...

systemctl --user stop pulseaudio.socket systemctl --user stop pulseaudio.service

...and the executing xPilot.AppImage also does not solve the problem.

However, now xPilot (started without SUDO) dies silent.

anthraxn8b commented 1 year ago

@justinshannon, yes, it would be great to have useful error messages. @jonaseberle, I would agree that this seems to be normal - I do not get the problem. The daemon is running. Why is this a problem?

I am sure, my issue has the same underlying reason... Maybe the "wayland problem" is just for information... https://github.com/xpilot-project/xpilot/issues/144

jonaseberle commented 1 year ago

pulseaudio with verbose output: I was just pointing out that running pulseaudio -vvv on top of an already running pulseaudio won't work. Your test case stops pulseaudio, then runs xPilot which leaves you with ALSA only which is most probably not what you want either.

running without the AppImage overhead: In order to rule out any security settings or missing configuration for the AppImage on your system, I would try running the plain ./Linux/xPilot from the Artifacts-2.0.0-beta.42.zip

anthraxn8b commented 1 year ago

@jonaseberle, got that. THX. I do not understand why pulseaudio has to be explicitly started if it is already running. I am far away from C programming in linux but should the code not just connect to the daemon instead of starting it?

jonaseberle commented 1 year ago

I have just tried on my secondary Ubuntu 22.04 machine (pulseaudio 14.2). I get a segfault at the same codepoint as you. It happens for .AppImage and the plain executable.

# I forgot earlier that pulseaudio is set to restart itself via a user systemd unit:
$ systemctl --user stop pulseaudio.socket 
$ pulseaudio -k; pulseaudio -vvv
# when running ./xPilot.AppImage in another terminal
I: [pulseaudio] client.c: Created 2 "Native client (UNIX socket client)"
D: [pulseaudio] protocol-native.c: Protocol version: remote 35, local 34
I: [pulseaudio] protocol-native.c: Got credentials: uid=1001 gid=1001 success=1
D: [pulseaudio] protocol-native.c: SHM possible: yes
D: [pulseaudio] protocol-native.c: Negotiated SHM: yes
D: [pulseaudio] protocol-native.c: Memfd possible: yes
D: [pulseaudio] protocol-native.c: Negotiated SHM type: shared memfd
D: [pulseaudio] memblock.c: Using shared memfd memory pool with 1024 slots of size 64,0 KiB each, total size is 64,0 MiB, maximum usable slot size is 65472
D: [pulseaudio] srbchannel.c: SHM block is 65472 bytes, ringbuffer capacity is 2 * 32712 bytes
D: [pulseaudio] protocol-native.c: Enabling srbchannel...
D: [pulseaudio] module-augment-properties.c: Looking for .desktop file for xpilot
D: [pulseaudio] protocol-native.c: Client enabled srbchannel.
I: [pulseaudio] client.c: Freed 2 "xpilot"
I: [pulseaudio] protocol-native.c: Connection died.

So pulseaudio seems rather happy.

Something in miniaudio's pulseaudio callback function? Has that recently been changed @justinshannon ?

It does not happen with older xPilot versions (I've just tried 2.0.0-beta.41).

jonaseberle commented 1 year ago

I do not understand why pulseaudio has to be explicitly started if it is already running.

That was for debugging only to see its messages (-vvv). You would see when pulseaudio clients connect.

justinshannon commented 1 year ago

I found a typo in the audio code...

@IBAV8N can you give this version a try? https://xpilot-project.org/files/xPilot-2.0.0-beta.42-Linux.zip

IBAV8N commented 1 year ago

@IBAV8N can you give this version a try?

It works. Nice job, Justin.

justinshannon commented 1 year ago

Thanks... this fix will be in the next release.