Bug 254273

Summary: the wallet doesn't close when screensaver starts
Product: [Applications] kwalletmanager Reporter: Szokovacs Robert <szo>
Component: generalAssignee: Valentin Rusu <valir>
Status: CLOSED FIXED    
Severity: normal CC: bugs, marcus, sebastian.radish, valir
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 4.11.2
Attachments: Screen capture showing qdbusviewer capturing screen saver signals

Description Szokovacs Robert 2010-10-15 16:37:56 UTC
Version:           unspecified (using KDE 4.5.2) 
OS:                Linux

I have configured kwalletmanager to close the wallet when the screensaver starts, but it still doesn't close it.
If I try to close it by hand, it warns that it can't close it cleanly. I had no way to determine what application keeps it open, but it should force the closure when the screensaver starts anyway.

Reproducible: Always
Comment 1 Rettich 2012-01-16 14:32:39 UTC
This problem still exists in 4.7.4
Kwallet is not closed, when screensaver starts.
Comment 2 Graeme Hewson 2012-05-03 17:03:16 UTC
This is a serious security problem.

Message when trying to close wallet (from menu after secondary mouse click in kwalletmanager) is: "Unable to close wallet cleanly. It is probably in use by other applications. Do you wish to force it closed?"
Comment 3 Graeme Hewson 2013-08-14 10:40:32 UTC
In KDE 4.11, I can see which applications have the wallet open. (The kwalletmanager version number, 1.10, hasn't changed from the version in KDE 4.10, but it is in fact a different version.) These applications include Kontact and KDE Wallet Manager itself, so the second paragraph of my comment 2 is irrelevant, and the message I mentioned there is valid.

Force closing the wallet, or File/Close All Wallets (which force closes if necessary, without prompting), has the desired effect, and this is what needs to happen automatically when the screensaver starts, if the system is configured to do so.
Comment 4 Marcus Harrison 2013-08-14 10:58:33 UTC
*** Bug 307874 has been marked as a duplicate of this bug. ***
Comment 5 Valentin Rusu 2013-09-03 20:47:57 UTC
On my system the wallet actually closes when screen saver kicks in. Can you confirm you still have this bug please?
Comment 6 Szokovacs Robert 2013-09-04 08:56:47 UTC
Yes. The "close when unused for: ..." is working, the "Close when screensaver starts" isn't.
Comment 7 Graeme Hewson 2013-09-04 10:54:11 UTC
Yes, the problem is still present. I'm using Kubuntu 13.04 with the KDE 4.11 PPA. The 4.11.1 PPA isn't available yet, but I don't see any relevant fixes in the list of changes.
Comment 8 Valentin Rusu 2013-09-04 18:55:25 UTC
Created attachment 82165 [details]
Screen capture showing qdbusviewer capturing screen saver signals
Comment 9 Valentin Rusu 2013-09-04 18:55:58 UTC
(In reply to comment #8)
> Created attachment 82165 [details]
> Screen capture showing qdbusviewer capturing screen saver signals

I'm using ArchLinux, with KDE compiled from sources (kdesrc-build), not the ones provided by their repositories. When the screen saver kicks-in, the wallet gets close by kwalletd. If that's not the case for you, perhaps there's a problem with the screen-saver logic on your distribution.

Could you (both of you, if possible) please do following test on your systems:
- launch qdbusviewer
- on the session bus, connect to org.freedesktop.ScreenSaver signal: ActiveChanged
* please see the attached screen-shot
* the connect command is available by right clicking the signal in the right pane
- wait for the screen saver to kick-in

Do you see the notifications in the bottom pane, as shown in my screen-shot?
Comment 10 Szokovacs Robert 2013-09-05 12:52:06 UTC
I see the same thing as in your screenshot, the only difference is I have 1.11 instead of 1.13
Comment 11 Graeme Hewson 2013-09-05 16:05:45 UTC
I too see the same messages as in your screenshot, except I have 1.14 instead of 1.13.
Comment 12 Graeme Hewson 2013-09-07 08:44:25 UTC
And the same happens with the Kubuntu 4.11.1 PPA. (Signal from :1.12 this time.)
Comment 13 Valentin Rusu 2013-09-07 11:38:44 UTC
Could you please perform the following steps
1. launch konsole then type the following commands
pkill kwalletd # to kill the instance launched with session open
kwalletd # to restart kwalletd
2. launch kwalletmanager and open the wallet
3. wait for the screen saver to kick-in
4. unlock screen saver then check wallet was closed in kwallet manager

Could you confirm that the walletd was actually close at step 4?
Comment 14 Graeme Hewson 2013-09-08 12:42:13 UTC
Yes, at step 4 the wallet is closed! Interesting.
Comment 15 Valentin Rusu 2013-09-08 12:50:59 UTC
OK, I now know how to fix it. Stay tuned. Thanks.
Comment 16 Valentin Rusu 2013-09-09 13:17:37 UTC
Git commit 744b7fa0e92584667fd5bc77e74b3ba62db3ddab by Valentin Rusu.
Committed on 09/09/2013 at 13:03.
Pushed by vrusu into branch 'KDE/4.11'.

Add retry timer to the screen saver connection logic
FIXED-IN: 4.11.2

It seems that on some systems the kwalletd comes before the screen saver
service, and so it fails to connect to it. As a result, it fails to receive
ActiveChanged signal, and wallets are never closed, even if the KCM option
for this is ticked. That is before the connection is attempted only
during startup. This commit adds a retry timer to reattempt connection.

The connection is reattempted every 10s, as long as kwalletd runs and the
screen saver service is not available.

M  +26   -8    kwalletd/kwalletd.cpp
M  +3    -0    kwalletd/kwalletd.h

http://commits.kde.org/kde-runtime/744b7fa0e92584667fd5bc77e74b3ba62db3ddab
Comment 17 Valentin Rusu 2013-09-09 13:18:45 UTC
Git commit 32b7cc40417fd98fa2f798fc36f41fbb73784b71 by Valentin Rusu.
Committed on 09/09/2013 at 13:03.
Pushed by vrusu into branch 'master'.

Add retry timer to the screen saver connection logic
FIXED-IN: 4.11.2

It seems that on some systems the kwalletd comes before the screen saver
service, and so it fails to connect to it. As a result, it fails to receive
ActiveChanged signal, and wallets are never closed, even if the KCM option
for this is ticked. That is before the connection is attempted only
during startup. This commit adds a retry timer to reattempt connection.

The connection is reattempted every 10s, as long as kwalletd runs and the
screen saver service is not available.

M  +26   -8    kwalletd/kwalletd.cpp
M  +3    -0    kwalletd/kwalletd.h

http://commits.kde.org/kde-runtime/32b7cc40417fd98fa2f798fc36f41fbb73784b71
Comment 18 Valentin Rusu 2013-09-09 13:20:32 UTC
I cannot test the fix on my system, though I think it'll work. Please close this bug when you get the future service release and confirm it's fixed for you.
Comment 19 Szokovacs Robert 2013-09-09 15:18:38 UTC
I replaced the distribution version with the patchen one, it works all right.