14
7
When I run Zotero/Firefox, they often crash and I am left with zombie processes; after this I cannot open new instances of Zotero or Firefox. I want to get rid of these zombie processes rather than rebooting, so for <pid>
of the zombie process,
$ ps -p <pid> -o ppid=
gives me the <parent_pid>
and
ps aux | awk -v PID=<parent_pid> '$2 == PID {print $0}'
tells me the parent process is /sbin/launchd
for user crippledlambda
.
Is there a way to restart this without killing my system?
sudo kill -1 <parent_pid>
does nothing. I've tried writing this in a script and running it with sudo
:
for i in `launchctl list | grep launchd | awk -v PID=<parent_pid> '$1==PID { print $NF }'`; do `launchctl stop $i && launchctl start $i` ; done
and this obviously(?) leaves me with an unresponsive gray screen so I have to reboot anyway. Thanks in advance for your suggestions.
Why are you killing launchd instead of the leftover processes themselves? launchd is a core part of the user session; even if you could restart it, the new instance would not be the parent of all the other processes it's responsible for... things like the Finder, Dock, etc. – Gordon Davisson – 2013-04-21T04:13:15.417
@Gordon, you cannot kill zombie processes so you have to go after the parent, unless I'm missing something. – hatmatrix – 2013-04-23T12:13:33.307
Are they true zombies (i.e. processes that have exited, but whose exit status has not been read)? If they are, something much deeper is wrong, since
– Gordon Davisson – 2013-04-23T15:55:25.857launchd
should always read its children's exit statuses immediately. If they aren't truly zombies, then you should be killing them. In either case, killinglaunchd
is going to cause more problems than it solves.