I am starting to accumulate too many processes on my Mac. No clue why this is happening, but it is causing a lot of problems such as:
programs fail to start or hang on launch
in the terminal I get a lot of messages such as "unable to fork", for example I got this error in iTerm2: https://gitlab.com/gnachman/iterm2/issues/5027
also get some errors saying "too many files open" but I dont know what files these could be, I do not have any more programs running than usual and don't have much open myself.
cannot open any new terminal windows, and any current terminal windows cannot use pipes
at the lock screen, I try to enter my password but the entire UI becomes unresponsive; I type the password and hit 'Enter' but nothing happens for several minutes, I can click on buttons but they do not do anything
This just happened again, and I checked ps -aef
and had 1,000+ proccesses. However most of them were anonymous and looked like this:
Most of these anonymous processes are labelled things like (pmset)
and (networksetup)
; no clue what that means, Google did not reveal anything useful.
Also while trying to run ps -aef | grep '(' | wc -l
the entire terminal window crashed; when I brought up a new one and ran it again it returned 753, meaning there were about 753 of these anonymous processes running.
Rebooting solves the problem but only temporarily, eventually it creeps back up. Randomly it goes away on its own. Right now the number of total processes (ps -aef | wc -l
) is back down to 350.
Total memory and CPU usage during all this is very low, so they do not seem to be culprits.
Any idea what is going on? How am I accumulating all these processes in the first place?
For reference, I am running macOS 10.12.6 High Sierra on an iMac.
Update:
Another clue, I managed to catch this happening before my terminal completely locked up, and I can actually see from the ps output (ps -aef | less
) that these processes seem to start spawning about ~30min after I arrived at work this morning, immediately following the start of a process called PwrMgrDaemon
. It then proceeded to spawn 2 new threads per minute for the entire day. I caught it around 3:50pm when I started getting errors and again there were a total of 1056 processes running, including a massive amount of these pmset
processes. Strangely, while I was taking screenshots and typing up this update, all of these processes vanished and things went back to normal.
Some of the errors I caught in my terminal that indicated this was occurring again:
fork: Resource temporarily unavailable
Interrupted system call