Andy Reitz (blog)

 

 

Update on my iTunes 8 bug

| Comments

So, an update on that iTunes 8 bug that I experienced the other day. The great thing about having access to multiple Macs, is that it affords the ability to run some experiments. Even better, Apple is certain episodes of NBC shows for free, in HD. Put those two things together, and I have been spending some time on and off over the past few days experimenting with HD TV downloads in iTunes. And I think I have a slightly better handle on things - the issue appears to be a bit of a race condition, in how the download manager handles conflicts with files that it downloads.

In my testing, I first tried to download the free episode of "30 Rock", and after it completed, I found that I had both the HD and SD versions of the file (in contrast to my situation at home). Using the Finder to navigate to the folder in my iTunes library, here is what I saw:

HD and SD versions of '30 Rock', in the Finder.
HD and SD versions of "30 Rock", in the Finder.

Clicking around in iTunes in order to attempt to see what is different between my Mac Pro at work and my iMac at home, I decided to try and download "The Office" with the "Simultaneous Downloads" setting disabled:

The 'Allow simultaneous downloads' checkbox in iTunes.
The "Allow simultaneous downloads" checkbox in iTunes.

This setting defaults to being on, but on my home iMac I have it turned off. Sure enough, I found that my HD episode of the office got deleted, leaving only the SD version. Digging deeper, I found that when downloading, iTunes actually writes to a temporary location in the "iTunes Music/Downloads" folder. By the time I noticed that my HD episode was missing, I went and looked in this folder, and this is what I found while iTunes was downloading the SD version:

The iTunes 'Downloads' folder, showing one file downloading at a time.
The iTunes "Downloads" folder, showing one file downloading at a time.

What's interesting, is that it appears as if after completing the HD download, iTunes first checked if there was a file with the same name as the one it was about to download (the SD version), deleted the HD version, and then proceeded to download the SD version in the temporary folder. With simultaneous downloads enabled, it is a bit of a race condition, but it seems like iTunes will check for the presence of the file name for both files at roughly the same time, and each one will be cleared without deleting anything. So, the download folder looks like this:

The iTunes 'Downloads' folder, showing the HD and SD files being downloaded simultaneously.
The iTunes "Downloads" folder, showing the HD and SD files being downloaded simultaneously.

Then, when each download finishes (at separate times), iTunes moves the file from the download folder to the library. The first file to get moved gets the proper name of the file, the second one will have a "1" appended to the end of the file name.

Interestingly, it seems like others are experiencing this issue. Apple needs to do two things to return me to my happy customer status:

  1. Fix this bad bug in iTunes (if I have time, I'll file this as a Radar).
  2. Flip a bit in my account, and allow me to re-download the HD files from Battlestar Galactica, that were lost on Tuesday. I have a ticket open with Apple about this, and am waiting to hear back.

It seems like this bug involves a couple of different areas - how the Mac OS X deals with files that have duplicate names, the iTunes download manager, and the iTunes store team. My guess is that there is separate QA within Apple for all of those areas, but this bug is only tripped under certain conditions that are influenced by all three groups. For example, if the iTunes Store team had given different names to the HD and SD versions of the files, then this bug would never have surfaced. Maybe the iTunes team tested on files that unique names, while the iTunes Store team was busily uploading files with the same name? Due to Apple's opaque-ness, we'll never know.

I just hope that they fix this soon.

Update: Just filed this bug with Apple. Radar #6216525 (about this URL).

-Andy.