All Posts by Date or last 15, 30, 90 or 180 days.
also by Lloyd: diglloyd.com photography and WindInMyFace.com
Thank you for purchasing through links and ads on this site.
OWC / MacSales.com...
diglloyd Deal Finder...
Buy other stuff at Amazon.com...
Upgrade the memory of your 2019 iMac up to 128GB
Handpicked deals...
$30 $15
SAVE $15

$2998 $2498
SAVE $500

$1199 $920
SAVE $279

$1999 $1599
SAVE $400

$2799 $2399
SAVE $400

$89 $59
SAVE $30

$400 $280
SAVE $120

$1798 $1598
SAVE $200

$3297 $2797
SAVE $500

$3397 $2797
SAVE $600

$150 $90
SAVE $60

$1398 $898
SAVE $500

$3698 $2998
SAVE $700

$1799 $1329
SAVE $470

$1999 $1199
SAVE $800

$2299 $1599
SAVE $700

$2399 $2049
SAVE $350

$2799 $1899
SAVE $900

$997 $897
SAVE $100

$2099 $1699
SAVE $400

$1999 $1369
SAVE $630

$1349 $949
SAVE $400

$4499 $3999
SAVE $500

$329 $329
SAVE $0

$1499 $1029
SAVE $470

$1499 $1289
SAVE $210

$2199 $1999
SAVE $200

$3399 $2199
SAVE $1200

OS X Bug: QuickLookSatellite Opens Files and Never Closes Them, Causing Wide-Ranging Errors

Update 27 May: Apple Mail has a similar bug.
Update 29 May: example listing and Finder dialog added.

A few days ago, my Mac Pro started acting funny: my testing java web server kept quitting. Other things started misbehaving too, with error messages about not being able to open a file, or ssh failing to open a socket.

The java web server could not get a file or socket to open, so it would quit. I would restart it, and it would die after a few pages had loaded. This was very puzzling, since OS X has an ample limit for file descriptors and sockets.

Here is what is happening: the background process QuickLookSatellite was opening every JPEG file that I created and keeping them all openforever! A newbie programming bug of failing to close a file after opening it. More Apple Core Rot.

With a monotonically increasing number of open files (see this listing for an example after just an hour or so), OS X runs out of file descriptors eventually, and then all sorts of weird things start happening. Servers quit, strange error messages appear, even command line tools like git and ssh abort. And so on. Why QuickLookSatellite does this is unclear—perhaps because they are new files and it is trying to be “smart” and take a peek at them for indexing. But it never closes the files, thus chewing up a file descriptor for every file.

One obvious symptom of the problem is that when these files are put into the trash, the Finder posts an error alert saying it cannot empty the trash because the file is open (an error alert for every file!).

When files are open (“in use”), Trash cannot be emptied

The when or why—what provokes it, is unclear. Newly created files? Using Spotlight in a certain way? Selecting and moving or copying? Simply opening a folder with the new files? Probably most users will not encounter this issue, or so MPG thinks. But there could be many other situations that cause it to happen.

QuickLook is so buggy that it even keeps temporary files and network files open. Temp files are files a program creates and disposes of (or thinks it has). These files are not displayed by the Finder, so you might not realize that 5 or 10 or 200 files are open. No wonder OS X runs out of file descriptors!

QuickLook 18320 lloyd   11r     REG               1,4     534938 23703321 /Users/lloyd/Desktop/crop_tmp1365237595
QuickLook 18320 lloyd 12r REG 1,4 534938 23703321 /Users/lloyd/Desktop/crop_tmp1365237595

Detecting and counting open files

To see all open files, use the lsof command in Terminal (use 'sudo' if you want to see all files, not just ones viewable by your login user). The lsof command will dump a fairly long list of open files, which is normal:

diglloydMP:MPG lloyd$ lsof

To show only the files are open by QuickLookSatellite, but excluding files expected to be open:

diglloydMP:MPG lloyd$ lsof | grep Quick | grep -v -e /System -e /Library -e /private -e /dev -e /usr -e KQUEUE -e cwd

To count the number of files open by QuickLookSatellite, but excluding files expected to be open:

diglloydMP:MPG lloyd$ lsof | grep Quick | grep -v -e /System -e /Library -e /private -e /dev -e /usr -e KQUEUE -e cwd | wc -l
# not as complicated as it looks; the -e arguments are to omit files that are normally open by QuickLookSatellite

In my case, I observed a huge list of JPG files that I recognized as files I had recently created as part of my work. The culprit keeping all those files open: QuickLookSatellite. Knowing this, I found a solution. For example, here is a list of 254 open files (via lsof | grep jpg) that QuickLookSatellite is keeping open after just a single page I was preparing (I do many more each day). It has other jpg files open for who knows what reason; just seemingly random open files.

Closing open files by killing QuickLookSatellite

Two methods.

Using Activity Monitor

To fix this problem without rebooting:

  1. Open Activity Monitor.
  2. Enter "quick" in the search box; this will list just the matching process names.
  3. Kill both QuickLookSatellite processes.

When a process is killed, the OS cleans up the mess (files, memory, sockets, etc). So instantly the absurd number of open files are closed—problem solved. Mysterious problems go away, the Finder can empty the trash, etc. However, if the system does get into this state, MPG recommends quitting and reopening any app that had misbehaved; it could have lingering issues because it did not handle the failure well (very unlikely to ever be tested for).

How to kill QuickLookSatellite in Activity Monitor

In Terminal

Terminal (command line) is easy and the solution can even be made into alias (shortcut) like killQL or similar. Shown below are processes before and after killing QuickLookSatellite:

diglloydMP:DIGLLOYD lloyd$ ps -ef | grep Quick
501 17488     1   0  8:13AM ??         0:00.45 /System/Library/Frameworks/QuickLook.framework/Resources/quicklookd.app/Contents/MacOS/quicklookd
501 18320     1   0  8:24AM ??         0:00.11 /System/Library/Frameworks/QuickLook.framework/Versions/A/Resources/quicklookd.app/Contents/XPCServices/QuickLookSatellite.xpc/Contents/MacOS/QuickLookSatellite
501 21160     1   0  8:58AM ??         0:01.27 /System/Library/Frameworks/QuickLook.framework/Versions/A/Resources/quicklookd.app/Contents/XPCServices/QuickLookSatellite.xpc/Contents/MacOS/QuickLookSatellite
501 24167 39289   0  9:45AM ttys003    0:00.00 grep Quick
diglloydMP:DIGLLOYD lloyd$ killall -9 -v QuickLookSatellite
diglloydMP:DIGLLOYD lloyd$ ps -ef | grep Quick 501 17488 1 0 8:13AM ?? 0:00.45 /System/Library/Frameworks/QuickLook.framework/Resources/quicklookd.app/Contents/MacOS/quicklookd 501 24208 39289 0 9:45AM ttys003 0:00.00 grep Quick

Or, make an alias in ~/.bash_profile file so the alias (shortcut) killQL can be typed in Terminal:

alias killQL="killall -9 -v QuickLookSatellite"

Or, use a short shell script (save as executable file) in your PATH:

#!/bin/sh
# save this as an executable in shell PATH
alias countDubiousQL="lsof | grep Quick | grep -v -e /System -e /Library -e /private -e /dev -e /usr -e KQUEUE -e cwd | wc -l"
alias showDubiousQL="lsof | grep Quick | grep -v -e /System -e /Library -e /private -e /dev -e /usr -e KQUEUE -e cwd"
function QL_DubiousCount() {
DUBIOUS_COUNT=`countDubiousQL`
echo $DUBIOUS_COUNT dubious files $1:
showDubiousQL
}
QL_DubiousCount "BEFORE"
echo ""
killall -9 -v QuickLookSatellite
echo ""
QL_DubiousCount "AFTER"

 

OWC Thunderbolt 3 Dock
Ideal for any Mac with Thunderbolt 3


Dual Thunderbolt 3 ports
USB 3 • USB-C
Gigabit Ethernet
5K and 4K display support plus Mini Display Port
Analog sound in/out and Optical sound out

Works on any Mac with Thunderbolt 3
OWC
USB-C Travel Dock

Fast charging with up to 100W!

HDMI, SD card reader,
USB-C port, 2 USB Type-A ports
Built-in cable self-stores neatly.
See also OWC 14-port Thunderbolt 3 Dock"
OWC Thunderblade Thunderbolt 3 SSD
Gen 2!

Blazing fast, 1TB, 2TB, 4TB, 8TB.

Lloyd’s all-time favorite SSD!

√ No more slow and noisy hard drives!

MacPerformanceGuide.com
View all handpicked deals...

Pelican 3rd-Generation 1910B LED Flashlight (Black)
$30 $15
SAVE $15

diglloyd.com | Terms of Use | PRIVACY POLICY
Contact | About Lloyd Chambers | Consulting | Photo Tours
Mailing Lists | RSS Feeds | Twitter
Copyright © 2019 diglloyd Inc, all rights reserved.
Display info: __RETINA_INFO_STATUS__