Abnormal exit and leaves many temp file.tmp in itunes diectory

After upgrading to itunes 7.7, When I exit Itunes it closes then I get a message from windows (xp sp2) that says itunes has encountered a problem and needs to close. Otherwise itunes works normally. I can see what the problem is. When closing itunes copys a temp file.tmp over to its "Itunes library.xml" file. Normally, it would do this (part of the "saving itunes library" message you see on exit) and then delete the *.tmp file. Instead, the tmp file is copied but the tmp file does NOT get deleted (the error). These then start to build up (temp file 2.tmp, etc.). The actual "itunes library.xml" file does in fact get updated correctly. Something has changed about itunes ability to delete these tmp files on exit. I haven't changed anything else about my machine. Thoughts on this?

Posted on Jul 28, 2008 4:32 AM

Reply
32 replies

Jul 30, 2008 3:41 AM in response to _gn_

Thanks for your serious, systematic approach to debugging this error. I too can duplicate your results on experimenting with removing the itunes library files, etc. All of this evidence, combined with the fact that I have the exact problem on 3 different machines after the 7.7 install, lead me to the conclusion that there is a bug in the recent release. But I wonder why there are not literally 100s of similar posts about this issue if my hypothesis is true. After all there are probably millions of windows itunes users and they can't all be on vista.

Jul 30, 2008 8:50 AM in response to garymc

Thanks. A lot of my career has focused on improving quality in several domains of IT. You develop a mindset to root out and fix obscure problems and accumulate a lot of stories that are no fun to hear at parties. 🙂

Anyway, back to this problem... Unfortunately, there's no way for us to know exactly what iTunes was doing at the time of the crash or what precisely triggered the ABEND. It's something that has changed in iTunes 7.7 and probably has something to do with how the "iTunes Music Library.xml" file is processed. If this file is "clean", it's quite conceivable that very few people will ever experience this crash.

My library is probably not "clean"... It has evolved through several generations of iTunes; I've had power failures while iTunes was running (but I don't think that the file has been corrupted); I have Classical CDs with titles which make use of several different international character sets, etc. Something somewhere in an 8.5MB file with almost 197,000 lines of XML is making iTunes 7.7 choke; something that iTunes 7.6 does not seem to have any problems with.

I tried starting from scratch by uninstalling all of my Apple software, deleted leftover files (configs, updates, etc.) scattered throughout the system, and reinstalled. I then archived my "iTunes Library.itl" and "iTunes Music Library.xml". I now have a clean system and a clean library... did some quick tests... no crashes. I then rebuilt my iTunes library by importing "iTunes Music Library.xml". Everything imported just fine and my content was back. Unfortunately, iTunes started crashing all over again on exit.

That's all I have to offer at this point; just a hypothesis, no conclusions. I also flipped a coin to see which one of us gets to try the iTunes 7.7.1 update first when it comes out... it came out tails, so you get to try it first! 🙂

Jul 30, 2008 9:01 AM in response to _gn_

Yep, we'll have to wait for a (potential) fix. IT/Software is not my profession, but I am an academic who has to generate and test hypotheses in my own research and I have more than typical experience with using windows and its software. A couple of other items for you to ponder:

1. I have the same problem even if I actually start over with itunes and import all my music files from scratch (not simply reimport my library, but the whole enchilada of importing files, creating album art files, determining sound check values and gapless info, etc (for 55,000 files!). At this point I would think my library file is "clean". But same exact problem. One thought though: maybe this is a size issue. Maybe if you have 5,000 files no problem but over a certain size, something chokes. This would explain why 1000s of typical users wouldn't see the problem.

2. Totally unrelated to this, after upgrading to my IPOD classic 160gb, there were certain songs (mp3 that I ripped myself) that would skip foward after 2 seconds. These exact files play fine in itunes itself, on old ipods (5.5 generation), etc. Nothing has ever solved this problem either. When I find these, I simply rerip the album from the original CD and I'm fine. Something makes the IPOD now choke on these particular files. I suspect some stray tag, etc. but examination of all options there led me to a dead end (even looking at files with a hex editor, etc.).

Jul 30, 2008 10:44 AM in response to garymc

Re: 1.
My library profile is quite different from yours; about 5000 songs (all imported from my CD collection; nothing from the iTunes store) and several podcast subscriptions. In total, my content only weighs in at 40MB; quite small by today's standards. The only sources of "pollution" to my XML file, that I am aware of, are: 1) CD track information from Gracenote's CDDB and 2) from (possibly bad) RSS feeds in podcast subscriptions. Hopefully iTunes itself does not contribute and is able to filter out any bad content. If "pollution" is causing the crash, it could explain 1) why relatively few people are experiencing this problem and 2) why the problem comes back after rebuilding the iTunes library.

I'll see if I can find a way to scrub "iTunes Music Library.xml" in order to make it more palatable to iTunes 7.7 but this may require writing some custom code. In any case, there's no excuse for a program like iTunes to fail ungracefully for any reason. It would also be really nice to have a good tool that can verify the integrity of the entire iTunes library and fix any inconsistencies that may arise.

Re: 2.
Sorry, I don't know for sure. Apple changed chipsets in the newer iPods so it's quite possible that they react differently to "errors" in MP3 files (not created by iTunes) than the 5th Generation units or software MP3 players like QuickTime and iTunes.

Jul 30, 2008 12:07 PM in response to Katrina S.

That's interesting... Apple's how-to guides tell you how to rebuild the ITL file from the XML file. I had no idea that iTunes could do the reverse automatically.

BTW, while tracing iTunes during a normal exit, it sure looked like the XML file was updated, closed, and then re-opened to generate a new ITL file from scratch; it's during this procedure that iTunes pops up the "Saving iTunes Library" progress bar.

I'll be very interested to see what happens if I move the XML file to another directory, let iTunes regenerate it from the ITL as you suggested, and then compare the two XML files afterwords.

Thanks very much for the tip!

Jul 30, 2008 12:26 PM in response to _gn_

+Apple's how-to guides tell you how to rebuild the ITL file from the XML file+.

I know, and that procedure loses some metadata such as date added & last played. As I said, the ITL is the important one. It's the proprietary database that iTunes uses. The XML file is just there for other applications to use, such as lastfm.

Yes, keep your XML file safe in another location while you try it. I'm sure iTunes will rebuild it, since I've done it several times.

Jul 30, 2008 1:52 PM in response to Katrina S.

+>> Apple's how-to guides tell you how to rebuild the ITL file from the XML file.+
>>
+> I know, and that procedure loses some metadata such as date added & last played.+

FYI, that may not be entirely true anymore. I had to recreate the ITL file from XML when I downgraded to v7.6. In my case, most of the metadata remained intact. "Date Added" got trashed of course, but "Last Played" and "Play Count" remained intact; so did my podcast subscriptions and play lists. My podcasts all became unsubscribed so I had to re-subscribe and all podcasts got marked as "new." Also, out-of-the-box smart playlists (like 90's Music) got duplicated. Nevertheless, after a bit of clean-up, all was back to normal. The XML to ITL import also ensured that entries for deleted media files were purged and no longer in any playlist.

Anyway... just wanted to confirm your point that iTunes seems to faithfully recreate the XML file from the ITL file.

These are the files before:
30/07/2008 03:03 PM ... 8,983,138 ... iTunes Library.itl
30/07/2008 03:03 PM ... 8,509,680 ... iTunes Music Library.xml

I then deleted "iTunes Music Library.xml" and ran iTunes and exited:
30/07/2008 03:31 PM ... 8,983,138 ... iTunes Library.itl
30/07/2008 03:31 PM ... 8,509,680 ... iTunes Music Library.xml

Looks good! Just to be sure, I re-ran iTunes again and exited:
30/07/2008 03:39 PM ... 8,983,138 ... iTunes Library.itl
30/07/2008 03:39 PM ... 8,509,680 ... iTunes Music Library.xml

Note: these results were obtained using iTunes 7.6. The file sizes remained the same but I still have to analyze the content to see if anything in the XML files changed. The XML file was created when iTunes closed, not when it opened, so the re-creation of the XML file may be "business as usual", just like the re-creation of the ITL file on exit.

I'm still a bit confused because in the trace, it sure looked like iTunes was creating the ITL file from the XML file on close, which doesn't make any sense to me.

Regardless, hopefully garymc can let us know if anything different happens under iTunes 7.7. Based on my (mis?)understanding at this point, I don't think that regenerating the XML file will fix any of the problems we are experiencing... although I would love to be proven wrong on this.

Jul 31, 2008 1:12 AM in response to _gn_

My understanding of the XML file is that it is purely a liaison file created to allow other programs access to the iTunes library. It is constantly updated to reflect the contents of the ITL file, which is what iTunes itself uses as its database.

If you think there is a library problem, you can use the shift key startup to create a test library:
http://support.apple.com/kb/HT1589
This could also be used to investigate content problems - adding back track a bit at a time.

Another source of odd problems are the iTunes preference files. I haven't heard of them doing this, but they can be deleted which creates new preference files with default settings.
This trouble shooting article contains instructions for removing preference files:
http://support.apple.com/kb/TS1421

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Abnormal exit and leaves many temp file.tmp in itunes diectory

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.