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

Current KDE prevents Server GUI from exiting #3016

Open
rdica opened this issue Feb 23, 2023 Discussed in #3006 · 26 comments
Open

Current KDE prevents Server GUI from exiting #3016

rdica opened this issue Feb 23, 2023 Discussed in #3006 · 26 comments
Labels
bug Something isn't working

Comments

@rdica
Copy link
Contributor

rdica commented Feb 23, 2023

Discussed in https://github.com/orgs/jamulussoftware/discussions/3006

Originally posted by pcar75 February 9, 2023
Bonjour,
On my dual boot PC, I can shutdown Jamulus server in Windows 10. However I can't do that in Linux, because I believe it installs itself as a service. Is there a nicer (GUI) way of shuting down Jamulus server, instead of running a script or terminal with killall -I "jamulus" ?

Context : dual Boot PC : Windows 10 / Ubuntu Studio 22.04.1 LTS (Plasma KDE).
On Windows
Jamulus server (3.9.1) with GUI
Menu > Window > Exit (Ctrl+Q) : OK terminates process & threads
X Button : OK terminates process & threads
On Ubuntu Studio 22.04.1 LTS
Jamulus server (3.9.1) with GUI and Icon in system tray bar
Menu > Window > Exit (Ctrl+Q) : Hides GUI only
X (Close) Button : Hides GUI only
Sys tray Exit (Icon menu buttons = Exit, Show, Hide...) : Hides GUI if it was visible ( ~ Exit ICON menu).

EDIT : added precision : Ubuntu Studio 22.04.1 LTS and Qt is 5.15.3 as mentioned below (rdica).

It seems that latest KDE on at least Ubuntu 22.04+ and Fedora37 has introduced a change that prevents exiting the server process when the server GUI is started. Exiting merely closes the GUI window, but leaves the tray icon running as well as the server process itself.

As noted in the original discussion thread, disabling the tray icon functionality returns proper exit behaviour.
Personally I feel this is a bug and as current and future linux distros using KDE desktops will continue to experience the problem, it should be addressed as such, however it's been deemed not a bug, so the following request.

Request that either the tray icon be removed altogether, or a toggle be added to disable it.

Thanks!

@ann0see ann0see added this to Triage in Tracking (old) via automation Feb 24, 2023
@ann0see ann0see added bug Something isn't working feature request Feature request and removed bug Something isn't working labels Feb 24, 2023
@pljones pljones removed this from Triage in Tracking (old) Jul 28, 2023
@pljones
Copy link
Collaborator

pljones commented Aug 12, 2023

@rdica does this happen if you run the Jamulus server GUI from a shell prompt? Or is it only if you use the provided desktop shortcut?

(I run my Linux KDE desktop remoted to Windows over VcXsvr and I can't reproduce the problem - I don't use the KDE desktop itself, though - just the windows, managed by MS Windows 11.)

@rdica
Copy link
Contributor Author

rdica commented Aug 12, 2023

@pljones Yes, also happens when started from shell prompt.

@pljones
Copy link
Collaborator

pljones commented Aug 13, 2023

Thanks. Can you write down the full command line you use?

@rdica
Copy link
Contributor Author

rdica commented Aug 13, 2023

jamulus -s

@pljones
Copy link
Collaborator

pljones commented Aug 13, 2023

OK.

  • Run the server GUI as above and then in another terminal do ps -ef | grep "jamulus -s" and paste the results
  • Use "Window -> Exit" (or Ctrl+Q) in the server GUI to exit and then in the other terminal do ps -ef | grep "jamulus -s" and paste the results again

Thanks.

@rdica
Copy link
Contributor Author

rdica commented Aug 13, 2023

Startup:

ardy@daw1:~$ ps -ef|grep "jamulus -s"
ardy        7762    3240  1 12:21 pts/2    00:00:00 jamulus -s

After closing:

ardy@daw1:~$ ps -ef|grep "jamulus -s"
ardy        7762    3240  0 12:21 pts/2    00:00:00 jamulus -s

@pljones
Copy link
Collaborator

pljones commented Aug 14, 2023

Strange... Can you do ls -l .config/Jamulus/ and paste here, please.

@rdica
Copy link
Contributor Author

rdica commented Aug 14, 2023

ardy@daw1:~$ ls -l .config/Jamulus/
total 376
-rw-rw-r-- 1 ardy ardy 74660 Aug 12 22:24 Jamulus.ini
-rw-rw-r-- 1 ardy ardy 74616 Mar  1 13:42 Jamulus.ini-bak-20230228
-rw-rw-r-- 1 ardy ardy 72061 Jan 22  2023 Jamulus.ini.orig
-rw-rw-r-- 1 ardy ardy   547 Aug 13 12:28 Jamulusserver.ini
-rw-rw-r-- 1 ardy ardy 74053 Jul 31 18:42 KEYS.ini
-rw-rw-r-- 1 ardy ardy 72123 Feb 13 13:47 test.ini

cat .config/Jamulus/Jamulusserver.ini 
<server>
 <winposmain_base64>AdnQywADAAAAAAUWAAAAOwAAB2EAAALBAAAFFgAAADsAAAdhAAACwQAAAAAAAAAAB4AAAAUWAAAAOwAAB2EAAALB</winposmain_base64>
 <directorytype>-1</directorytype>
 <name>Disabled Icon Tray</name>
 <city>Home</city>
 <country>225</country>
 <norecord>0</norecord>
 <welcome>VWJ1bnR1IFN0dWRpbyAyMi4wNA==</welcome>
 <language>en</language>
 <recordingdir_base64></recordingdir_base64>
 <directoryaddress></directoryaddress>
 <directoryfile_base64></directoryfile_base64>
 <autostartmin>0</autostartmin>
 <delaypan>1</delaypan>
</server>

@pljones
Copy link
Collaborator

pljones commented Aug 14, 2023

Right... digging deeper (and getting out of my depth :) )...

Could you run Jamulus Server with strace, catching all the output:

strace jamulus -s > log 2>&1

then hit Ctrl-Q to quit once the window opens. Then run

grep -v '^\(writev\|getrandom\|futex\|brk\|poll\|recvmsg\|mmap\|munmap\|mprotect\|.*fonts\|.*fontconfig\|.*opt.Qt\|read.*ELF\|.*\.so\.\)' log | tail -40

to see the last 40 lines of the log (with boring bits removed) and paste the result, please.

(Or drag-n-drop the log file complete.)

@rdica
Copy link
Contributor Author

rdica commented Aug 14, 2023

Did the latter as I couldn't ensure the last 40 lines would reflect attempt to close. File created using strace -o jamulusserver.log jamulus -s, then attempt to close window, then exit program.

jamulusserver.log

@pljones
Copy link
Collaborator

pljones commented Aug 14, 2023

It looks like it exits normally from the strace output:

socket(AF_NETLINK, SOCK_RAW|SOCK_CLOEXEC, NETLINK_ROUTE) = 28
bind(28, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 0
getsockname(28, {sa_family=AF_NETLINK, nl_pid=51797, nl_groups=00000000}, [12]) = 0
sendto(28, [{nlmsg_len=20, nlmsg_type=RTM_GETADDR, nlmsg_flags=NLM_F_REQUEST|NLM_F_DUMP, nlmsg_seq=1692041884, nlmsg_pid=0}, {ifa_family=AF_UNSPEC, ...}], 20, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 20
close(28)                               = 0
newfstatat(AT_FDCWD, "/etc/nsswitch.conf", {st_mode=S_IFREG|0644, st_size=542, ...}, 0) = 0
newfstatat(AT_FDCWD, "/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=933, ...}, 0) = 0
openat(AT_FDCWD, "/etc/hosts", O_RDONLY|O_CLOEXEC) = 28
newfstatat(28, "", {st_mode=S_IFREG|0644, st_size=302, ...}, AT_EMPTY_PATH) = 0
lseek(28, 0, SEEK_SET)                  = 0
read(28, "# Standard host addresses\n127.0."..., 4096) = 302
read(28, "", 4096)                      = 0
close(28)                               = 0
socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 28
setsockopt(28, SOL_IP, IP_RECVERR, [1], 4) = 0
connect(28, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.53")}, 16) = 0
sendmmsg(28, [{msg_hdr={msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\253\223\1 \0\1\0\0\0\0\0\1\tanygenre1\7jamulus\2i"..., iov_len=49}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, msg_len=49}, {msg_hdr={msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\r\225\1 \0\1\0\0\0\0\0\1\tanygenre1\7jamulus\2i"..., iov_len=49}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, msg_len=49}], 2, MSG_NOSIGNAL) = 2
ioctl(28, FIONREAD, [108])              = 0
recvfrom(28, "\253\223\201\200\0\1\0\2\0\0\0\1\tanygenre1\7jamulus\2i"..., 2048, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.53")}, [28 => 16]) = 108
ioctl(28, FIONREAD, [162])              = 0
recvfrom(28, "\r\225\201\200\0\1\0\1\0\1\0\1\tanygenre1\7jamulus\2i"..., 65536, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.53")}, [28 => 16]) = 162
close(28)                               = 0
write(2, "Server Registration Status updat"..., 50) = 50
sendto(12, "\0\0\355\3\0\0\0\233\217", 9, 0, {sa_family=AF_INET, sin_port=htons(22124), sin_addr=inet_addr("62.113.204.104")}, 16) = 9
openat(AT_FDCWD, "/home/ardy/.config/Jamulus/Jamulusserver.ini", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 28
statx(28, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0664, stx_size=0, ...}) = 0
write(28, "<server>\n <winposmain_base64>Adn"..., 543) = 543
close(28)                               = 0
shutdown(12, SHUT_RDWR)                 = -1 ENOTCONN (Transport endpoint is not connected)
close(12)                               = 0
msync(0x7f56494b4000, 10547304, MS_ASYNC|MS_INVALIDATE) = 0
rt_sigaction(SIGUSR1, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f5667d9d520}, NULL, 8) = 0
rt_sigaction(SIGUSR2, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f5667d9d520}, NULL, 8) = 0
rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f5667d9d520}, NULL, 8) = 0
rt_sigaction(SIGTERM, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f5667d9d520}, NULL, 8) = 0
getpid()                                = 51797
getpid()                                = 51797
getpid()                                = 51797
exit_group(0)                           = ?
+++ exited with 0 +++

exit_group(0) doesn't return but the exited with 0 indicates the forked jamulus command return to strace okay. (I think...)

Is it still running after running with strace like that?

@rdica
Copy link
Contributor Author

rdica commented Aug 14, 2023

Yes, and I can connect to it (tray icon shows a little green dot when a client is connected).

@pljones
Copy link
Collaborator

pljones commented Aug 15, 2023

And if you do ps -ef | grep 'jamulus -s' whilst the server is running, is the PID reported by getpid just before exit_group in the strace output the same as the pid of the running server?

@rdica
Copy link
Contributor Author

rdica commented Aug 15, 2023

Yes.
It should be noted in case you weren't aware, that exit_group event at the end of the strace log is when I ctrl+c out of the strace, not when I attempt the window close.

@pljones
Copy link
Collaborator

pljones commented Aug 17, 2023

Oh - it doesn't exit cleanly from the strace on Ctrl-Q? Interesting... It should.

@rdica
Copy link
Contributor Author

rdica commented Aug 17, 2023

Well no, ctrl+q etc doesnt exit the program, thats the problem :)
Starting jamulus -s from cli doesn't fork and return to prompt, hence the need to ctrl+c out.

I'm not familiar enough with strace log output to determine where in the log the attempt to close the window is.

@pljones
Copy link
Collaborator

pljones commented Aug 19, 2023

Could you run the strace and attach the log up to the point where you hit Ctrl-Q, please.

@pljones pljones added bug Something isn't working and removed feature request Feature request labels Aug 19, 2023
@rdica
Copy link
Contributor Author

rdica commented Aug 19, 2023

This was as close as I could get the exit attempt without the trailing ctrl+c exit.

debug-jamulusserver.log

@pljones
Copy link
Collaborator

pljones commented Aug 19, 2023

Could you post the whole log or is it too big?

@rdica
Copy link
Contributor Author

rdica commented Aug 19, 2023

I created a new log file using strace -o debug-jamulusserver.log jamulus -s, the exit at the end is where I ctrl+c.

debug-jamulusserver.log

@pljones
Copy link
Collaborator

pljones commented Aug 20, 2023

I need it as soon as possible where you hit Ctrl-Q - just copy the file at that point to another and attach that. Otherwise I can't see what happens between the Ctrl-Q and Ctrl-C. (There may be a strace flag to get it not to buffer writes. If so, use that so the file is as up to date as possible.)

@rdica
Copy link
Contributor Author

rdica commented Aug 20, 2023

Based on the number of lines per timestamp, I think what you want begins at 10:58:05.

for i in 0 1 2 3 4 5 6 7; do echo -n "10:58:0${i}: ";grep "10:58:0${i}" debug_jamulusserver.log |wc -l;done
10:58:00: 25
10:58:01: 25
10:58:02: 25
10:58:03: 27
10:58:04: 25
10:58:05: 49
10:58:06: 174
10:58:07: 262

debug_jamulusserver.log

@pljones
Copy link
Collaborator

pljones commented Aug 20, 2023

src/serverdlg.cpp:    pViewMenu->addAction ( tr ( "E&xit" ), this, SLOT ( close() ), QKeySequence ( Qt::CTRL + Qt::Key_Q ) );

Each window in Jamulus is a Qt QDialog and we attempt to route the signal from File->Exit or Ctrl+Q to the close() slot on the dialog. In fact, close() is on the QWidget class from which QDialog inherits.

The QGuiApplication::lastWindowClosed() signal is emitted when the last visible primary window (i.e. window with no parent) with the Qt::WA_QuitOnClose attribute set is closed. By default this attribute is set for all widgets except transient windows such as splash screens, tool windows, and popup menus.

By default, QGuiApplication quits after this signal is emitted. This feature can be turned off by setting quitOnLastWindowClosed to false.

Jamulus doesn't set WA_QuitOnClose on the dialog or quitOnLastWindowClosed to false. So I'm not sure why the current code isn't working in KDE.

I couldn't see anything in the log to indicate the close() had occurred. It's probably worth wrapping the close() call in a method with some logging in to see whether the menu entry / keystroke is even arriving.

@rdica
Copy link
Contributor Author

rdica commented Aug 20, 2023

If you create a patch, I can apply it against the src and compile it and test it against the KDE ver shipped with Ubuntu Studio 22.04.

@pljones pljones added this to the Release 3.11.0 milestone Aug 22, 2023
@pljones pljones self-assigned this Aug 22, 2023
@pljones
Copy link
Collaborator

pljones commented Aug 22, 2023

I'll have a go for 3.11.0.

@pljones pljones modified the milestones: Release 3.11.0, Release 3.12.0 May 5, 2024
@pljones
Copy link
Collaborator

pljones commented May 5, 2024

Moved out to 3.12.0.

@pljones pljones removed their assignment May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Triage
Development

No branches or pull requests

3 participants