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 28, 2008 5:39 AM in response to garymc

A few things to think of.

Temp file creation has been associated with lastfm and iscrobbler if that means anything to you.

Also delays caused by virus checking especially NOD32. Try briefly disabling virus checking. If that stops more temp files being created, you can exclude iTunes Library.itl and iTune Music Library.xml from virus checking.

There is also a strange permission issue if you are using vista. If iTunes does not have delete rights in the iTunes folder, it can't delete temp files.
As a test you could try turning off UAC, don't leave it off though.

Jul 29, 2008 3:36 AM in response to garymc

Thanks for the info. I'm using XP and I know about last.fm and scrobbler, etc. but I'm not using either. Also tried to disable my McAfee and that wasn't the issue. I actually had the same problem on 3 different windows XP machines. My problem is also described by others here:
http://discussions.apple.com/thread.jspa?threadID=1621476&tstart=0

I've solved the problem on 2 of my computers by simply uninstalling and reinstalling quicktime (the separate quicktime, not the install ".exe" with both itunes and quicktime. My error had something to do with a failure of the module "quicktime.qts". Again, see link above for more info.

Jul 29, 2008 4:36 AM in response to garymc

Thanks for the feedback. It's the first I have heard of Quicktime being related to this issue.

Presumably in general terms, something or other locks the temp files up so they can't be deleted.

I noticed that in the thread you quoted someone had been using procmon to investigate this which seems like a good move if you can understand the output. Personally i tend to stick with Filemon.exe for investigating file activity as it is simpler.

Jul 29, 2008 10:26 AM in response to garymc

turns out that my quicktime reinstall has not actually fixed the problem. On all 3 computers it initially fixed the problem, works ok going in and out of itunes, then after a reboot or two, I'm back to the same problem. Error signature is always:

AppName: itunes.exe AppVer: ;7.7.0.43 ModName: quicktime.qts
ModVer 7.50.61.0 Offset: 0015e693

Jul 29, 2008 12:10 PM in response to garymc

Ah, so you are getting an error message and it is quite common to get temp files left behind after a crash.

When you reinstalled Quicktime, did you delete the the Quicktime files from your system 32 folder as in this article on removal of Quicktime?
http://support.apple.com/kb/HT1925
It can be important when you have quicktime problems.

The other thing is what happens when you run Quicktime? Does it behave normally?

Another thing is that certain codec packs can cause trouble with Quicktime although usually it will not run at all.
Here is a list of the troublesome ones I know of:
ACE & K-Lite mega codecs package, QT alternative, Storm codec, WinAVI video converter

Jul 29, 2008 1:36 PM in response to Katrina S.

Thanks for the help in diagnosing this. I don't have any of the codec programs you mention. To be clear as possible:
1. Same exit error happens on all three of my Windows XP machines (dell d620, dell d800, dell desktop). The d800 is SP2 and the d620 and desktop are SP3.
1a. NOTE: I have NO problems with actually running itunes, playing songs, synching to my 160gb ipod classic, playing videos, opening and running quicktime, etc.
1b. I am running all machines as an administrator with all rights. One is on a network at the office, the laptops are simply on my home cable modem connection (not connected to a network).
2. I had no problems with itunes on any of 3 computers with itunes 7.6. I've changed nothing else on any of the three other than updating itunes to 7.7 and the removal and addition of quicktime (that I did after problem started).
3. I don't have any of the codec programs some have mentioned as possible problems (ACE & K-Lite mega codecs package, QT alternative, Storm codec, WinAVI video converter). I use itunes, foobar2000, VLC, and occasionally realplayer. The problem seems to come back without regard to whether I open and/or use VLC or realplayer or foobar2000.
4. I use mcafee virus scanner. It is up to date and doesn't seem to matter whether I turn it off, set it to exclude any files in itunes library, or leave it on. Error happens under all conditions of macafee.

I haven't followed the full instructions noted above on removal of quicktime. I will try this next. But note that someone else asked if I noticed that if I was getting exit errors, then next time I played a video in itunes then exited did I get an error? I tried this and the answer is NO. Turns out that if I play a video before exiting itunes, it exits normally. VERY INTERESTING....

As mentioned, the reinstall quicktimes approach doesn't seem to be a permanent solution. It works fine for a while then all of a sudden I get abnormal exit with the exact same reasoning. Does NOT seem to be related to whether I've rebooted between tries. I may go a day turning off and on, rebooting a couple of times, and all is fine. Then all of a sudden, I exit itunes with the same abnormal exit. I think the tmp files left behind are simply a symptom. The program is crashing before it allows itself to clean up the remaining tmp files it created. Only other files I may be using during this time is internet explorer, firefox 3.0, thunderbird (email), and Word and powerpoint perhaps.

Jul 29, 2008 1:42 PM in response to garymc

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

Actually, iTunes writes a temp file after almost every action in iTunes, such as skipping a song, changing a rating, adding comments, finishing a song, etc.
The temp file should be deleted as soon as it updates the library and .xml files so you may never even see it.

Jul 29, 2008 7:04 PM in response to garymc

After messing around with this for several hours, and only using firefox browser other than itunes, I find itunes drifting back into abnormal exit with same error every now and then. I'm not using any other program that accesses video or audio during this time. The interesting thing is that I can always fix it by simply playing a few seconds of a video in itunes. Then itunes always exits properly. Has to be something grabbing a hold of some file and when itunes plays a video, it gives control back to itunes and all becomes ok. Of course the question is what is that thing grabbing ahold of a file (and which file). Comments welcome....

Jul 29, 2008 10:00 PM in response to garymc

Hi. As garymc mentioned earlier, we're discussing the same problem in another thread but I thought I'd add my $0.02 here as well.

The crash appears to be related to the processing of iTunes Library files and there may be bugs in both the iTunes initialization code (where the xml and itl files are processed during startup) as well as in the exit code that ultimately causes the crash. The problem may be as simple as an uninitialized pointer or data structure that gets fixed after playing video.

I tried tracing iTunes with Procmon (a tool from Sysinternals (now Microsoft)) during the program's exit (and subsequent crash) to see what was going on. I didn't see any evidence that my antivirus (Norton 2008) software or any other program were interfering with iTunes or QuickTime. It also doesn't seem to be caused by contention for any hardware, files, or any other resources. The crash occurred when iTunes 7.7 recreated "iTunes Library.itl" on exit and seems fault at EXACTLY the same point for everyone that has reported this problem. I don't have to tools to diagnose this any further; it's really now up to the Apple developers to take it from here...

Here's another experiment to support my hypothesis:

If you're experiencing crashes on exit, it does not take any effort to get iTunes to fail. Just start iTunes, close the program, and voila: CRASH.

Now try this out:
1) Make sure iTunes is not running. Move "iTunes Library.itl" and "iTunes Music Library.xml" from \My Documents\My Music\iTunes to some other directory.
2) Restart iTunes and don't import anything. You'll have an empty iTunes library. Close iTunes... no error.
3) Start iTunes again and then close the program... no error. Do it over and over... no error.
4) Restore the files you archived in step 1); You're now back to where you started.
5) Start iTunes and then exit... BAM!

I'm now back to using iTunes 7.6 and never got around to building a small iTunes library with just enough in it to tickle this bug. It may only take a single video file or may require a video podcast subscription. Any takers?

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.