Remotely killing X-server - killing zombies explained

Remotely killing X-server - killing zombies explained

Post by Vincent Zweij » Tue, 12 Jan 1999 04:00:00



* Removed invalid newsgroup comp.os.linux
* Added newsgroup comp.os.linux.misc
* Followups to comp.os.linux.misc and linux.redhat.misc



||  >I did "kill -s $DIFFERENT_NUMBERS 644", and most of them didn't do
||  >anythig, but I think that "kill -s 9 644" turned 644 into a "zombie", and
||  >so it did with all other processes, belonging to X. But the screen on the
||  >hung machine didn't change.
||
||  IINM, zombie processes will eventually be killed off by the kernel by
||  killing their parents.  It's probably best (and fastest) to just kill their
||  parents yourself.  To find their parenst, do a 'ps fax' and track down
||  where this zombie X is.  Starting X (say, through 'startx') usually
||  launches a bunch of different scripts and stuff to load X, so the actual X
||  server will probably be nested pretty deeply.  Anyway you may see something
||  like this:

To kill this misconception before it starts: zombies aren't killed by
the kernel.

In fact, zombies can't be killed at all, with whatever signal; they're
already dead.  They don't hold any resources except a slot in the process
table.  There's no reason to want them out of the process table except
to free the slot.

A zombie is a dead process, the parent of which hasn't asked for its
exit status yet.  It is up to the parent to ask for the exit status of
a process by doing a wait()-like system call.

When a process exits, the kernel sends a SIGCHLD to its parent to
signal that a child has exited.  Sometimes, the parent process misses
this signal.  You can try to send this signal manually, and hope that
the parent obediently does a wait(), thus removing the zombied child.
Try "kill -CHLD <parent-pid>".

When a parent exits without wait()ing for a child process, the child
process gets a new parent process.  The new parent process is always
process 1, the mother of all process: init.

Init wait()s for its children.  If you kill the parent of a zombie,
the zombie moves to init.  Init then wait()s for it, and the zombie
disappears from the process table.  This is why is seems as if killing
the parent actually kills the zombie, but it's appearances only.

||   1556   1 S  0:00 -bash
||   1802   1 S  0:00  \_ sh /usr/X11R6/bin/startx -- -bpp 16
||   1803   1 S  0:00      \_ xinit /home/mikpos/.xinitrc -- -bpp 16
||   1804  ?  Z  0:00          \_ /usr/X11R6/bin/Xwrapper :0 -bpp 16
||   1806   1 S  0:00          \_ wmaker
||   1813   1 S  0:00              \_ rxvt -transparent -bg black -fg white +sb
||   1814  p0 S  0:00                  \_ bash
||   1816  p0 R  0:00                      \_ ps fax

If you ever see this situation (however improbable), try:

    kill -CHLD 1803

and see if xinit cleans up the situation.  It logs you out since the X
server has gone away.

Actually, the X server is gone already, so wmaker will be exiting shortly
because it lost its connection to the X server.  If xinit didn't notice
the X server dying, it will surely notice wmaker dying.

Bah.  I bit again.  This must be in innumerable unix text books.  :-)

Ciao.                                                            Vincent.
--

<http://www.xs4all.nl/~zweije/>      | don't read, does anybody get burnt?"
[Xhost should be taken out and shot] |            -- Paul Tomblin on a.s.r.

 
 
 

Remotely killing X-server - killing zombies explained

Post by Jeremy Mathe » Wed, 13 Jan 1999 04:00:00




...

Quote:>In fact, zombies can't be killed at all, with whatever signal; they're
>already dead.  They don't hold any resources except a slot in the process
>table.  There's no reason to want them out of the process table except
>to free the slot.
...
>Bah.  I bit again.  This must be in innumerable unix text books.  :-)

Yeah...  If I had a penny for everytime the concept of zombies has been
explained on the Usenet over the years, I'd be a wealthy man indeed.

 
 
 

1. Remotely killing X-server

I had a problem with X-server hanging at startup yesterday. I know the
reason for that, so that's not what this post is about.

I heard that it's possible to kill X-server through telneting from another
machine. I tried it, but command for example "kill 644" (directed at startx
at first, and then at all other X-related processes) didn't kill anything.

I did "kill -s $DIFFERENT_NUMBERS 644", and most of them didn't do anythig,
but I think that "kill -s 9 644" turned 644 into a "zombie", and so it did
with all other processes, belonging to X. But the screen on the hung machine
didn't change.

I admit that I didn't really know what I was doing with all these -s
switches, so can anyone please explain, what would have been a correct
procedure for this?

Thanx.

A.G.

2. Solaris x86: How do you enable modem control signals & RTS/CTS?

3. where is it explained that "kill 0" will kill the current script?

4. If you had to backup 18Gb fast...

5. Can't Kill Zombie processes, even with kill -9 (pid)

6. tar.gz question

7. KILL KILL KILL

8. Kernel change summary 1.1.55 -> 1.1.56

9. Kill COREL; Kill COREL; Kill COREL; ...

10. A method to kill process that cannot be killed even with `kill -9'.

11. How to kill process which not killed by 'kill' ?

12. TclTk killed my X-server

13. 75/100 DPI fonts kills my X-server