2

One of my servers has a process running called klogd which is running at 99.9% CPU according to top (output from top below)

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                               
 3932 klog      25   0  5932 2220   16 R 99.7  0.1 162333:28 klogd                                                                                                                                  
    1 root      15   0  4100  584  300 S  0.0  0.0   6:10.66 init                                                                                                                                   
    2 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/0                                                                                                                            
    3 root      34  19     0    0    0 S  0.0  0.0   0:00.33 ksoftirqd/0                                                                                                                            
    4 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/0                                                                                                                             
    5 root      10  -5     0    0    0 S  0.0  0.0   0:03.63 events/0                                                                                                                               
    6 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 khelper                                                                                                                                
    7 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 kthread                                                                                                                                
   29 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 kblockd/0                                                                                                                              
   30 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 kacpid                                                                                                                                 
   31 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 kacpi_notify

Iv had a Google and this seems to be a standard process for handling logging. None of the log files seem to be really big and there's not too much else happening on the server.

The operating system is Ubuntu 9.04

2 Answers 2

0

What does strace -ppidof klogd`` show you?

5
  • I get the line read(0, ""..., 4095) = 0 repeatedly in a loop Jul 30, 2010 at 10:05
  • And what does sudo ls -l /proc/pidof klogd/fd/ show you? Jul 30, 2010 at 10:27
  • So, read() from the kmsg socket is indicating End Of File, which probably means nothing is connected to the other end. On my Ubuntu 8.04 servers there's a dd bs=1 if=/proc/kmsg of=/var/run/klogd/kmsg process running as root that writes to this socket. I guess dd was somehow killed on your server. I would reboot. Jul 30, 2010 at 11:42
  • Marius: Instead of rebooting straight away, I would first try to restart that dd (and klogd) and see if the cpu usage goes away. That just to check if the reason for klogd's strange behaviour was actually due the missing dd. Jul 30, 2010 at 11:47
  • Hi, Iv restarted klogd and it seems to be running at normal CPU. Its restart dd as well now which wasn't running before the restart. Thank you both for your help. Jul 30, 2010 at 13:20
4

I've seen this a lot in version 2.6.32

run /etc/init.d/klogd restartto fix the 99% cpu.

The real fix is to update your kernel.

There was a bug when reading /proc/kmsg pseudo file. Hopefully this bug is fixed by now. Here is Linus' take on the problem (quite funny)

2
  • Sadly, there is no init.d script on my version. How might I ensure this doesn't run in the short term, while we make plans to upgrade to a later kernel? Sep 30, 2013 at 18:21
  • Maybe something drastic like killall -KILL klogd ?
    – a9k
    Nov 27, 2013 at 18:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .