My Mail.app is unstable
By bblfish on Jun 18, 2008
Mail.app is getting to be a real pain to work with. This is the 4th time in 2 months that I have to spend over 4 hours debugging it. As of writing this I can longer send or receive mail!
It used to just crash, which was useful because I could use dtrace to find all the files it had opened and just remove the directories in Library/Mail where it had last looked at. I could then re-import those folders later.
Since the 10.5.3 update it no longer crashes. A week ago it just either spent a huge amount of time thinking, using up over 100% of the cpu (there are two cores so it can use up to %200), and then finally recovered, but I had time to study a few chapters of "Semantic Web for the Working Ontologist before that happened. Today it just consumed so much cpu that all other applications became irresponsive. I reniced Mail with
$ sudo renice -20 -p 16410 #where 16410 was the process id of Mail.app at the timewhich made it possible to use my shell at least. Then it crashed.
I am clearly not the only one with this problem. Searching the web I found that
- Tim Bray twittered about a problem he had, though on asking him, it had a different solution, relating to removing ical entries.
- A long thread on the Apple support forum entitled "Mail Hangs". I am pretty sure none of the suggested solutions did anything for me. I spent last Saturday cleaning up my OS with OnyX (got it from somewhere else though)
- Another thread on the apple discussion forum entitled "Mail.app not restoring properly - keeps asking to import mailboxes, crashes".
- Search for "crashing mail.app" on Google limited to the last week or month, to get a feel for this.
Mail.app is really a key application of OSX. If Apple can't get this right, or don't have enough resources to dedicate to this, would it perhaps help to Open Source Mail.app? At least some of us could hunt down the problem and give them a fix. Currently I am not sure what they are doing about this. I will try once more to fix it, but I am really really close to switching to something else...
2 hours later - Solved: I had a mail folder for an internal Sun apple mailing list. I had suspected that there was a problem here as it would crash when I opened that folder. So I went to
/Users/hjs/Library/Mail/IMAP-hsXXXXX@mail.sun.net and moved the apple.imapbox to a temporary folder. I then started Mail and it fetched all the threads from the server again. Having the mail on a remote server helps a lot. For one it should make moving to another client a lot easier...
Could it be that I have too many e-mails? The following seems to suggest that I have 273 thousand.
hjs@bblfish:0$ cd Library/Mail
hjs@bblfish:0$ find . -name "\*.emlx" | wc
273761 322242 17719867
It is 27 August now, and I have not had any serious crashes anymore. It could be that the last time I really cleaned up those broken folders. It could be luck...