Adobe Lightroom fails to import photos (or the case of 65k temp files)

So I recently had to fix a problem for one of my family (hey Mum!), whereby Lightroom (4.6 at the time) was failing to import photos from any of her digital cameras through Lightroom.

Problem

Lightroom would open the import window and just seemingly freeze (100% of one CPU core in use). Copying the photos from the memory card to a folder and then importing from there worked a treat, but obviously not an ideal workaround if you’re importing many times a day (as she was).

Not being an expert with Lightroom, I wasn’t sure what to suggest. However she has an Adobe Creative Cloud subscription which includes Lightroom 5 – sweet, let’s upgrade to that.

A couple of hours later after Lightroom had downloaded, installed and upgraded the LR4 catalog (about 25,000 photos…) we were ready to try again. I plugged in the camera and… same problem. The progress indicator icon in the lower left would spin a few times and then just freeze when on the import window.

I left it going whilst I Binged Googled the problem to see if anyone else had encountered it – many people had, but the forum posts were either unanswered, or the ‘resolution’ was to buy a card reader.

As I was waiting, Lightroom unfroze and came up with the normal import screen, but with ‘Unable to create previews’.

I thought back to Mark Russinovich’s ‘case of the unexplained’ where he states: “When in doubt, run process monitor”, so that’s what I did!

Downloading and running procmon.exe yielded some interesting results. Unfortunately I forgot to take a screenshot at the time, but in essence there were thousands and thousands of ‘NAME COLLISION’ lines from lightroom.exe trying to read (random) files from the temporary folder.

I opened the %temp% folder saw over 95,000 temporary files, most of which were ‘4hex-digits.tmp’ – these were the files Lightroom was attempting to create, and causing the name collisions.

Thousands of files!

I closed everything that was open, and deleted everything from the %temp% folder. Restarting Lightroom and attempting to import again – bam, instant load, with previews – case solved!

It seems (even in the latest update for Adobe Lightroom CC) there is a bug where opening the import from device window creates one of these tmp files for every photo on the card and doesn’t remove them – ever. This becomes an issue when you’re importing hundreds of files a day!

The files I saw were always 4 characters long, 0-9 A-F and ended in .tmp, a quick calculation 16^4 gives us a limit of around 65,000 filenames!

Solution

Here’s a quick PowerShell script to delete them:

cd $env:temp

remove-item ????.tmp -force –recurse

To run this, make sure Lightroom is closed, click Start and type powershell.exe. You’ll get a blue window appear. Type each line separately and press ENTER afterwards. Restart Lightroom.

You can also download something like CCLeaner from Piriform and instruct it to delete all of the temporary files in the user folder.

Adobe, if you read this – please clean up your temporary files on exit!

2 Comments

Leave a Reply to hdic Cancel reply

Your email address will not be published. Required fields are marked *