6

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_task bopped up and down between 20% and 92% CPU; after the stuck time, kernel_task is back down around 3%. RTProtectionDaemon was 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 spindump via c in 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
[etc.]

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.

17
  • Is any process swapping - what is the memory pressure etc.
    – mmmmmm
    Commented Dec 16, 2022 at 0:30
  • Can you reproduce this if you disable your network connections? (Turn OFF Wi-Fi, etc.)
    – Ezekiel
    Commented Dec 16, 2022 at 14:18
  • @Ezekiel I don't know how to reproduce it, it just happens occasionally on its own while I'm using the computer normally. I can try turning off WiFi next time it happens and see if it cures it immediately? Do you have a theory as to how/why networking would cause this?
    – ronen
    Commented Dec 16, 2022 at 16:49
  • Yes, I would try that. I believe these issues are supposed to have been resolved, but in the past poor network conditions (especially when the device thinks it's connected, but there's actually a problem) led to process launching timing out. This was related to attempting a virus check on the process at launch time.
    – Ezekiel
    Commented Dec 16, 2022 at 17:11
  • The pattern I've seen is a pause when an app I'm using needs to access a file, and it hasn't done that for a while. E.g., in BBEdit, when I go to open a file, if BBEdit hasn't opened any file for a while, it gets that pause. Opening another file soon after, no pause. At first I thought this was a BBEdit bug. But it's become clear to me that it happens with many apps, even those that open their own private files in the background when they start up, without me even asking to open any file. For me, Mac Mini 2018, this started in either the last version of Big Sur or when I switched to Monterey. Commented Dec 16, 2022 at 18:38

5 Answers 5

1

As you're discovering, troubleshooting is a process of elimination and often requires a lot of patience.

I suggest your next step should be to boot into Safe Mode:

  1. Fully shut down your MacBook Pro
  2. Restart your MacBook Pro
  3. Immediately press the Shift key and keep it down
  4. Let go of the Shift key when you see the login window (NOTE: If you have FileVault enabled you may need to log in twice).
  5. Once in Safe Mode, use your MacBook Pro as normal for long enough to either see the behaviour continue, or to know it has stopped
  6. Exit Safe Mode by restarting your MacBook Pro as normal

If your Mac:

  • still gets stuck even during Safe Mode, this means we have to consider other options such as a hardware issue (proceed to 1. Run Apple Diagnostics below), or problems with your disk's integrity (proceed to 2. Use First Aid below)
  • works normally while in Safe Mode, this means we have narrowed down the problem to software that's loading when your MacBook Pro boots up. If so, it's time to investigate login items, fonts, and kernel extensions - proceed to 3. Investigating login items, fonts, and kernel extensions below.

1. Run Apple Diagnostics

  1. Fully shut down your MacBook Pro
  2. Restart your MacBook Pro
  3. Immediately press the D key and keep it down until you see a progress bar or you're asked to choose a language.
  4. Follow the prompts and wait for Diagnostics to finish (this typically only takes a few minutes)
  5. Once complete, one of two things will appear on the screen:
    • a No issues found message
    • a brief description of any errors found plus further instructions
  6. If the diagnostics test does find errors, take a note of what they are

2. Use First Aid

  1. Open Disk Utility (by default, this is located within the Utilities folder which itself is located within the Applications folder)
  2. Select your startup disk from the lefthand sidebar
  3. Below it you will see any containers and volumes associated with that disk
  4. Begin by selecting the last volume for your startup disk and then click the First Aid icon from the horizontal toolbar
  5. When prompted, click on Run
  6. At completion, move up the sidebar list to the next container or volume and run First Aid again
  7. Repeat Step 6 until you have run First Aid on all containers and volumes associated with that disk, and also the disk itself

For more info, you can refer to How to repair a Mac disk with Disk Utility.


3. Investigating login items, fonts, and kernel extensions

Let's start with Login Items:

  1. Startup normally
  2. Go to System Settings > Users & Groups
  3. Select the General icon
  4. Click on Login Items
  5. Now remove all of "Open at Login" items by highlighting them and clicking on the - button below
  6. Restart your computer

Now your MacBook Pro will boot up without those login items loading. Test this and see if the problem persists:

  • If the problem goes away you know one (or more) of the Login items were causing the problem. You can then add them back in one by one until you've identified the culprit. Problem solved.
  • If the problem does persist, it's either a problem with fonts you've installed yourself or with a 3rd party kernel extension. A little more info below:

Fonts:- You can remove any of the fonts you've installed yourself to see if this makes a difference.

Kernel Extensions:- You can open Terminal (found within your Utilites folder) and enter the following command:

kextstat | grep -v com.apple

The above command will list 3rd party kernel extensions (you may need to stretch the Terminal window so it's easier to read). Look for anything you don't remember installing, or something that belongs to software you've removed, or just anything that looks out of place. Remember though, this is a list of 3rd party kernel extensions and therefore any of them could be causing the problem.

2
  • Thanks for the suggestion. The difficulty with this approach is that the problem occurs at random times, so it'd hard at each stage to know how long to wait to be sure the problem has really stopped.
    – ronen
    Commented Jan 3, 2023 at 11:52
  • Yes, but you should be able to use Safe Mode happily in the meantime. If you need to do something you can't do in Safe Mode, then you can just reboot and do what you need before rebooting back into Safe Mode again. I recently troubleshooted a 2017 iMac which was rebooting at random intervals, and we didn't get to the bottom of the problem until they ran their Mac in Safe Mode for 2 weeks without a problem, thus being sure the issue didn't occur in Safe Mode. In any case, I see pion has offered an approach you're comfortable with, so let's see how that goes and hopefully a solution is found. :)
    – Monomeeth
    Commented Jan 3, 2023 at 20:30
1

I have the same exact problem. I have cleared around 20 GB of storage and now my laptop runs faster and this seems to have solved the issue. How much space do you have left?

I also cleared some cache in ~/Library/Caches/

2
  • I haven't had this issue after 2 days of cleaning disk space Commented Apr 14, 2023 at 14:01
  • Thanks, but that's not my issue, I have plenty of storage space -- nearly 1TB available on a 2TB drive.
    – ronen
    Commented Apr 15, 2023 at 12:36
0

A pause during process spawn suggests that a critical thread is blocked on a resource. We can take a direct approach to see what gets blocked. One way to do this is by enabling kernel symbolication and running spindump during a stall. However, a complication arises because spindump is, itself, a new command, and will not be able to run during the stall period. So we have to be a little clever. One workaround is to launch spindump from within lldb and pause it at the program entry point, then resume once the stall occurs.

Here is the full procedure:

  1. Make sure that the Xcode developer tools are installed and that you've also run the developer command-line tools installer. (Run lldb in Terminal to confirm.)

  2. Run the following Terminal command to enable kernel symbolication:

     sudo nvram boot-args="keepsyms=1"
    

    Make sure to copy-paste this so that you're entering straight quotes rather than curly/“smart” quotes. (If you get a general error, you will first need to disable System Integrity Protection. You can re-enable it after you're done with this investigation.)

  3. Reboot your machine in order for the symbolication boot-arg to take effect.

  4. In Terminal, run: sudo lldb spindump -- -noTarget 30 10 -reveal -noProcessingWhileSampling

  5. After entering your admin password and giving a moment for dynamic library loading, you'll be at the (lldb) prompt. Enter the following: process launch -s

  6. spindump is now launched but halted. Continue using your machine as normal. As soon as you begin to feel a stall, go to the Terminal window where you have your (lldb) prompt and run the c command (that is, press the c key followed by Return) so that spindump resumes execution. Do not do anything else on the computer while it's running, otherwise you will distort the data collection.

  7. After waiting for >30 seconds to collect a sample and another minute or two to symbolicate and format, you’ll get a file in /tmp/spindump.txt that contains a stackshot of every process.

  8. Upload the file to PasteBin or some equivalent place and add the link to it to your original question. We can take a look at it and come up with next steps for the investigation.

2
  • Thanks, this just what I'm looking for! I'll start running through these steps.
    – ronen
    Commented Jan 3, 2023 at 11:56
  • pion, as per "Update 4" above, this approach seems to have run aground :( Any further thoughts?
    – ronen
    Commented Jan 5, 2023 at 1:31
0

For several years now, my primary system (MBP 2015 running latest available) has bogged down at random times. It's also happening on a 2019 iMac from time to time.

After lots of hair pulling and general "what the hell is going on here?" questions, I looked at Activity Monitor and saw that remindd was really going nuts. So, I force quit. System was back to normal. I don't know why that daemon is out of whack, but it is. Sometimes I have to quit the daemon a few times a day.

I've tried to figure out why. Maybe it's because I have 600+ items in my reminders app?

1
  • Thanks, but this isn't a case of bogging down, this is a matter of everything working normally except new processes can't start at all for a few minutes. As per "Update 1" above, CPU activity is normal except for kernel_task being unusually active.
    – ronen
    Commented Jan 5, 2023 at 1:33
0

I have the exact same issue. Updating to Ventura did not fix the problem but in the process of elimination I narrowed down the issue to possibly be with iStat Menus. I have uninstalled it a week ago and keeping my fingers crossed that it doesn't happen again. The freeze state occurs to me once in 7-10 days so I can't confidently say it's resolved, still under observation period.

I see you (OP) also mention use of iStat Menu. Would be very helpful to.know if others commenting on this thread who had the same issue are also using iStat Menus

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .