Linux app failed to open after changing audio output

Hi, I’ve been using this app for a while. Thank you very much for your works.

I have this problem after changing the audio output from HDMI to aux or vice-versa (in OS audio setting). Then I need to change the audio source in app (from Monitor of Built-in Audio Digital Stereo (HDMI 2) to Monitor of Built-in Audio Analog Stereo) by restarting the app because the refresh function isn’t working. The app won’t open again. But after changing the audio output back and forth after 3-5 try it can be opened again. I use pop os 20.04.

For an example this app.log when it fails to open one time at 20:14:37:

2021-07-14 20:14:21,299 INFO [AR] Supported: PortAudioDevice(index=20, name=Monitor of Built-in Audio Digital Stereo (HDMI 2), type=Capture, isDefault=false, defaultSampleRate=48000.0, channels=2, hostApiIndex=2, hostApiType=PULSEAUDIO, hostApiName=PulseAudio, defaultLowLatency=0.0, defaultHighLatency=0.0)
2021-07-14 20:14:21,299 INFO [AR] Unsupported: PortAudioDevice(index=20, name=Monitor of Built-in Audio Digital Stereo (HDMI 2), type=Render, isDefault=false, defaultSampleRate=48000.0, channels=0, hostApiIndex=2, hostApiType=PULSEAUDIO, hostApiName=PulseAudio, defaultLowLatency=0.0, defaultHighLatency=0.0), error: -9998, Invalid number of channels
2021-07-14 20:14:30,176 INFO [AR] Application stop called
2021-07-14 20:14:30,183 INFO [player] Stopping the player, reason: application_close
2021-07-14 20:14:30,189 INFO [server_manager] Stopping the server, reason: shutdown
2021-07-14 20:14:30,193 INFO [PortAudioDeviceBackend] Status terminating
2021-07-14 20:14:36,995 INFO [AR] Waiting for devices from PortAudio...
2021-07-14 20:14:37,012 INFO [AR] Loading libnative-portaudio.so...
2021-07-14 20:32:28,585 INFO [AR] Waiting for devices from PortAudio...
2021-07-14 20:32:28,604 INFO [AR] Loading libnative-portaudio.so...
2021-07-14 20:32:28,786 INFO [PortAudioDeviceBackend] Status initializing
2021-07-14 20:32:28,786 INFO [PortAudioDeviceBackend] Status initialized
2021-07-14 20:32:28,787 INFO [server_manager] Starting the server...
#...(another devices listed here)...
2021-07-14 20:32:33,910 INFO [AR] Supported: PortAudioDevice(index=21, name=Monitor of Built-in Audio Analog Stereo, type=Capture, isDefault=false, defaultSampleRate=48000.0, channels=2, hostApiIndex=2, hostApiType=PULSEAUDIO, hostApiName=PulseAudio, defaultLowLatency=0.0, defaultHighLatency=0.0)
2021-07-14 20:32:33,910 INFO [AR] Unsupported: PortAudioDevice(index=21, name=Monitor of Built-in Audio Analog Stereo, type=Render, isDefault=false, defaultSampleRate=48000.0, channels=0, hostApiIndex=2, hostApiType=PULSEAUDIO, hostApiName=PulseAudio, defaultLowLatency=0.0, defaultHighLatency=0.0), error: -9998, Invalid number of channels

There’s another log named hs_err_pid8414.log in my home directory created by JRE:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f0696640a10, pid=8414, tid=8443
#
# JRE version: OpenJDK Runtime Environment AdoptOpenJDK (14.0.2+12) (build 14.0.2+12)
# Java VM: OpenJDK 64-Bit Server VM AdoptOpenJDK (14.0.2+12, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# C  [libdl.so.2+0x1a10]  dlerror+0x1d0
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P %E" (or dumping to /home/albert/core.8414)
#
# If you would like to submit a bug report, please visit:
#   https://github.com/AdoptOpenJDK/openjdk-support/issues
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  S U M M A R Y ------------

Command Line: -Djava.library.path=/opt/audiorelay/lib/app:/opt/audiorelay/bin -Djava.launcher.path=/opt/audiorelay/bin --add-exports=javafx.graphics/com.sun.glass.ui=com.azefsw.audioconnect --add-exports=javafx.graphics/com.sun.javafx.application=com.azefsw.audioconnect --add-exports=javafx.graphics/com.sun.javafx.scene=com.jfoenix --add-opens=java.base/java.lang.reflect=com.jfoenix --add-opens=javafx.graphics/javafx.scene=tornadofx com.azefsw.audioconnect.desktop.app.MainKt

Host: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz, 8 cores, 15G, Pop!_OS 20.04 LTS
Time: Wed Jul 14 20:14:37 2021 CEST elapsed time: 0 seconds (0d 0h 0m 0s)

---------------  T H R E A D  ---------------

Current thread (0x00007f068c777000):  JavaThread "JavaFX-Launcher" [_thread_in_native, id=8443, stack(0x00007f065993b000,0x00007f0659a3c000)]

Stack: [0x00007f065993b000,0x00007f0659a3c000],  sp=0x00007f0659a3a220,  free space=1020k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libdl.so.2+0x1a10]  dlerror+0x1d0

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  com.sun.glass.ui.gtk.GtkApplication._initGTK(IZF)I+0 javafx.graphics
j  com.sun.glass.ui.gtk.GtkApplication.<init>()V+99 javafx.graphics
j  com.sun.glass.ui.gtk.GtkPlatformFactory.createApplication()Lcom/sun/glass/ui/Application;+4 javafx.graphics
j  com.sun.glass.ui.Application.run(Ljava/lang/Runnable;)V+19 javafx.graphics
j  com.sun.javafx.tk.quantum.QuantumToolkit.startup(Ljava/lang/Runnable;)V+21 javafx.graphics
j  com.sun.javafx.application.PlatformImpl.startup(Ljava/lang/Runnable;Z)V+134 javafx.graphics
j  com.sun.javafx.application.PlatformImpl.startup(Ljava/lang/Runnable;)V+2 javafx.graphics
j  com.sun.javafx.application.LauncherImpl.startToolkit()V+26 javafx.graphics
j  com.sun.javafx.application.LauncherImpl.launchApplication1(Ljava/lang/Class;Ljava/lang/Class;[Ljava/lang/String;)V+0 javafx.graphics
j  com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(Ljava/lang/Class;Ljava/lang/Class;[Ljava/lang/String;Ljava/util/concurrent/CountDownLatch;)V+3 javafx.graphics
j  com.sun.javafx.application.LauncherImpl$$Lambda$101.run()V+16 javafx.graphics
j  java.lang.Thread.run()V+11 [email protected]
v  ~StubRoutines::call_stub

siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000000

Register to memory mapping:

RAX=0x0000000000000044 is an unknown value
RBX=0x00007f06966440e0: <offset 0x00000000000050e0> in /lib/x86_64-linux-gnu/libdl.so.2 at 0x00007f069663f000
RCX=0x000000000000000e is an unknown value
RDX=0x00007f0608000020 points into unknown readable memory: 00 00 00 00 02 00 00 00
RSP=0x00007f0659a3a220 is pointing into the stack for thread: 0x00007f068c777000
RBP=0x00007f05de84e67f: <offset 0x000000000044467f> in /lib/x86_64-linux-gnu/libgtk-3.so.0 at 0x00007f05de40a000
RSI=0x0 is NULL
RDI=0x00007f0696642017: <offset 0x0000000000003017> in /lib/x86_64-linux-gnu/libdl.so.2 at 0x00007f069663f000
R8 =0x0 is NULL
R9 =0x0000000000000044 is an unknown value
R10=0x00007f069664202e: <offset 0x000000000000302e> in /lib/x86_64-linux-gnu/libdl.so.2 at 0x00007f069663f000
R11=0x00007f060804aa90 points into unknown readable memory: f0 00 00 08 06 7f 00 00
R12=0x00007f0659a3b670 is pointing into the stack for thread: 0x00007f068c777000
R13=0x0 is NULL
R14=0x0 is NULL
R15=0x00007f06080a59b0 points into unknown readable memory: 2f 75 73 72 2f 6c 69 62
#.....many more lines

Hi, the refresh button works in this version AudioRelay 0.22.
Hopefully the crash won’t happen again. :crossed_fingers: