convert zombie processes (resizing)

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
btilford
Posts: 3
Joined: 2012-03-21T09:36:21-07:00
Authentication code: 8675308

convert zombie processes (resizing)

Post by btilford »

I've been having some issues with convert causing zombie processes. It seems to be related to only happen when there are a number of convert commands executing at the same time.

I've tested this on
Ubuntu 2 CPUs
CentOS 1 CPU
ImageMagick 6.2.8
ImageMagick 6.7.6-0 (compiled with both --disable-openmp and without)


Any ideas as to what causes convert to go zombie? Is it the number of concurrent processes, data load, some random bug?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: convert zombie processes (resizing)

Post by anthony »

A "zombie" process is dead. It does not use any resources except an entry in the process table.

In UNIX processing terms, a zombie is a process that has died, but the 'parent' that created the process has yet to reconise that its 'child' process is in fact dead, and that it should read its 'exit status' by 'waiting' for it.

The problem is not with "convert" (which is dead) but with the program that forked (created) "convert".

Shells (not shell scripts) automatcially handle zombies. So does the "init" (PID 1) process.

But other incorrectly written programs may not. Actually is it fairly common bit of coding to arrange for a program to automatically 'reap' zombie processes when it does not care if/when/how its child processes die. The function is called a 'reaper' and a google will get you the appropriate bit of code to add to the start of the program.

If the parent of the zombie process (the one that is not doing the right thing) dies, its children processes, including the "zombie" will automatically be inherited by the "init" UNIX process. "init" will automatically 'wait' for the zombie, reading (and ignoring) its exit status, and zombie will be 'put to rest'.

Because a program that died will have "init" handle its 'zombie children', programmers often miss adding the 'reaper' code, as they never see zombies for their 'short lived parent programs'. But when a program starts running for very long periods of time, adding some 'reaper' code becomes a must.

Solutions.... Fix the parent program, or kill the parent process.
The former is prefered for long term programs, the latter as a short term (current problem) soltution.

In summery....

The life of processes in the UNIX environment is weird. Parent
processes normally out live their children, and in fact processes who
die become zombies until either their parents recognise they are in
fact dead, or they themselves die. -- Treaty on UNIX Process Handling

And just for a few laughs...

"Here, you're a zombie!"
"That's right, kick a man when he's dead." said Constable Shoe sharply
-- Terry Pratchett, "Jingo"

"I didn't think I was going to survive that...".
"YOU WERE CORRECT", replied Death. -- Terry Pratchett, "Men At Arms"
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply