Bug 419105

Summary: Process still running when closing k3b after changing the splash screen visibility flag
Product: [Applications] k3b Reporter: Stefano <gisk+kdebugs>
Component: generalAssignee: k3b developers <k3b>
Status: RESOLVED FIXED    
Severity: normal CC: aacid, michalm, trueg
Priority: NOR    
Version: 19.12   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: GDB output

Description Stefano 2020-03-22 11:59:35 UTC
SUMMARY
When I close k3b I can see that his process is still running. This causes k3b to be saved in the Plasma session logout and restarted at the next login.

STEPS TO REPRODUCE
1. Open K3b and quit it.
2. Open terminal. ps ux|grep k3b

OBSERVED RESULT
/usr/bin/k3b is still running

EXPECTED RESULT
k3b should be terminated when the application is closed

SOFTWARE/OS VERSIONS
Operating System: Kubuntu 19.10
KDE Plasma Version: 5.18.3
KDE Frameworks Version: 5.67.0
Qt Version: 5.12.4
Kernel Version: 5.3.0-42-generic
OS Type: 64-bit
Processors: 8 × Intel® Core™ i7-4790 CPU @ 3.60GHz
Memory: 15,6 GiB
Comment 1 Albert Astals Cid 2020-03-22 17:13:57 UTC
works fine here.

Does it stay "forever" or just for a while?

Can you do this?

* start k3b
* Open a terminal
* become root (su or sudo bash, depending if you use sudo or not)
* gdb attach  `pidof k3b`
* type "continue" and Enter in the gdb shell
* exit k3b
* wait for a bit
* type "bt" and Enter in the gdb shell

Paste the bt output
Comment 2 Stefano 2020-03-22 17:48:29 UTC
When I noticed this, it seems to stay running until I logout. Sometimes I forgot about it, then logged out some hours after and at the next login I found that it was saved in my session when I logged out.

I tried to follow your instructions, but "bt" didn't wrote any output. I waited a couple of minutes.
Comment 3 Albert Astals Cid 2020-03-22 18:42:39 UTC
(In reply to Stefano from comment #2)
> When I noticed this, it seems to stay running until I logout. Sometimes I
> forgot about it, then logged out some hours after and at the next login I
> found that it was saved in my session when I logged out.
> 
> I tried to follow your instructions, but "bt" didn't wrote any output. I
> waited a couple of minutes.

Then you did something wrong (or i wrote the instructions wrong). Please attach a screen capture of the terminal you're running gdb on
Comment 4 Stefano 2020-03-22 18:56:20 UTC
Created attachment 126953 [details]
GDB output
Comment 5 Stefano 2020-03-22 18:57:23 UTC
Do I need to install some debug or headers packages?
Comment 6 Stefano 2020-03-22 19:00:18 UTC
I obtained something doing this:

* start k3b
* Open a terminal
* become root (su or sudo bash, depending if you use sudo or not)
* gdb attach  `pidof k3b`
* type "continue" and Enter in the gdb shell
* exit k3b
* wait for a bit
**** CTRL-C
* type "bt" and Enter in the gdb shell

#0  0x00007f146b4e5c2f in __GI___poll (fds=0x56198c5a75d0, nfds=13, 
    timeout=16908) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f1466501a3e in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f1466501b73 in g_main_context_iteration ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f146ba8e635 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007f146ba355cb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007f146ba3d336 in QCoreApplication::exec() ()
   from /lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x000056198ab084c7 in ?? ()
#7  0x00007f146b3f71e3 in __libc_start_main (main=0x56198ab06eb0, argc=1, 
    argv=0x7ffd7e69e938, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7ffd7e69e928)
    at ../csu/libc-start.c:308
#8  0x000056198ab0871e in _start ()
Comment 7 Albert Astals Cid 2020-03-22 19:03:29 UTC
You're right, i forgot you had to press Ctrl+C on the gdb terminal.

That backtrace makes no sense.

How are you exiting k3b?
Comment 8 Stefano 2020-03-22 19:10:09 UTC
(In reply to Albert Astals Cid from comment #7)
> How are you exiting k3b?

I tried it in two ways: window close button and CTRL-Q. Same backtrace.
Comment 9 Stefano 2020-03-22 19:25:53 UTC
As a workaround I renamed my rc files and my k3b folder in ~/.local/share, then deleted the cache folder in ~/.cache

Starting it from scratch, solved my problem.

Then I changed the flag to not show the splash screen and the issue went back.

I changed that flag again to on, but nothing changed. Then I deleted again my k3brc file and the issue was gone.

Then I started it again from scratch. No issue. Changed two other random flags (to show the progress in the notification area and to hide the main windows while writing). No issue.

But then, when I closed it again and changed the splash screen flag, the problem was back again and remained until I deleted the rc file.
Comment 10 Albert Astals Cid 2020-03-22 22:41:45 UTC
Good find :)
Comment 11 Albert Astals Cid 2020-04-19 22:11:00 UTC
Git commit aa7df7817b88bd5a571dfce6c3ba4777830efedf by Albert Astals Cid.
Committed on 19/04/2020 at 22:10.
Pushed by aacid into branch 'release/20.04'.

Fix k3b not finishing if started without splash screen

M  +3    -5    src/k3bapplication.cpp

https://commits.kde.org/k3b/aa7df7817b88bd5a571dfce6c3ba4777830efedf