You are not logged in.

#1 2009-01-05 19:41:16

zatricky
Member
From: Stockholm
Registered: 2008-09-03
Posts: 56
Website

Find out what is the parent process of another arb process [solved]

The actual problem is that I have 1000s of processes, each giving the following from ps aux:

root       664  0.0  0.0     0    0 ?        Z     2008   0:01 [ php ] <defunct>

And the following error pops up randomly while trying to work - as a result of being out of of file descriptors (? or something like that):

bash: fork: Resource temporarily unavailable

From what I understand, there's a (small) chance I can kill all of these processes with a kill -9 {}, however it isn't working.

I assume its because these processes are zombies and can't be killed directly so I'd like to try killing their parent first. A ps aux seems to take ages and I'd like to know if there's a way from the bash prompt to find out which is the parent process that originally spawned all these defunct processes. I'm hoping that a pstree > treelist.txt isn't the easiest option - coz that might take ages. hmm

Can someone please point me in the right direction?

Last edited by zatricky (2009-01-05 20:49:53)


pacman russian roulette: yes | pacman -Rcs $(pacman -Q | LANG=C sort -R | head -n $((RANDOM % 10)))
(yes, I know its broken)

Offline

#2 2009-01-05 19:52:11

daf666
Member
Registered: 2007-04-08
Posts: 470
Website

Re: Find out what is the parent process of another arb process [solved]

try: cat /proc/<defunct pid>/status | grep PPid

Offline

#3 2009-01-05 20:49:31

zatricky
Member
From: Stockholm
Registered: 2008-09-03
Posts: 56
Website

Re: Find out what is the parent process of another arb process [solved]

Aha!

Its a cacti server btw. The parent was spine. When I killed spine then the php processes disappeared in a flash. smile

Thank you so much. smile

[root@cacti ~]# ps aux | grep php | grep defunct
....
....
root       480  0.0  0.0     0    0 ?        Z     2008   0:01 [php] <defunct>                                        
root       481  0.0  0.0     0    0 ?        Z     2008   0:01 [php] <defunct>                                        
root       482  0.0  0.0     0    0 ?        Z     2008   0:01 [php] <defunct>                                        
root       483  0.0  0.0     0    0 ?        Z     2008   0:01 [php] <defunct>                                        
root       484  0.0  0.0     0    0 ?        Z     2008   0:01 [php] <defunct>                                        
root       485  0.0  0.0     0    0 ?        Z     2008   0:01 [php] <defunct>                                        
root       486  0.0  0.0     0    0 ?        Z     2008   0:01 [php] <defunct>                                        
root       487  0.0  0.0     0    0 ?        Z     2008   0:01 [php] <defunct>                                        
root       488  0.0  0.0     0    0 ?        Z     2008   0:01 [php] <defunct>
....
....
[root@cacti ~]# cat /proc/480/status | grep PPid
PPid:   26342
[root@cacti ~]# cat /proc/26342/status | grep Name
Name:   spine
[root@cacti ~]# killall spine
[root@cacti ~]# ps aux | grep php | grep defunct
[root@cacti ~]#

pacman russian roulette: yes | pacman -Rcs $(pacman -Q | LANG=C sort -R | head -n $((RANDOM % 10)))
(yes, I know its broken)

Offline

Board footer

Powered by FluxBB