Mac frequently crashes due to excessive use of mds resources.


Recently, macOS will automatically crash soon after it is used, and then shut down. Finally, it is found that the mds process caused the system to crash.

OS: macOS Catalina 10.15.7 (19H2)
Model:MacBook Pro (Retina, 15-inch, Mid 2014)
CPU:2.2 GHz Intel Core i7

Shortly after turning on, the fan rotates wildly, the temperature rises, and then it crashes and shuts down.

1. Use Apple Diagnostics to test Mac.

First see if there is a problem at the hardware level.

Use Apple Diagnostics to test Mac.

The Mac processor is Intel. Turn on Mac, and press and hold the D key on the keyboard immediately when Mac starts.

No hardware problems were found in the Mac after detection.

Then, see if there is a problem at the system level.

Find the console in the launchpad, and you can see that system.log, has found that some processes have been KILL on the left side of the console.

Com.apple.xpc.launchd [1] (com.apple.mdworker.shared.01000000-0300-0000-0000-000000000000 [5605]): Service exited due to SIGKILL | sent by mds [151l].

3. View system resource usage.

Check the activity monitor and find that mds and mds_ stores occupy a high utilization rate of CPU. If you check the data, you can see that this is focused (spotlight) creating an index, which makes it easy to quickly search for files, configuration and other information.

Do not know whether the current operating system version of the bug,CPU utilization is too high, causing the system to crash.

From this point of view, it is estimated that the focus takes up a lot of resources when creating the index, causing the system to crash.

In order to solve this problem temporarily, it is necessary to stop the process, make a trade-off, give up the focus function, and ensure that the system works. As for what version has fixed this bug, we'll see later.

4. disable mds

$ sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
Password:
/System/Library/LaunchDaemons/com.apple.metadata.mds.plist: Operation now in progress

if there is an error in (Operation not permitted while System Integrity Protection is engaged), please disable the system integrity protection (SIP) of Mac OS X.

After rebooting the operating system, the probability of the system crashing is greatly reduced, which used to be several times a day, but now it can be encountered occasionally in a few weeks.

reference