Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mbert

macrumors member
Original poster
Dec 18, 2016
51
51
I have had this for a while now. When I start Mail.app, e.g. after having rebooted, it takes several minutes to show the window. During that time even SpamSieve tells me it has been deactivated (which it hasn't, it simply seems to have run into a timeout).

Rebuilding the mailbox hasn't helped. Anyone got an idea how I can track this down?

I am running Catalina (latest version) on an MBP.
 
Try creating a new user account, logout go your user account and login to the new user account. Setup your e-mail accounts in the new user account. See if the same issue happens with launch mail app in the new user account.
 
I am actually using it for 4 user accounts. Is there no way to trace what keeps it busy for so long?
 
Does it still have the built-in menu item for Connection Doctor To see what the hold up is?
It has, but I cannot use it at startup, because I've got a spinning wheel until the main window opens.
 
Go to Activity Viewer, select the line with Mail. Show the dropdown menu with the gear icon. Select "Analyse process". Wait a couple of seconds until the analysis is finished. The result usually is a larger text file. Upload it somewhere and post the link.
 
I'm not familiar with SpamSieve, but I'd start diagnosing the issue by turning off any 3rd party plug-ins you have running- like spamsieve - then relaunching mail.
 
I'm not familiar with SpamSieve, but I'd start diagnosing the issue by turning off any 3rd party plug-ins you have running- like spamsieve - then relaunching mail.
Tried that, no difference.
 
Hi,

I have been having on-going problems with Mail. But my problem went from long start up to not starting at all. Each time it happened (about 6 or 8 times in the past several months) I saw this scenario:

1. Mail would take a long time to start.
2. Mail would eventually appear.
3. Performance (even responsiveness to clicking messages) was incredibly slow.
4. Mail was using inordinately large amounts of CPU time, around 98% - 150%.
5. Exiting and restarting Mail did not help.
6. Ultimately, Mail would not start. I would only see a core dump window to send spin dump data to Apple.

To fix, I had to go into several directories such as the ones below to manually delete files
~/Library
~/Library/Application Support
/System/Library/

I found this web page and followed the instructions:

This might not be your problem. But I did notice the behavior you described each time prior to Mail just crashing upon start up.

Hope this helps.
 
  • Like
Reactions: mbert
Hope this helps.
It did help, thank you very much! After moving away the files mentioned in the guide it came up quickly and just fine, re-imported messages, I had to restore some minor settings, re-activate SpamSieve, and things are fine. Great!
 
Great...! That's good news.

By the way, I have reported this to Apple many, many times. I suspect there is some race condition (some concurrency bug) in the software. I noticed that sometimes, a mail message appears in the message header pane but the message has not completed loading from the server (I suspect but cannot verify).

If you try to delete the message too quickly or move it to another folder ("mailbox" in Apple's obtuse terminology) it might be causing this problem. I suspect that Mail does not properly "lock" the file so the index thinks the message is in your inbox but it's really not. So, upon start up, it has some invalid pointer or invalid state of the meta-data files.

I can't prove this as I can't debug. I noticed that the problem has not occurred since I now wait to let messages load. I see the message header pane refresh. So sometimes Mail is consuming 45% - 80% of CPU for about 3 to 5 seconds. It's doing something. But if you click the message, let it display and then delete it, I think you'll be OK.
 
I'd guess that Mail had lost access to its own files. The sample says something about

FSEventStreamFlushSync

which is a kind of observer for files. Deleting the MailData folder seems such a cure-all until the next time the index isn't working properly.

@rhimbo: there is no concept of a file lock on macOS. Have you tried to send yourself a really large file to reproduce the problem?
 
@beatrixwillius, I regularly CC myself on mail messages with photos... total size anywhere from 25MB to 45MB. I try not to go higher than that a popular mail services (Google, Yahoo, etc.) limit at 50MB. When Mail works it works fine even with large messages.

I specifically saw the problem occur after doing things as simple as:
1. Clicking a message in the message header pane
2. Double-clicking a message in the header pane to open the message in a new window
3. Dragging a message to move it to a "mailbox" (Apple's amusing term for sub-folder)
4. Clicking the "Reply" button
5. Other similarly simple interactions with the Mail UI

In my case I never touched any data or meta-data files while Mail was operating. I deleted MailData (and other sub-folders related to mail as the article instructs) only upon encountering a problem with Mail crashing on start up and core dumping. Mail was not running when I deleted files and directories as the article instructs.

When Mail did restart finally, it re-downloaded all messages from the server and went through a fairly lengthly re-indexing cycle.

When I mentioned file locking, I was thinking that Mail might lock message or meta-data files during operation. But even without file locking, there are synchronization primitives to support concurrency. Application code must lock a semaphore, mutex lock, read-write lock or other synchronization primitive before entering critical sections that require atomicity and one-at-a-time access. And macOS still uses POSIX threads, right...?

Mail should be doing locking and synchronization before accessing in-memory structures or file data. I suspect there is a concurrency bug somewhere in Mail. The behavior suspiciously resembles that of concurrency bugs.

Mail should be locking any data structure that represents an index of messages (message tree, conversation tree, etc.) as well as any message manipulated. And there are many others I'm probably not thinking of.
[automerge]1590903260[/automerge]
Oh, and by the way, after re-installing macOS from the net about a month ago, I have not had any problems with Mail.

That being said, I am being careful to ensure that a message has downloaded from the server before even clicking on it.

I do still notice that a message stays in the header view pane after deleting it. Previously I would just click delete two or three times impatiently. Now I click on another mail account in the account pane, then click back to the original mail account. And then I see that the message I deleted is no longer showing in the header pane.

And just to make the situation more complicated, I have another outstanding problem with Activity Monitor. So, is there still something not quite right with my environment? Very possibly? But I'll post another discussion for that problem....
 
Unfortunately it's extremely difficult to reproduce nondeterministic concurrency bugs (as you know already)...! One has to examine the source code....

But here is some additional anecdotes. Uncannily, this just happened this morning when I got on the computer.
1. I deleted a mail message (highlighted it in the header pane, hit the "delete" key.
2. Just then a new email message arrived. There was a refresh of the message header view pane.
3. The message appeared grayed out but remained in the message header pane.
4. I clicked on the header of a second message.
5. The second message displayed in the message view pane.
6. I clicked the grayed out (deleted) message again.
7. The message appeared: "this message is no longer available."
8. I selected another mail account.
9. I selected the original mail account.
10. Now the deleted message was gone from the header view pane.

This is a familiar scenario for me. Something like this occurred each time I had the problem with Mail not starting. However, in the past, I would hit "delete" multiple times on the grayed out message. I think that put Mail in an inconsistent state.

Without the source code I can't know for sure exactly the source of the inconsistent internal state.
 
Ha ha ha ha...! I spoke too soon in post #16 in this thread.

I just had another Mail crash this morning. I started Mail, let it sit there for a moment. I clicked "delete" on a message in the header pane and WHAM...!!! CORE DUMP...!!!

So.... I went through the procedure outlined in the web page I referenced above.
Mail not working in macOS Catalina, How-to fix - AppleToolBox

Now, I'm sitting here watching the 51,000 mail messages download from the server. See attached screen grabs.... Lovely. Just lovely. I added a lot of descriptive text in the text box of the core dump report. I doubt it helps. I also filed yet another bug report with Apple. I doubt it helps....

This is getting really old.


Mail-importing-messages.png



Mail-downloading-messages.png
 
Last edited:
I just had another Mail crash this morning. I started Mail, let it sit there for a moment. I clicked "delete" on a message in the header pane and WHAM...!!! CORE DUMP...!!!

So.... I went through the procedure outlined in the web page I referenced above.
Mail not working in macOS Catalina, How-to fix - AppleToolBox

Now, I'm sitting here watching the 51,000 mail messages download from the server. See attached screen grabs.... Lovely. Just lovely. I added a lot of descriptive text in the text box of the core dump report. I doubt it helps. I also filed yet another bug report with Apple. I doubt it helps....

This is getting really old.


View attachment 921850


View attachment 921851

Did you look in the Console log to see what the crash log shows. Maybe it was not mail that caused the crash.
 
Did you look in the Console log to see what the crash log shows. Maybe it was not mail that caused the crash.

Yes I did. It's Mail alright...! I filed a detailed report with Apple here:

Actually this is about the 6th time I filed such a crash report with Apple over the past 3 years on this issue alone....
Oh well....
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.