[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    kde 3.5.10 hangs on startup!
From:       Andreas Haumer <andreas () xss ! co ! at>
Date:       2008-08-29 10:37:29
Message-ID: 48B7D169.3000102 () xss ! co ! at
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

After upgrade from kde-3.5.9 to kde-3.5.10 I found that
the startup sequence hangs!

After login using KDM and kdm_greeter I see the following processes:

andreas   2695  0.4  0.0   1972  1028 ?        Ss   22:22   0:00 /bin/sh \
/opt/kde3/bin/startkde andreas   2737  1.3  0.6  26584 12908 ?        S    22:22   \
0:00 ksplash --nodcop andreas   2739  0.7  0.3  22900  7872 ?        S    22:22   \
0:00 /opt/kde3/bin/kdeinit --oom-pipe 4 --new-startup +kcminit_startup andreas   2740 \
0.0  0.0      0     0 ?        Z    22:22   0:00 [start_kdeinit_w] <defunct> root     \
2741  0.0  0.0   1188   280 ?        S    22:22   0:00 start_kdeinit --new-startup \
+kcminit_startup andreas   2742  0.0  0.4  22908  8536 ?        Ss   22:22   0:00 \
/opt/kde3/bin/kdeinit --oom-pipe 4 --new-startup +kcminit_startup andreas   2743  0.0 \
0.4  22908  8536 ?        S    22:22   0:00 /opt/kde3/bin/kdeinit --oom-pipe 4 \
--new-startup +kcminit_startup


If I send a SIGUSR1 to the last process (PID 2743) it get's
one step furter:

andreas   2695  0.0  0.0   1972  1028 ?        Ss   22:22   0:00 /bin/sh \
/opt/kde3/bin/startkde andreas   2739  0.0  0.3  22900  7872 ?        S    22:22   \
0:00 /opt/kde3/bin/kdeinit --oom-pipe 4 --new-startup +kcminit_startup andreas   2740 \
0.0  0.0      0     0 ?        Z    22:22   0:00 [start_kdeinit_w] <defunct> root     \
2741  0.0  0.0   1188   280 ?        S    22:22   0:00 start_kdeinit --new-startup \
+kcminit_startup andreas   2742  0.0  0.4  23448  8820 ?        Ss   22:22   0:00 \
/opt/kde3/bin/kdeinit --oom-pipe 4 --new-startup +kcminit_startup andreas   2750  0.0 \
0.4  23012  8996 ?        S    22:24   0:00 kdeinit: dcopserver --nosid andreas   \
2752  0.0  0.4  23448  8820 ?        S    22:24   0:00 /opt/kde3/bin/kdeinit \
--oom-pipe 4 --new-startup +kcminit_startup


If I repeat sending the waiting processes a SIGUSR I eventuelly
get a initialized KDE desktop...

~ 2695 ?        Ss     0:00 /bin/sh /opt/kde3/bin/startkde
~ 2741 ?        S      0:00 start_kdeinit --new-startup +kcminit_startup
~ 2742 ?        Ss     0:00 kdeinit Running...
~ 2750 ?        S      0:00 kdeinit: dcopserver --nosid
~ 2752 ?        S      0:00 kdeinit: klauncher --new-startup
~ 2758 ?        S      0:00 kdeinit: kded --new-startup
~ 2765 ?        S      0:00 kdeinit: kcminit_startup
~ 2766 ?        S      0:00 kwrapper ksmserver
~ 2767 ?        S      0:00 kdeinit Running...


It looks like the changes to start_kdeinit.c (from kdelibs)
triggered this behaviour. It seems, the OOM protection doesn't
work right so that all starting processes are hanging in the
reset_oom_protect() method waiting for a SIGUSR1 signal to
come.

The problem is: this signal should be sent by the main method
of start_kdeinit (look at the end, the code which get's executed
by the child process):

~      case 0: /* child, keep privileges and do the privileged work */
~         close( pipes[ 1 ] );
~         for(;;) {
~            pid_t pid = 0;
~            int ret = read( pipes[ 0 ], &pid, sizeof( pid_t ));
~            if( ret < 0 && errno == EINTR )
~               continue;
~            if( ret <= 0 ) /* pipe closed or error, exit */
~               _exit(0);
~            if( pid != 0 ) {
~                if (set_protection( pid, 0 ))
~                    kill( pid, SIGUSR1 );
~            }
~         }


The changes from kde 3.5.9 to 3.5.10 makes that signal only be
sent if set_protection() returns a value other than 0:

@@ -145,10 +148,10 @@ int main(int argc, char **argv)
~             if( ret < 0 && errno == EINTR )
~                continue;
~             if( ret <= 0 ) /* pipe closed or error, exit */
- -               return 0;
+               _exit(0);
~             if( pid != 0 ) {
- -                set_protection( pid, 0 );
- -                kill( pid, SIGUSR1 );
+                if (set_protection( pid, 0 ))
+                    kill( pid, SIGUSR1 );
~             }
~          }


But look at this:

static int set_protection( pid_t pid, int enable )
{
~   char buf[ 1024 ];
~   int procfile;
~   sprintf( buf, "/proc/%d/oom_adj", pid );
~   if( !enable ) {
~       /* Be paranoid and check that the pid we got from the pipe
~          belongs to this user. */
~       struct stat st;
~       if( lstat( buf, &st ) < 0 || st.st_uid != getuid())
~           return 0;
~   }
~   procfile = open( buf, O_WRONLY );
~   if( procfile >= 0 ) {
~      if( enable )
~         write( procfile, "-5", sizeof( "-5" ));
~      else
~         write( procfile, "0", sizeof( "0" ));
~      close( procfile );
~   }
~   return 1;
}


In my case, set_protection() will always return 0, because
I'm running Linux 2.4 and I do not have the "/proc/%d/oom_adj"
file!

This change in kde 3.5.10 seems to break KDE on older Linux
systems!

Is there a way to (manually or automatically) disable the
OOM protector or should the changes reverted back to the
version of kde 3.5.9?

Comments?

- - andreas

- --
Andreas Haumer                     | mailto:andreas@xss.co.at
*x Software + Systeme              | http://www.xss.co.at/
Karmarschgasse 51/2/20             | Tel: +43-1-6060114-0
A-1100 Vienna, Austria             | Fax: +43-1-6060114-71
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIt9FoxJmyeGcXPhERAjSaAJ47WMrtqt0XhlOVQV6FWRQwq6jMggCeLHnS
qD4j6OubVUl+I0ML3VBFogw=
=1pH2
-----END PGP SIGNATURE-----
 
> > Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic