Finder hang if desktop contains many files #243
Replies: 1 comment
-
I have noticed this even before, I believe even in Monterey but I may be misremembering. However this issue has been around for a while. Any time I open a folder that contains many files, it has to wait as it does whatever strange sorting the newer Mac OSes do while displaying "LOADING..." with the infamous Apple fanblades. If I export a file from FCP or any other app and choose a save location that has many files, I have to wait for several seconds before the list appears. And the number is very small, relatively, like only 300 files in a folder or perhaps even less. I do have a lot of stuff on my desktop, but this occurs when saving to other drives not associated with the desktop, other than that they are mounted and visible on it. I would upgrade to the successor of Ventura if it fixed this if for no other reason. |
Beta Was this translation helpful? Give feedback.
-
Finder on Ventura 13.5.1 (and before) may hang in the main thread if the desktop contains a certain number and composition of files. The files may be in folders, on the desktop, using stacks or not. There is no simple threshold by number or whether they are in folders, however the case I saw involved about 6,500 files, many in folders. Visually the desktop was only about 1/3 full.
It's not simply number of files, as I wrote a utility to rapidly create various types of files, and it didn't happen with 15,000 files on the desktop. There is some yet-unknown combination of file type and layout which causes this. The hang apparently involves the AppKit NSConstraint and NSLayout calls which manage the window-based UI layout and constraint system. That system is supposed to adaptively adjust to different screen sizes, resolution, orientation, window sizes, etc.
This is on a top-spec M1 Ultra Mac Studio with 8TB SSD, 128GB RAM, using only the internal drive. Various user actions would precipitate the hang: plugging or unplugging an external drive, running Disk Utility First Aid on an external drive, toggling view hidden files (SHFT+CMD+.).
Relaunching Finder would temporarily recover, but it was susceptible to happening again. I ran fsck on all drives, rebuilt all Spotlight indexes, turned off Time Machine, turned off Spotlight, and it still happened. I did the usual steps such as clearing icon caches, deleting user .plist files, disabling all launch and background items, disabling any system and Finder extensions, etc.
It did not happen on a new user account, which superficially might indicate an issue with launch items, background processes, etc. That shows the limitation of a troubleshooting approach based on blindly creating a new user account, or erasing the machine and laboriously reloading all files and apps. Without understanding the underlying problem mechanism the issue would likely have reappeared, and all that time and effort to rebuild the system would have been wasted.
I'll file a bug on this when I have time to further isolate it. If you have a Finder hang, take a spindump. If you do a Force Quit or relaunch Finder it may crash. If so save that crash file. In all cases the stack trace of Finder's main thread is consistent and uniquely identifies this problem. See attached Instruments trace of problem entry and spindump of hung Finder.
FinderHangManyFilesOnDesktopSpindump.txt
Beta Was this translation helpful? Give feedback.
All reactions