Bug 180482

Summary: busy wait when waiting for the password
Product: [Unmaintained] kdelibs Reporter: Salvo "LtWorf" Tomaselli <tiposchi>
Component: kwalletAssignee: Michael Leupold <lemma>
Status: RESOLVED FIXED    
Severity: normal CC: atomo64, cfeck, frank, schnitzelkuchen
Priority: NOR    
Version: SVN   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Salvo "LtWorf" Tomaselli 2009-01-12 18:47:48 UTC
Version:           Servizio portafogli di KDE: 0.2 (using Devel)
OS:                Linux
Installed from:    Compiled sources

If the password to unlock the wallet is not inserted immediately, kwalletd will do a busy wait taking much of the cpu to just wait for the user to insert the password.

That is what top says:
11969 salvo     20   0 58452  15m  11m R   57  0.8  22:04.17 kwalletd

and that 57 is the % of cpu usage.
Comment 1 Michael Leupold 2009-01-12 20:13:49 UTC
I remember there was a bugreport quite similar to this and I never really figured out what was causing it.

I hope you can provide some additional pointers:
1. Does that happen for every application requesting the wallet? (testing with 2 different ones should be sufficient)
2. Does it happen if you open your wallet from a terminal using
"qdbus org.kde.kwalletd /modules/kwalletd open kdewallet 0 test"? (replace kdewallet with your wallet name if it's named differently).
3. Does it happen if you open your wallet from a terminal using "qdbus org.kde.kwalletd /modules/kwalletd openAsync kdewallet 0 test 0"? (again replace kdewallet if needed)

Please close your wallet during those tries. If kwalletd isn't running yet, you can simply start it from the terminal ("kwalletd").
Could you please also check console output (or alternatively .xessions-errors) if there's any output related to kwallet?

I hope I can finally nail this down. Regards!
Comment 2 Salvo "LtWorf" Tomaselli 2009-01-13 00:14:19 UTC
1. I've tried with kopete and konqueror and i have the same result.
2. Still same result..
3. Same result.

I don't have any output if i launch from terminal, and the only thing about kwallet i have in .xsession-errors is: 
kwalletd(11969) KWalletD::setupDialog: Application ' "test" ' using kwallet without parent window!

Not so helpful...
Comment 3 Michael 2009-01-13 09:50:00 UTC
While i have the same problem with KDE 4.1.3, it is gone with 4.2 beta2.

In 4.1.3 it was enough to open kopete, so that kwalled opens too and waits for the wallet password. 

While waiting it consumes arround 50% CPU here.

Using 4.2 beta2 and trying the same, i get 0.0% to 0.1% CPU. So it looks like things got fixed between 4.1.3 and 4.2 beta2.

Comment 4 Michael Leupold 2009-02-01 10:39:32 UTC
I just thought I'd give a short update: I haven't been able to track this problem or even figure out what it might be related to. I've even asked some of the kwin guys if there's a line that might make the dialog eat your cpu. No success so far, sorry.
Comment 5 Frank Niethardt 2009-03-10 17:47:47 UTC
I discover the same - or similar - problem for some weeks now. I'm using archlinux with kdemod 4.2.1. on a Thinkpad SL-300

kwalletd CPU is at 10-20%, but at the same time the X cpu usage is at 80%, dropping as soon as the password is entered...

This is annoying because it silently drops chars of the password entered...
Comment 6 Frank Niethardt 2009-07-14 23:47:45 UTC
Same problem with me. Thinkpad SL300, archlinux, kdemod-testing (4.3 RC2) 60% X load, 20-30% kwalletd load.

maybe it's related to the intel X driver? But how?
Comment 7 Michael Leupold 2009-07-14 23:53:29 UTC
Do you see this behaviour anywhere else ie. in any other dialog that uses similar widgets (like a password edit)? I'll gladly accept any pointers that direct me to a solution to this problem.
If you are running with debugging symbols and know gdb, please attach to kwalletd to see what's going on.
Comment 8 Frank Niethardt 2009-07-15 09:03:02 UTC
so, I attached gdb to it and did a bt:

#0  0xb803f424 in __kernel_vsyscall ()
#1  0xb6863e6d in ___newselect_nocancel () from /lib/libc.so.6
#2  0xb647c055 in _xcb_conn_wait () from /usr/lib/libxcb.so.1
#3  0xb647c6ae in _xcb_out_send () from /usr/lib/libxcb.so.1
#4  0xb647ca57 in xcb_writev () from /usr/lib/libxcb.so.1
#5  0xb7a36232 in _XSend () from /usr/lib/libX11.so.6
#6  0xb7a36900 in _XEventsQueued () from /usr/lib/libX11.so.6
#7  0xb7a1f34f in XEventsQueued () from /usr/lib/libX11.so.6
#8  0xb6b9356e in ?? () from /usr/lib/libQtGui.so.4
#9  0xb6702c60 in g_main_context_prepare () from /usr/lib/libglib-2.0.so.0
#10 0xb6703001 in g_main_context_iterate () from /usr/lib/libglib-2.0.so.0
#11 0xb6703513 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#12 0xb7f456ac in QEventDispatcherGlib::processEvents () from /usr/lib/libQtCore.so.4
#13 0xb6b93315 in ?? () from /usr/lib/libQtGui.so.4
#14 0xb7f19559 in QEventLoop::processEvents () from /usr/lib/libQtCore.so.4
#15 0xb7f199aa in QEventLoop::exec () from /usr/lib/libQtCore.so.4
#16 0xb6fd7f53 in QDialog::exec () from /usr/lib/libQtGui.so.4
#17 0xb5932c61 in KWalletD::internalOpen (this=0xbfd6a978, appid=@0x99383a4, wallet=@0x99383b0, isPath=false, w=0,
    modal=true, service=@0x99383b4)
    at /home/jan/kdemod/testing/kdebase-runtime/src/kdebase-runtime-4.2.96/kwalletd/kwalletd.cpp:475
#18 0xb59340a6 in KWalletD::doTransactionOpen (this=0xbfd6a978, appid=@0x99383a4, wallet=@0x99383b0,
    isPath=<value optimized out>, wId=<value optimized out>, modal=true, service=@0x99383b4)
    at /home/jan/kdemod/testing/kdebase-runtime/src/kdebase-runtime-4.2.96/kwalletd/kwalletd.cpp:397
#19 0xb59351ab in KWalletD::processTransactions (this=0xbfd6a978)
    at /home/jan/kdemod/testing/kdebase-runtime/src/kdebase-runtime-4.2.96/kwalletd/kwalletd.cpp:183
#20 0xb5935542 in KWalletD::qt_metacall (this=0xbfd6a978, _c=QMetaObject::InvokeMetaMethod, _id=57, _a=0xbfd6a17c)
    at /home/jan/kdemod/testing/kdebase-runtime/src/kdebase-runtime-4.2.96/kwalletd/kwalletd.moc:277
#21 0xb7f3098c in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#22 0xb7f315c2 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#23 0xb7f35a17 in ?? () from /usr/lib/libQtCore.so.4
#24 0xb7f35b2c in ?? () from /usr/lib/libQtCore.so.4
#25 0xb7f2ab3f in QObject::event () from /usr/lib/libQtCore.so.4
#26 0xb6af5694 in QApplicationPrivate::notify_helper () from /usr/lib/libQtGui.so.4
#27 0xb6afcd7c in QApplication::notify () from /usr/lib/libQtGui.so.4
#28 0xb7537f0a in KApplication::notify (this=0xbfd6a9d4, receiver=0x9995a60, event=0xbfd6a610)
    at /home/jan/kdemod/testing/kdelibs/src/kdelibs-4.2.96/kdeui/kernel/kapplication.cpp:302
#29 0xb7f1afab in QCoreApplication::notifyInternal () from /usr/lib/libQtCore.so.4
#30 0xb7f4877e in ?? () from /usr/lib/libQtCore.so.4
#31 0xb7f45760 in ?? () from /usr/lib/libQtCore.so.4
#32 0xb66ffd98 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#33 0xb67033e0 in g_main_context_iterate () from /usr/lib/libglib-2.0.so.0
#34 0xb6703513 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#35 0xb7f456ac in QEventDispatcherGlib::processEvents () from /usr/lib/libQtCore.so.4
#36 0xb6b93315 in ?? () from /usr/lib/libQtGui.so.4
#37 0xb7f19559 in QEventLoop::processEvents () from /usr/lib/libQtCore.so.4
#38 0xb7f199aa in QEventLoop::exec () from /usr/lib/libQtCore.so.4
#39 0xb7f1be1f in QCoreApplication::exec () from /usr/lib/libQtCore.so.4
#40 0xb6af5517 in QApplication::exec () from /usr/lib/libQtGui.so.4
#41 0xb5929fcd in kdemain (argc=1, argv=0x9854d48)
    at /home/jan/kdemod/testing/kdebase-runtime/src/kdebase-runtime-4.2.96/kwalletd/main.cpp:68
#42 0x0804de42 in launch (argc=<value optimized out>, _name=<value optimized out>, args=<value optimized out>, cwd=0x0,
    envc=1, envs=0x98a952a "DISPLAY=:0.0", reset_env=false, tty=0x0, avoid_loops=false,
    startup_id_str=0x98a953b "stars;1247640582;251528;31382_TIME0")
    at /home/jan/kdemod/testing/kdelibs/src/kdelibs-4.2.96/kinit/kinit.cpp:676
#43 0x0804e9ad in handle_launcher_request (sock=<value optimized out>, who=<value optimized out>)
    at /home/jan/kdemod/testing/kdelibs/src/kdelibs-4.2.96/kinit/kinit.cpp:1168
#44 0x0804ee44 in handle_requests (waitForPid=<value optimized out>)
    at /home/jan/kdemod/testing/kdelibs/src/kdelibs-4.2.96/kinit/kinit.cpp:1361
#45 0x0804f63f in main (argc=2, argv=0xbfd6b2b4, envp=0xbfd6b2c0)
    at /home/jan/kdemod/testing/kdelibs/src/kdelibs-4.2.96/kinit/kinit.cpp:1788

hth
Comment 9 Raphael Geissert 2010-01-23 20:55:33 UTC
Setting EchoMode to ThreeStars in kdeglobals seems to trigger this problem.
Credits for the finding go to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=550866#10
Comment 10 Frank Niethardt 2010-01-23 23:20:47 UTC
I have 3 star method, too.

And regarding to the debian bug, where it is stated, that the password dialog don't accept confirmation: I have that too for a couple of versions now. What helps is setting QT_NO_GLIB=1
Comment 11 Christoph Feck 2010-01-31 20:07:42 UTC
SVN commit 1083166 by cfeck:

Fix paint recursion in "three bullet" password mode

There are other issues related to "three bullet" mode, such as
not being able to move cursor or select text. But simple typing
and backspace should work without 100% CPU and hangs.

Please test if this commit fixes this bug, it will be available
with the KDE SC 4.4.0 release.

CCBUG: 180482
CCBUG: 186724
CCBUG: 211250
CCBUG: 215380
CCBUG: 224693


 M  +10 -0     klineedit.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1083166
Comment 12 Christoph Feck 2010-01-31 20:08:50 UTC
SVN commit 1083167 by cfeck:

Fix paint recursion in "three bullet" password mode (backport r1083166)

CCBUG: 180482
CCBUG: 186724
CCBUG: 211250
CCBUG: 215380
CCBUG: 224693


 M  +10 -0     klineedit.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1083167
Comment 13 Christoph Feck 2010-02-24 01:11:51 UTC
Assuming the bug is fixed, since there was no further feedback. Please reopen if you see this issue with KDE SC 4.4.x.