Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: iTunes crashing issue - solution (Read 9741 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

iTunes crashing issue - solution

Edit: Apple has fixed this bug in the latest versions of iTunes. Download the latest iTunes to solve the problem.

--------
One of the problems I hear a lot about is iTunes crashing while saying "Determining Song Volume". This is usually fixed by disabling SoundCheck, so that it doesn't scan song volume. I never had a problem until I built myself a new computer, and discovered that it crashed very consistently when I added lots of new songs to the iTunes library.

After much hardware testing, I eventually couldn't figure it out and gave up on it, just disabling SoundCheck.

Later, I installed FarCry on my new machine and discovered that it had weird issues where it seemed to go too fast, with jerky movement. Research into this turned up that the game didn't work well on multi-processor or DualCore machines, and forcing the CPU affinity to use only one core fixed the issue.

Since I hadn't heard of that sort of issue before, I looked into its background a bit, and eventually realized that iTunes might not be totally thread-safe in some parts of the scanning process. So I forced the affinity and tried it again. It worked, no crashing problem.

So, this may not fix it for everybody, but if you have a Dual-Core processor, it's worth a try.

iTunes' SoundCheck scanning process (aka determining song volume) is not fully thread-safe. When it's trying to scan several songs, it launches each one in a separate thread. On a dual-core or dual-processor machine, this means that the scans happen simultaneously. My guess is that the decoding/scanning is perfectly fine, but the bit where it's writing the updated information into iTunes database is not. And so it eventually hits a case where both threads try to write at the same instant and bam, crash. Probably because a lack of using a correct mutex lock on the database routines or something (still, it's pure speculation on my part).

Anyway, if you're experiencing this problem, and have dual-cores, try this:
1. Start iTunes. If it starts scanning immediately, hit the X icon to the right of where it says "determining song volume" to make it stop and not crash.
2. Go to preferences and turn off SoundCheck. Also turn off "Use soundcheck when burning CDs" or something like that.
3. Open the Task Manager (CTRL-SHIFT-ESC). Click the Processes Tab.
4. Right click on the iTunes.exe process, and select "Set Affinity..."
5. You should have checkmarks beside CPU0 and CPU1. Turn off the CPU1 checkmark.
6. Back in iTunes, turn on SoundCheck again. It'll start determining song volume, and this time, it should not crash.

If this works for you, then you can make it semi-permanent with this little program: http://www.activeplus.com/us/freeware/runfirst/

It's called RunFirst.exe and what you do is to put a copy of it in the iTunes directory. Then change the shortcut you use to start iTunes to have the full path to runfirst.exe followed by the normal path to iTunes.exe. SO change the shortcut's properties to look like this:
"C:\Program Files\iTunes\RunFirst.exe" "C:\Program Files\iTunes\iTunes.exe"

This makes the shortcut launch RunFirst, which launches iTunes with the CPU Affinity forced to one core only.

That should fix it for a lot of people. It worked for me. Apple can fix this in future revisions of iTunes, if somebody tells them about it.

iTunes crashing issue - solution

Reply #1
Good catch..

One remark: even with a non-SMT CPU, such "thread-buggy" programs won't be 100% stable, because threads still work the same (ie: races can happen too). However it's much less likely since "software" time slices are >1000000 times bigger...

iTunes crashing issue - solution

Reply #2
Rather off-topic, but...

Quote
Later, I installed FarCry on my new machine...
[a href="index.php?act=findpost&pid=325398"][{POST_SNAPBACK}][/a]


That's an awesome game. Really hard to complete though. I enjoyed it immensely and it just kept on going, and going and going.... Never thought I would reach the end. 

iTunes crashing issue - solution

Reply #3
Thanks a lot for the Fix!  I'm amazed at how smoothly iTunes works now.  The explanation was great and I learned a lot after researching how to actually make a shortcut....undo the zip file etc.  The program would crash and would say,"iTunes has encountered a problem and needs to close....." only every so often while I was ripping a cd.  Even minimizing would confuse the program.  Now the program is running great...RunFirst.exe is the ticket.

iTunes crashing issue - solution

Reply #4
I found a better solution to this particular problem. The problem with RunFirst.exe is that it leaves a blank window up when it runs, which is kind of annoying.

So get this program instead: http://www.robpol86.com/Files/imagecfg.exe

Info about it can be found here: http://www.robpol86.com/Pages/imagecfg.php

The general gist of it is that it can change an executable to be forced to run on one processor only. All you do is to run "imagecfg -u iTunes.exe" at the command prompt. It modifies iTunes.exe to only run on the one processor. Same effect, no extra program or window. Seems to work fine for me.