@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....