Ich habe eine Anwendung in Go, die die STDIN und STDOUT von Binärdateien umleitet und sie dann ausführt. In aller Kürze tue mir:Golang: Kinderprozesse werden zu Zombies
- create command object with the binary path (lets call the object command A) - create command object with the binary path (calling it command B) - set the stdout of command B to the stdin of Command A - start command A - start command B
ich bemerkte, wenn der Prozess für den Befehl B Ausfahrten während Befehl A ausgeführt wird, es einen Zombie-Prozess in der Prozesstabelle wird.
Hier ist ein Beispiel:
commandA := exec.Command("samplebin")
commandB := exec.Command("sample2bin")
cmdAStdin := commandA.StdinPipe()
commandB.Stdout = cmdAStdin
commandA.Start()
commandB.Start()
Warum commandB ein Zombie werden, wenn es austritt, während Commanda noch läuft? Ich laufe Go 1.5 auf Ubuntu 14.
SIGCHLD wird also von den Kind-Prozessen gesendet, bevor sie Zombies werden? Wie kann man SIGCHLD dann "ignorieren"? Indem Sie das Signal fangen und nichts tun? – AJPennster
SIGCHLD wird vom Kernel gesendet, wenn ein Kind ein Zombie macht. Wenn du SIGCHLD ignorieren willst und immer noch Zombies bekommst, setze die SIGCHLD-Aktion auf SIG_DFL (den Standard) und nicht auf SIG_IGN - die Standardaktion ist, nichts zu tun, aber Zombies zu bekommen. –
Ich möchte die Zombies nicht, ich möchte, dass die ausgetretenen Prozesse aufgeräumt werden. Ich habe versucht, Signale in der Hauptanwendung einzurichten, um SIGCHLD zu ignorieren, und das machte immer noch Zombies, so dass ich am Ende Wait() anrufe. – AJPennster