Running Ventura 13.0.1 on a Macbook Pro 2019 (Intel)
Occasionally--several times a day, at what seem like random times--MacOS gets into a temporary state in which it seems to get stuck launching new processes. That is, the symptoms are:
- Already running apps & desktop still seem to mostly work; I can interact, move windows around, open menus, etc.
- Entering a command in a shell freezes the shell
- Opening a new tab in a browser freezes the browser
- Trying to open a new app from LaunchBar freezes LaunchBar
- After some amount of time (typically 1-2 minutes), it unfreezes and all the queued up things launch: browser tab loads, shell command runs, etc. And then everything works normally... until the next time.
I.e. it seems to me that when a process tries to launch a child process, the
fork() syscall hangs for a while, and in the meantime the parent process is blocked and so unresponsive. If so, it seems like there could be some sort of resource lock/deadlock in the kernel that needs to time out? Of course I could be way off base on all this, maybe something else is going on.
I haven't noticed any pattern for what triggers this. It only started happening after I updated to Ventura -- post hoc ergo procter hoc? I've tried the obvious coarse hammers: rebooting, resetting PRAM & SMC. I don't see anything in the Console logs.
Any ideas for what might be happening? How to debug it? And of course how to fix it? :)
Update: It just happened again, I could pull down iStat menus while new processes were stuck. More things I found:
- During the stuck time,
kernel_taskbopped up and down between 20% and 92% CPU; after the stuck time,
kernel_taskis back down around 3%.
RTProtectionDaemonwas also bouncing up to 100% and back down, but it does that also when not in the stuck time. No other CPU activity of note.
- Answering @mmmmmm's comment: Memory pressure 10%, Memory 55%. No sign of any process swapping hog.
Update 2. Maybe starting a process actually isn't the (only) problem? It just stuck, I happened to have TextEdit running with now window. I created a new window, wrote some text, and when I tried to save, TextEdit froze too. So maybe the problem does have to do with file access as per @Bruce Van Allen's comment? Or maybe it's just that once the kernel has gotten stuck starting a process, it also then blocked from writing a file?
Update 3. I tried reinstalling Ventura in recovery mode. No difference. Continued evidence that it happens spontaneously rather than in response to something I do: this morning I sat down at the computer after not having touched it all night, tried to open a browser and it immediately wedged for 2 minutes.
Update 4. As per @pion's answer I set up
spindump paused in
lldb (first disabling System Integrity Protection). When I next encountered new processes being stuck, I continued
lldb. Unfortunately that itself seemed stuck too: Nothing seemed to happen for the usual ~2 minutes, and only after that (when other queued up things popped open) did lldb begin to output
Process 1658 resuming
Sampling all processes for 30 seconds with 10 milliseconds of run time between samples
So it seems that whatever's blocking process creation is also blocking process resumption?
Update 5. Dare I say... since updating to Ventura 13.3.1 a little while ago, I haven't experienced this problem. Will give it more time before I'm convinced that the problem has gone away, but so far it's promising!
FINAL UPDATE (6 months later) Ever since the update to Ventura 13.3.1 and beyond (now on 13.5.2) I've not experienced this problem once. I still don't know what went wrong, and whether it was actually related to Ventura 13.3.1+ or some third party thing that got updated around the same time -- but unsatisfying as that is, I consider my problem to have been "solved". There's still some activity on this question, but since I don't know what happened, I can't comment intelligently.