Skip to contentSkip to conversation

Status field in ps output for threaded programs in 2.6 kernel

DISCUSSION Nikita V. Youshchenko 2 participants 2 messages May 12, 2004

lore
Share & tools
lore
#0 lore raw

Hello.

Today I faced a situation that confused me.

One moment I found that on our server there is almost 100% CPU load in system state. However, ps and top and other tools could not locate any process eating CPU.

The situation was permanent - several minutes passed, still almost 100% CPU in system state, still no visible running processes.

I executed chkrootkit and it found lots of "hidden processes" - ones for which /proc/N/ exists (i.e. it is possible to cd there), but N is not in ps output (and even not in ls /proc output).

I checked /proc/N/cmdline for some of such "hidden" pids; it looks like they represent threads.
Well, maybe it is how NPTL threads work: for each thread a hidden /proc entry exists.
And it is chkrootkit's problem that is reports this (normal) case as possible LKM installed.

However, in my case, CPU-eating entities were found among thise hidden pids! They belonged to the same process (locally developed app, probably hanged), and this process was listed in ps output with status "S". After process was killed, CPU load went to 0%.

Looks like kernel bug: displayed status of threaded process should not be "S" if some threads are active. And CPU usage statistics should correspond to all threads.

This happened on a Debian testing/unstable system, running kernel package kernel-image-2.6.5-1-k7-smp 2.6.5-4.

#1 lore raw
Quoted 1 line · Nikita V. Youshchenko

Hello.

Hi

Quoted 3 lines

Looks like kernel bug: displayed status of threaded process should not be "S" if some threads are active. And CPU usage statistics should correspond to all threads.

Hmm I dont know about that. A "solution" here is to have top also display threads (like ps -m or ps -H of a recent procps distro).

Quoted 2 lines

This happened on a Debian testing/unstable system, running kernel package kernel-image-2.6.5-1-k7-smp 2.6.5-4.

Signature · 3 lines
Mihai RUSU                                    Email: [email protected]
GPG : http://dizzy.roedu.net/dizzy-gpg.txt    WWW: http://dizzy.roedu.net
                       "Linux is obsolete" -- AST