Bug 64785 - ksmserver fails to quit when session ended
Summary: ksmserver fails to quit when session ended
Status: RESOLVED FIXED
Alias: None
Product: ksmserver
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Solaris
: NOR major
Target Milestone: ---
Assignee: Lubos Lunak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-23 10:25 UTC by steve
Modified: 2004-01-22 05:49 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
trace (64.37 KB, text/plain)
2003-10-02 14:14 UTC, Philippe Bourdeu d'Aguerre
Details
full ~/.xsession-errors (39.39 KB, text/plain)
2003-11-10 21:54 UTC, Torsten Kasch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description steve 2003-09-23 10:25:58 UTC
Version:            (using KDE KDE 3.1.4)
Installed from:    Compiled From Sources
Compiler:          GCC 3.3.1 
OS:          Solaris

After logout selected from K menu, the panel and window manager exit but all X applications stay on the screen.

Progressively killing all kdeinit processes in turn the only one left being the process which I assume is ksmserver (as under Solaris all kde processes are named kdeinit) there is no change.

This remaining kdeinit process responds only to SIGKILL as far as I can tell.

Once this process is killed the session logs out.

This problem didn't exist in 3.1.3 (which I build only a week before using the same compiler etc.).
Comment 1 Stephen Usher 2003-09-23 11:19:45 UTC
Subject: Re:  New: ksmserver fails to quit when session ended

Having looked through old problems with ksmserver going way back to KDE 2.2,
one had a problem where ksmserver wouldn't die unless given SIGALRM.

I can verify that this is again the case.

Maybe it's an old bug resurfaced?

Steve
Comment 2 Philippe Bourdeu d'Aguerre 2003-09-25 09:17:29 UTC
I have same problem with Solaris 8 GCC 2.95.3 
I can get it working by patching startkde to use ksmserver from KDE 3.1.2 
Comment 3 G. Feldmann 2003-09-25 18:16:43 UTC
I had the same problem with Solaris8/9 on SPARC/x86. gcc3.2.3/3.3.1 
Qt 3.1.2/3.2.1. 
 
Replacing libkdecore by the library from the previous installation (3.1.3) 
helped. 
 
Guenter 
Comment 4 Torsten Kasch 2003-10-02 11:08:03 UTC
It looks like this problem persists in 3.2alpha2 
Comment 5 Lubos Lunak 2003-10-02 11:20:05 UTC
Can you please attach gdb to ksmserver and get a backtrace when it's hung? 
 
Comment 6 Philippe Bourdeu d'Aguerre 2003-10-02 14:14:10 UTC
Subject: Re:  ksmserver fails to quit when session ended

On Jeudi 2 Octobre 2003 11:20, you wrote:
> Can you please attach gdb to ksmserver and get a backtrace when it's hung?

I didn't have gdb on Solaris but I have truss. Trace is attached. Last 5 lines 
repeats forever.

Hope this helps.
Best regards,


Created an attachment (id=2668)
trace
Comment 7 Stephan Binner 2003-10-07 16:12:02 UTC
Add three more installations (Solaris 7 to 9) to this. I doubt that kdecore is 
to blame, sticking kdebase/ksmserver to KDE_3_1_3_RELEASE (so only two 
suspicious commits) let this problem disappear. 
Comment 8 Steve Evans 2003-10-07 17:34:01 UTC
I too see this problem, with Solaris 2.6. However using the 3.1.3 or 3.1.2 
version of ksmserver does *not* fix it for me. 
Comment 9 Stephen Usher 2003-10-07 17:46:24 UTC
Subject: Re:  ksmserver fails to quit when session ended

>I too see this problem, with Solaris 2.6. However using the 3.1.3 or 3.1.2 
>version of ksmserver does *not* fix it for me.

Have you made sure that you're pointing the LD_LIBRARY_PATH of ksmserver at
the old libraries as well?

eg.

LD_LIBRARY_PATH=/usr/local/kde-3.1.3/lib:$LD_LIBRARY_PATH \
kwrapper /usr/local/kde-3.1.3/bin/ksmserver $KDEWM

When I didn't do this with the KDE-3.1.1 ksmserver (which is the previous
version I had available) the bug still existed, which suggestes that it was
contained in one of the shared libraries rather than in the executable itself.

Steve

Comment 10 Steve Evans 2003-10-07 18:02:09 UTC
Subject: Re:  ksmserver fails to quit when session ended

On 7 Oct 2003, stephen.usher@earth.ox.ac.uk wrote:

Yes, that fixed it. Looks as though the problem is in a library.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (SunOS)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQE/guNI1a67iNP86GcRAlkcAKC2DJHc+6+JIlYjT+8qDkmWLKLxqwCcCjYB
IYuRARrrK9qJrMfEYMw/ZE4=
=HNa+
-----END PGP SIGNATURE-----

Comment 11 G. Feldmann 2003-10-16 15:48:55 UTC
Until the bug is fixed I use the following script as a
work around. The script is started from the startkde 
script.

#!/usr/local/bin/bash

sleep 20

wm=
dt=

while [ ${wm}a = a ] ; do
    wm=`sps -a | grep 'kdeinit: kwin' | grep -v grep | awk '{print $3}'`
done

while [ ${dt}a = a ] ; do
    dt=`sps -a | grep 'kdeinit: kdesktop' | grep -v grep | awk '{print $3}'`
done

sm=`sps -a | grep 'kdeinit: ksmserver' | grep -v grep | awk '{print $3}'`


while kill -0 $wm 2>/dev/null && kill -0 $dt 2>/dev/null; do
#       WM und DT still alive
        sleep 5
done


kill -9 $sm

Comment 12 Lubos Lunak 2003-10-27 15:50:45 UTC
Sorry, the trace is useless, I need a backtrace from a debugger. Also, please don't use kwrapper when starting ksmserver when testing it (kwrapper is there only to make it start faster). It only confuses things, as it may make ksmserver use different libraries than you believe.

Comment 13 Torsten Kasch 2003-10-28 10:53:55 UTC
Ok, I'll give it a try. I've just installed a recent CVS snapshot and attaching a gdb to a non-wrapped ksmserver process (after trying to log out) shows the following:

murph:~> gdb -p 27335
GNU gdb 5.2.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.8".
Attaching to process 27335
Reading symbols from ksmserver...done.
Reading symbols from /vol/kde-cvs/lib/libkdeinit_ksmserver.so...done.
Loaded symbols for /vol/kde-cvs/lib/libkdeinit_ksmserver.so
Reading symbols from /vol/kde-cvs/lib/libkdeui.so.4...done.
Loaded symbols for /vol/kde-cvs/lib/libkdeui.so.4
Reading symbols from /vol/kde-cvs/lib/libkdecore.so.4...done.
Loaded symbols for /vol/kde-cvs/lib/libkdecore.so.4
Reading symbols from /vol/kde-cvs/lib/libDCOP.so.4...done.
Loaded symbols for /vol/kde-cvs/lib/libDCOP.so.4
Reading symbols from /usr/lib/libdl.so.1...done.
Loaded symbols for /usr/lib/libdl.so.1
Reading symbols from /usr/lib/libresolv.so.2...done.
Loaded symbols for /usr/lib/libresolv.so.2
Reading symbols from /vol/graphics/lib/libart_lgpl_2.so.2...done.
Loaded symbols for /vol/graphics/lib/libart_lgpl_2.so.2
Reading symbols from /vol/kde-cvs/lib/libkdefx.so.4...done.
Loaded symbols for /vol/kde-cvs/lib/libkdefx.so.4
Reading symbols from /vol/qt-3.2.1/lib/libqt-mt.so.3...done.
Loaded symbols for /vol/qt-3.2.1/lib/libqt-mt.so.3
Reading symbols from /vol/graphics/lib/libpng.so.3...done.
Loaded symbols for /vol/graphics/lib/libpng.so.3
Reading symbols from /vol/graphics/lib/libz.so...done.
Loaded symbols for /vol/graphics/lib/libz.so
Reading symbols from /usr/openwin/lib/libXext.so.0...done.
Loaded symbols for /usr/openwin/lib/libXext.so.0
Reading symbols from /usr/openwin/lib/libX11.so.4...done.
Loaded symbols for /usr/openwin/lib/libX11.so.4
Reading symbols from /usr/lib/libsocket.so.1...done.
Loaded symbols for /usr/lib/libsocket.so.1
Reading symbols from /usr/lib/libnsl.so.1...done.
Loaded symbols for /usr/lib/libnsl.so.1
Reading symbols from /usr/openwin/lib/libSM.so.6...done.
Loaded symbols for /usr/openwin/lib/libSM.so.6
Reading symbols from /usr/openwin/lib/libICE.so.6...done.
Loaded symbols for /usr/openwin/lib/libICE.so.6
Reading symbols from /usr/lib/libpthread.so.1...done.
Loaded symbols for /usr/lib/libpthread.so.1
Reading symbols from /vol/gnu/lib/libstdc++.so.2.10.0...done.
Loaded symbols for /vol/gnu/lib/libstdc++.so.2.10.0
Reading symbols from /usr/lib/libm.so.1...done.
Loaded symbols for /usr/lib/libm.so.1
Reading symbols from /usr/lib/libc.so.1...done.
Loaded symbols for /usr/lib/libc.so.1
Reading symbols from /vol/local/lib/libz.so...done.
Loaded symbols for /vol/local/lib/libz.so
Reading symbols from /vol/graphics/lib/libmng.so.1...done.
Loaded symbols for /vol/graphics/lib/libmng.so.1
Reading symbols from /vol/graphics/lib/libjpeg.so.62...done.
Loaded symbols for /vol/graphics/lib/libjpeg.so.62
Reading symbols from /usr/lib/libGL.so.1...done.
Loaded symbols for /usr/lib/libGL.so.1
Reading symbols from /usr/lib/libXmu.so.4...done.
Loaded symbols for /usr/lib/libXmu.so.4
Reading symbols from /usr/lib/librt.so.1...done.
Loaded symbols for /usr/lib/librt.so.1
Reading symbols from /usr/lib/libmp.so.2...done.
Loaded symbols for /usr/lib/libmp.so.2
Reading symbols from /vol/graphics/lib/liblcms.so...done.
Loaded symbols for /vol/graphics/lib/liblcms.so
Reading symbols from /usr/openwin/lib/libdga.so.1...done.
Loaded symbols for /usr/openwin/lib/libdga.so.1
Reading symbols from /usr/openwin/lib/libXt.so.4...done.
Loaded symbols for /usr/openwin/lib/libXt.so.4
Reading symbols from /usr/lib/libaio.so.1...done.
Loaded symbols for /usr/lib/libaio.so.1
Reading symbols from /usr/lib/libmd5.so.1...done.
Loaded symbols for /usr/lib/libmd5.so.1
Reading symbols from /usr/platform/SUNW,Sun-Fire-280R/lib/libc_psr.so.1...done.
Loaded symbols for /usr/platform/SUNW,Sun-Fire-280R/lib/libc_psr.so.1
Reading symbols from /usr/lib/libthread.so.1...done.

warning: sol_thread_new_objfile: td_ta_new: Debugger service failed
Loaded symbols for /usr/lib/libthread.so.1
Reading symbols from /usr/lib/locale/de/de.so.2...done.

warning: sol_thread_new_objfile: td_ta_new: Debugger service failed
Loaded symbols for /usr/lib/locale/de/de.so.2
Reading symbols from /usr/openwin/lib/locale/common/xlibi18n.so.2...done.

warning: sol_thread_new_objfile: td_ta_new: Debugger service failed
Loaded symbols for /usr/openwin/lib/locale/common/xlibi18n.so.2
Reading symbols from /usr/openwin/lib/locale/common/ximlocal.so.2...done.

warning: sol_thread_new_objfile: td_ta_new: Debugger service failed
Loaded symbols for /usr/openwin/lib/locale/common/ximlocal.so.2
Reading symbols from /vol/kde-cvs/lib/kde3/plugins/styles/keramik.so...done.

warning: sol_thread_new_objfile: td_ta_new: Debugger service failed
Loaded symbols for /vol/kde-cvs/lib/kde3/plugins/styles/keramik.so
Reading symbols from /usr/openwin/lib/locale/iso8859-1/xomEuro.so.2...done.

warning: sol_thread_new_objfile: td_ta_new: Debugger service failed
Loaded symbols for /usr/openwin/lib/locale/iso8859-1/xomEuro.so.2
Retry #1:
Retry #2:
Retry #3:
Retry #4:
[New LWP 1]
Symbols already loaded for /vol/kde-cvs/lib/libkdeinit_ksmserver.so
Symbols already loaded for /vol/kde-cvs/lib/libkdeui.so.4
Symbols already loaded for /vol/kde-cvs/lib/libkdecore.so.4
Symbols already loaded for /vol/kde-cvs/lib/libDCOP.so.4
Symbols already loaded for /usr/lib/libdl.so.1
Symbols already loaded for /usr/lib/libresolv.so.2
Symbols already loaded for /vol/graphics/lib/libart_lgpl_2.so.2
Symbols already loaded for /vol/kde-cvs/lib/libkdefx.so.4
Symbols already loaded for /vol/qt-3.2.1/lib/libqt-mt.so.3
Symbols already loaded for /vol/graphics/lib/libpng.so.3
Symbols already loaded for /vol/graphics/lib/libz.so
Symbols already loaded for /usr/openwin/lib/libXext.so.0
Symbols already loaded for /usr/openwin/lib/libX11.so.4
Symbols already loaded for /usr/lib/libsocket.so.1
Symbols already loaded for /usr/lib/libnsl.so.1
Symbols already loaded for /usr/openwin/lib/libSM.so.6
Symbols already loaded for /usr/openwin/lib/libICE.so.6
Symbols already loaded for /usr/lib/libpthread.so.1
Symbols already loaded for /vol/gnu/lib/libstdc++.so.2.10.0
Symbols already loaded for /usr/lib/libm.so.1
Symbols already loaded for /usr/lib/libc.so.1
Symbols already loaded for /vol/local/lib/libz.so
Symbols already loaded for /vol/graphics/lib/libmng.so.1
Symbols already loaded for /vol/graphics/lib/libjpeg.so.62
Symbols already loaded for /usr/lib/libGL.so.1
Symbols already loaded for /usr/lib/libXmu.so.4
Symbols already loaded for /usr/lib/librt.so.1
Symbols already loaded for /usr/lib/libmp.so.2
Symbols already loaded for /vol/graphics/lib/liblcms.so
Symbols already loaded for /usr/openwin/lib/libdga.so.1
Symbols already loaded for /usr/openwin/lib/libXt.so.4
Symbols already loaded for /usr/lib/libaio.so.1
Symbols already loaded for /usr/lib/libmd5.so.1
Symbols already loaded for /usr/platform/SUNW,Sun-Fire-280R/lib/libc_psr.so.1
Symbols already loaded for /usr/lib/libthread.so.1
Symbols already loaded for /usr/lib/locale/de/de.so.2
Symbols already loaded for /usr/openwin/lib/locale/common/xlibi18n.so.2
Symbols already loaded for /usr/openwin/lib/locale/common/ximlocal.so.2
Symbols already loaded for /vol/kde-cvs/lib/kde3/plugins/styles/keramik.so
Symbols already loaded for /usr/openwin/lib/locale/iso8859-1/xomEuro.so.2
0xfe11ca1c in _poll () from /usr/lib/libc.so.1
(gdb) where
#0  0xfe11ca1c in _poll () from /usr/lib/libc.so.1
#1  0xfe0ce988 in _select () from /usr/lib/libc.so.1
#2  0xfddbed7c in select () from /usr/lib/libthread.so.1
#3  0xfee54380 in ?? () from /vol/kde-cvs/lib/libkdecore.so.4
#4  0xfee52d38 in ?? () from /vol/kde-cvs/lib/libkdecore.so.4
#5  0xff37282c in FreeAuthenticationData (count=-4199104, 
    authDataEntries=0x6ccb0) at server.cpp:626
#6  0xff373bf0 in KSMServer::cleanUp (this=0xffbfee48) at server.cpp:850
#7  0xff3702cc in KSMServer::qt_invoke (this=0x62af8, _id=2, _o=0xffbfefb0)
    at server.moc:106
#8  0xfe650db8 in ?? () from /vol/qt-3.2.1/lib/libqt-mt.so.3
#9  0xfe650c88 in ?? () from /vol/qt-3.2.1/lib/libqt-mt.so.3
#10 0xfee1e03c in ?? () from /vol/kde-cvs/lib/libkdecore.so.4
#11 0xfee1e2c0 in ?? () from /vol/kde-cvs/lib/libkdecore.so.4
#12 0xfe650d98 in ?? () from /vol/qt-3.2.1/lib/libqt-mt.so.3
#13 0xfe650c88 in ?? () from /vol/qt-3.2.1/lib/libqt-mt.so.3
#14 0xfe8e965c in ?? () from /vol/qt-3.2.1/lib/libqt-mt.so.3
#15 0xfe617010 in ?? () from /vol/qt-3.2.1/lib/libqt-mt.so.3
#16 0xfe616e0c in ?? () from /vol/qt-3.2.1/lib/libqt-mt.so.3
#17 0xfe606f44 in ?? () from /vol/qt-3.2.1/lib/libqt-mt.so.3
#18 0xff36ffb0 in kdemain (argc=-4197400, argv=0xffbff3f8) at main.cpp:244
#19 0x00010764 in main (argc=1, argv=0xffbff5f4) at ksmserver.la.cpp:2
(gdb) 

If you need more/other information, you need to guide me a little bit, I'm afraid... ;-)
Comment 14 Bernd Kuhls 2003-10-28 15:07:39 UTC
@G. Feldmann, comment 11
could you please mail me the sps tool, it seems it is not included
in Solaris 9. I tried for three hours this morning getting sps
compiled, without luck. Is your version 64bit compatible?
Greetings, Bernd Kuhls
bernd (dot) kuhls (at) informatik (dot) uni-oldenburg (dot) de
Comment 15 Lubos Lunak 2003-10-29 14:00:48 UTC
The backtrace is pretty broken, but seems sufficient. Can you
- modify startkde to run ksmserver with --local and see if it changes anything?
- run 'echo >/tmp/a.txt' and 'iceauth source /tmp/a.txt' and see what it does?
- check using 'ps aux' (or is it ps -ef on Solaris?) and see if it shows also iceauth?
Comment 16 Torsten Kasch 2003-10-30 10:38:18 UTC
The gdb output is somewhat incomplete because I didn't use the GNU binutils (ld) for compiling because I've learned in the past that you don't want them on Solaris (at least not on sparc). I have gcc-2.95.3 + binutils + gdb on my Solaris 8 x86 box at home on which symbol resolution usually works much better - I'll try to do some debugging there later.

Anyway, here are my results:

(1)
"ksmserver -local" doesn't seem to make any difference (it doesn't terminate when trying to log out)

(2)
Did you really mean to source an empty file? If so, it didn't produce an error...

(3)
the only processes running (after trying to log out) are:
murph:~> ps -fu juser
     UID   PID  PPID  C    STIME TTY      TIME CMD
   juser   540  1030  0 10:14:13 pts/1    0:00 -bash
   juser   531   530  0 10:12:50 pts/3    0:00 bash
   juser   412 29309  0 10:10:35 ?        0:00 /bin/sh /vol/kde-cvs/bin/startkde
   juser   472     1  0 10:10:43 ?        0:00 kdeinit +kcminit +knotify
   juser   460     1  0 10:10:41 ?        0:00 kdeinit +kcminit +knotify
   juser   483     1  0 10:10:50 ?        0:01 kdeinit +kcminit +knotify
   juser   595   540  0 10:36:04 pts/1    0:00 ps -fu juser
   juser   509   460  0 10:11:06 ?        0:00 xterm
   juser   467   460  0 10:10:42 ?        0:00 kdeinit +kcminit +knotify
   juser   481   460  0 10:10:48 ?        0:00 /vol/kde-cvs/bin/artsd -F 10 -S 4096 -s 60 -m artsmessage -c drkonqi -l 3 -f
   juser   530   510  0 10:12:50 pts/2    0:00 xterm
   juser   464     1  0 10:10:41 ?        0:00 kdeinit +kcminit +knotify
   juser   441   412  0 10:10:37 ?        0:00 /opt/SUNWut/lib/utslaunch
   juser   440     1  0 10:10:37 ?        0:00 /opt/SUNWut/bin/utaudio
   juser   510   509  0 10:11:06 pts/2    0:00 bash
   juser   493   460  0 10:10:57 ?        0:00 kdeinit +kcminit +knotify
   juser   484   412  0 10:10:51 ?        0:01 ksmserver --local
Comment 17 Torsten Kasch 2003-10-30 16:15:32 UTC
I'm not sure if it's relevant, but it seems that I have to kill the ksmserver process twice (SIGTERM) to actually make it die, at least when running without "krwapper".
Comment 18 Lubos Lunak 2003-10-30 16:24:13 UTC
Could you please try again mixing CVS ksmserver/libkdecore with the 3.1 ones, this time without kwrapper, so it's clear which ones are used, and report which combinations work?
Comment 19 Torsten Kasch 2003-10-30 16:59:20 UTC
I just tried copying libkdecore.so.4.1.0 from our 3.1.2 installation to the libdir of my cvs test-installation (and re-made the .so and .so.4 symlinks), but this results in KDE not starting at all. My ~/.xsession-errors says:

startkde: Starting up...
ld.so.1: ksplash: fatal: relocation error: file /vol/kde-cvs/lib/libkio.so.4: sy
mbol expandPlainMacro__18KMacroExpanderBaseRC7QStringUiR11QStringList: reference
d symbol not found
Killed
ld.so.1: kdeinit: fatal: relocation error: file kdeinit: symbol setTimestamp__16
KStartupInfoDataUl: referenced symbol not found
Killed
startkde: Could not start kdeinit. Check your installation.
startkde: Shutting down...
Warning: connect() failed: : No such file or directory
Error: Can't contact kdeinit!
startkde: Running shutdown scripts...
startkde: Done.

Trying it the other way isn't currently an option, since 3.1.2 is our production version and breaking it would disturb > 150 users...

I'm currently trying to build a CVS ksmserver binary linked against 3.1.2's kdecore but I didn't succeed yet...

Did I miss something?
Comment 20 Lubos Lunak 2003-10-31 11:10:18 UTC
Maybe it would be enough if you recompiled libkdecore with kprocess.* and kprocctrl.* files from 3.1.x. My crystal ball believes that's where the backtrace points.
You'll get two compile errors in kapplication.cpp, just comment the two lines out.
Comment 21 Torsten Kasch 2003-10-31 14:29:01 UTC
Ok, I did as you suggested (did a make && make install in kdelibs/kdecore/ only, I hope that was enough?), but the problem still persists.
Comment 22 Torsten Kasch 2003-11-09 17:15:48 UTC
I think I've got a more useful backtrace now:

(gdb) where
#0  0x08046c6c in ?? ()
#1  0xdead9605 in _poll () from /usr/lib/libc.so.1
#2  0xde8087c4 in select () from /usr/lib/libthread.so.1
#3  0xdf7e68d4 in KProcess::start (this=0x8046fc8, runmode=Block, 
    comm=NoCommunication) at kprocess.cpp:439
#4  0xdfb9253f in FreeAuthenticationData (count=2, authDataEntries=0x808ac30)
    at server.cpp:626
#5  0xdfb93d0a in KSMServer::cleanUp (this=0x80857f8) at server.cpp:856
#6  0xdfb901c1 in KSMServer::qt_invoke (this=0x80857f8, _id=2, _o=0x80471b4)
    at server.moc:106
#7  0xdeed29af in QObject::activate_signal (this=0x8047450, clist=0x808e2b8, 
    o=0x80471b4) at kernel/qobject.cpp:2333
#8  0xdeed27d1 in QObject::activate_signal (this=0x8047450, signal=15)
    at kernel/qobject.cpp:2302
#9  0xdf7b2540 in KApplication::shutDown (this=0x8047450)
    at kapplication.moc:232
#10 0xdf7b27a1 in KApplication::qt_emit (this=0x8047450, _id=15, _o=0x80472f4)
    at kapplication.moc:270
#11 0xdeed2969 in QObject::activate_signal (this=0x8047450, clist=0x8076510, 
    o=0x80472f4) at kernel/qobject.cpp:2331
#12 0xdeed27d1 in QObject::activate_signal (this=0x8047450, signal=3)
    at kernel/qobject.cpp:2302
#13 0xdf243ad1 in QApplication::aboutToQuit (this=0x8047450)
    at .moc/debug-shared-mt/moc_qapplication.cpp:100
#14 0xdee8111f in QEventLoop::enterLoop (this=0x806b0d0)
    at kernel/qeventloop.cpp:210
#15 0xdee80fa9 in QEventLoop::exec (this=0x806b0d0)
    at kernel/qeventloop.cpp:145
#16 0xdee6a3a5 in QApplication::exec (this=0x8047450)
    at kernel/qapplication.cpp:2705
#17 0xdfb8f7f5 in kdemain (argc=1, argv=0x80475a0) at main.cpp:244
#18 0x080487c8 in main (argc=1, argv=0x80475a0) at ksmserver.la.cpp:2
(gdb) 

It seems to me that ksmserver is somehow "hanging" in commClose() -- at least that's line 439 of my kdelibs/kdecore/kprocess.cpp. I'll try digging furhter unless someone has an idea...
Comment 23 Torsten Kasch 2003-11-09 18:20:57 UTC
It's the select() in KProcess::commClose() that blocks because "runs == true" and thus p_timeout is NULL -- now I've to find out WHAT runs... ;-) Maybe someone of the core developers can give some insight on this?
Comment 24 Torsten Kasch 2003-11-09 19:26:01 UTC
I've now placed some kdDebug() calls in kprocess.cpp, here's the output. I hope it's useful...

[...]
DCOP: unregister 'kalarmd'
ksmserver:  We killed all clients. We have now clients.count()=11
ksmserver: KSMServer::completeKilling clients.count()=11
ksmserver: KSMServer::completeKilling clients.count()=10
ksmserver: KSMServer::completeKilling clients.count()=9
ksmserver: KSMServer::completeKilling clients.count()=8
ksmserver: KSMServer::completeKilling clients.count()=7
ksmserver: KSMServer::completeKilling clients.count()=6
ksmserver: KSMServer::completeKilling clients.count()=5
ksmserver: KSMServer::completeKilling clients.count()=4
DCOP: unregister 'irkick'
kio (KDirLister): -KDirLister
kio (KDirLister): [void KDirLister::stop()] 
kio (KDirListerCache): [void KDirListerCache::stop(KDirLister *)] lister: 80d963
8
kio (KDirListerCache): [void KDirListerCache::forgetDirs(KDirLister *)] 80d9638
kio (KDirListerCache): [void KDirListerCache::forgetDirs(KDirLister *, const KUR
L &, bool)] 80d9638 url: file:/homes/torsten/Desktop
kio (KDirListerCache): [void KDirListerCache::forgetDirs(KDirLister *, const KUR
L &, bool)] 80d9638 item moved into cache: file:/homes/torsten/Desktop
kio (KDirWatch): Removed Dir /homes/torsten/Desktop [KDirWatch-1]
kio (KDirListerCache): -KDirListerCache
DCOP: unregister 'kdesktop'
ksmserver: KSMServer::completeKilling clients.count()=3
ksmserver: KSMServer::completeKilling clients.count()=2
kdecore (KLibLoader): The KLibLoader contains the library systemtray_panelapplet
 (8130b10)
kdecore (KLibLoader): The KLibLoader contains the library ktimemon_panelapplet (
810c2d8)
kdecore (KLibLoader): The KLibLoader contains the library kickermenu_prefmenu (8
0d0ac8)
kdecore (KLibLoader): The KLibLoader contains the library taskbar_panelapplet (8
0f04a8)
kdecore (KLibLoader): The KLibLoader contains the library minipager_panelapplet 
(80d8688)
kdecore (KLibLoader): The KLibLoader contains the library clock_panelapplet (813
8c38)
kdecore (KLibLoader): The KLibLoader contains the library lockout_panelapplet (8
11b728)
DCOP: unregister 'kicker'
ksmserver: KSMServer::completeKilling clients.count()=1
DCOP: unregister 'kwin'
kdeinit: PID 7918 terminated.
ksmserver: KSMServer::completeKilling clients.count()=0
ksmserver: clients.isEmpty() -> quit
ksmserver: calling commClose()
ksmserver: commClose(): entering commClose()
ksmserver: commClose(): closeStdin() returned
ksmserver: commClose(): pid_ = 7961
ksmserver: commClose(): entered if( pid_ )
ksmserver: commClose(): notfd = 5
ksmserver: commClose(): entered while() loop
ksmserver: commClose(): test: if (runs) == true
ksmserver: commClose(): rfd += notfd = 5
ksmserver: commClose(): select()ing with max_fd = 5
ksmserver: commClose(): select() returned, fds_ready =  -1
ksmserver: commClose(): fds_ready < 0 && errno == EINTR
ksmserver: commClose(): entered while() loop
ksmserver: commClose(): test: if (runs) == true
ksmserver: commClose(): rfd += notfd = 5
ksmserver: commClose(): select()ing with max_fd = 5
Comment 25 Oswald Buddenhagen 2003-11-09 20:14:29 UTC
hmm, that's the second time a similar problem is reported - but the last time it simply went away. :}
please put some debug into kprocctrl.cpp (maybe not kdDebug, it could be unhealthy in a signal handler ...)
there are a few possiblities ... either the signal does not arrive, or it does not properly write into the notification pipe, or the select() does not poll the pipe correctly. dunno ...
Comment 26 Lubos Lunak 2003-11-10 18:46:42 UTC
The thing that's run using KProcess is iceauth.
Comment 27 Torsten Kasch 2003-11-10 21:54:29 UTC
Created attachment 3135 [details]
full ~/.xsession-errors

Hmm, are you sure about iceauth? Shouldn't I see a such a process hanging
around? I'm aware of the fact that on Solaris it's difficult to tell what all
the kdeinit processes actually are (no setproctitle), but even /usr/ucb/ps
(which is a little more verbose in this respect) doesn't seem to suggest to me
that it's iceauth.

Anyway, I've placed some printf()'s in kprocctrl.cpp and included a full
~/.xsession-errors (from login until trying to log out). Maybe it's still not
enough, but perhaps it helps...

Just a wild guess that came to my mind while trying to understand what's
happening in kprocctrl.cpp. The sigprocmask() manpage says:

"[...] In  a  multithreaded  program,  the  call  to   sigpromask()
impacts  only the calling thread's signal mask and is there-
fore identical to a call to  thr_sigsetmask(3THR)."

Can it be that there is some fundamental issue in the code with respect to
multithreaded apps? FWIW: KDE 3.1.x worked flawlessly on all the systems I'm
currently testing on...
Comment 28 Torsten Kasch 2003-11-12 08:59:20 UTC
Trying to investigate this furhter, I replaced the "iceauth" command with the following shell script:

--- snip ---
#!/bin/sh

LOG=/tmp/iceauth.log
date >> $LOG
echo iceauth "$*" >> $LOG
/usr/openwin/bin/iceauth $*
date >> $LOG
echo >> $LOG
--- snip ---

which produced the following output:

--- snip ---
Wed Nov 12 08:50:51 MET 2003
iceauth source /tmp/dcopAAAlBaqP4
Wed Nov 12 08:50:51 MET 2003

Wed Nov 12 08:50:59 MET 2003
iceauth source /tmp/kde-juser/ksmservergVbaaa.tmp
Wed Nov 12 08:50:59 MET 2003

Wed Nov 12 08:51:20 MET 2003
iceauth source /tmp/kde-juser/ksmserverdfeaaa.tmp
Wed Nov 12 08:51:20 MET 2003

Wed Nov 12 08:51:52 MET 2003
iceauth remove netid=local/murph:/tmp/.ICE-unix/dcop29002-1068623451
Wed Nov 12 08:51:52 MET 2003

--- snip ---

The first two "iceauth" calls appeared after logging in, the third after selecting "log out" from the desktop's context menu. The last one after sending the ksmserver process (running w/o krwapper) a SIGTERM twice (after the first signal nothing seemed to have happened).
Comment 29 grant mcdorman 2003-11-19 23:37:59 UTC
In KSMServer constructor we find this code:
    signal(SIGCHLD, the_reaper);
(line 808).

KProcessController's signal handler is initialized before KSMServer calls this; as a result, this overrides KProcessController's signal handler, and results in nothing working.

Commenting out the line allows ksmserver to exit normally.

Presumably on some systems (Linux, perhaps?) signal() and sigaction() are independant. On Solaris, signal() is a wrapper for sigaction().
Comment 30 Oswald Buddenhagen 2003-11-20 00:13:52 UTC
> signal(SIGCHLD, the_reaper); 
>
good catch ... thanks.

> Commenting out the line allows ksmserver to exit normally. 
>
something else probably breaks instead. :}

> Presumably on some systems (Linux, perhaps?) signal() and sigaction() are
> independant.
>
i don't think that's possible. it must have different reasons that it works on most other systems.

i will take care of it, unless somebody else explicitly _wants_ to do it.
Comment 31 grant mcdorman 2003-11-20 16:43:05 UTC
> > Commenting out the line allows ksmserver to exit normally.
> >
> something else probably breaks instead. :}

It's to prevent accumulation of zombie ("defunct") processes, and serves no
other function. This will only happen if ksmserver executes processes without
using KProcessController and does not explictly wait for the PID; a quick grep
of the code didn't show any such case. In addition, at the moment on my Solaris
8 system with 3.1.4, there are no zombie processes.

> > Presumably on some systems (Linux, perhaps?) signal() and sigaction() are
> > independant.
> >
> i don't think that's possible. it must have different reasons that it works on > most other systems. 

Perhaps. However, I can't see how it would work otherwise - KProcessController
will only indicate the process finished if it receives a SIGCHILD. I'm not going
to worry about it, though <grin>.
Comment 32 Oswald Buddenhagen 2003-11-20 17:57:40 UTC
ok, fixed. removing this cruft should have no side effects, in fact: no fork() -> no SIGCHLD.
Comment 33 Bernd Kuhls 2004-01-15 15:33:00 UTC
Why did this patch not make it into KDE-3.1.5?
Comment 34 Albert L. Ting 2004-01-22 01:18:38 UTC
I agree with comment #33, can somebody provide a 3.1.5 patch? 
Comment 35 Oswald Buddenhagen 2004-01-22 05:49:17 UTC
yeah yeah ... backported - but don't expect another 3.1.x release.
use "cvs diff -r 1.95.2.5 -r 1.95.2.6 ksmserver/server.cpp" to get the patch.