Reset SpamSieve corpus, then Mail started crashing

I reset SpamSieve’s corpus today just to cut the bloat and retrain SpamSieve. Then I noticed that one legitimate email was in the Spam folder. I used the “Train as good” plugin and surprisingly, the email didn’t get moved to my Inbox like it normally did. So I tried it once more. And then Apple Mail crashed and wouldn’t start without crashing so I’m in the middle of an Envelope Index rebuild right now by doing the reimport method. While Apple Mail is busy, I thought I’d look at the Mail.crash.log and discovered what might be the reason for the crash in the crashed thread–lots of references to SpamSieve (any ideas on how to restore my Apple Mail to functionality without shutting down SpamSieve permanently would be appreciated):

Thread 8 Crashed:
0 com.apple.CoreFoundation 0x907cb558 CFStringFindWithOptions + 24
1 com.apple.Foundation 0x92bda4ac -[NSString rangeOfString:options:range:] + 372
2 com.apple.Foundation 0x92c1a8e4 -[NSString rangeOfString:options:] + 116
3 …ommand.spamsieve.mailplugin 0x017a6514 -[NSString(MJTTextMunging) mjtHasCaseInsensitivePrefix:] + 44
4 …ommand.spamsieve.mailplugin 0x017a3038 ruleNameStartsWithSpamSieve + 52
5 …ommand.spamsieve.mailplugin 0x017a30d8 isSpamSieveColorRuleName + 32
6 …ommand.spamsieve.mailplugin 0x017a3238 isSpamSieveScoringRuleName + 24
7 …ommand.spamsieve.mailplugin 0x017a3998 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 60
8 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
9 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
10 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
11 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
12 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
13 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
14 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
15 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
16 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
17 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
18 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
19 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
20 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
21 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
22 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
23 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
24 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
25 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
26 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
27 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
28 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
29 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
30 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
31 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
32 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
33 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
34 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
35 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
36 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100
37 …ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] + 100

There’s actually a lot more (goes up to line 496 that’s identical to line 37 above).

Please try restarting your Mac. I haven’t seen this type of crash before, and it doesn’t look like a typical sequence of operations for the SpamSieve plug-in. So I suspect some kind of independent, transient issue.

Nope, didn’t work but something else did which confirmed my suspicions
I followed your instructions and restarted my Mac. Then I started Mail. And it crashed after staying up for maybe 30 seconds. Started it again. Crashed again after 30 seconds or so. Each time, in the Mail.crash logs, the crashed thread had hundreds of lines (up to 496 of them) of the form:

…ommand.spamsieve.mailplugin 0x017a39c0 -[MessageRule(SpamSieve) spamSieveDoesMessageSatisfyCriteria:] +xxx

where xxx was some number between 60 and 100. And the Mail crash log was very explicit about which thread had caused the crash: the one with the hundreds of SpamSieve lines.

So, in desperation, what I did was go into /Library/Mail/Bundles and moved SpamSieve.mailbundle into /Library/Mail/Bundles (Disabled). As soon as I did that and restarted Mail without doing anything else (no more restarts, no switching off haxies, etc.), Mail not only stopped crashing, it continues to stay up as of now. I think that pretty much points a very damning finger at the SpamSieve mailbundle!!!

Note that this is the first time since I installed SpamSieve on my system that I actually followed the hint and reset the Corpus. Previously, I just ignored the hint and let it grow and grow. Is there any way I can restore Spam Sieve without Mail tossing its cookies like this? SpamSieve has served me well–maybe I just will leave the Corpus alone next time.

I don’t think there’s any relation between resetting the corpus and Mail crashing. Do you have any other Mail plug-ins installed? Any haxies? The SpamSieve plug-in hasn’t really changed in quite some time, so if it used to work for you, it should still work, unless something else changed. Perhaps it would help to download a fresh copy of the SpamSieve application, replace yours, and then choose “Install Apple Mail Plug-In” from the SpamSieve menu.

Yes, I have the Daylite Mail Integration plugin installed as well as a few Unsanity haxies but they’ve been there for at least a year. Nothing new has been added or upgraded on that front. The only thing I can think of is that the SpamSieve mail bundle got corrupted somehow during the Corpus reset (because that’s all that I did before all Hell broke loose. Nothing else had happened–no kernel panics, no system hangs, no power resets, nada). I’ve reinstalled the plugin from SpamSieve and Mail seems to be staying up beyond 30 seconds so far. I guess, as a test, I could swap out the current SpamSieve mail bundle for the older on in the disabled folder and if Mail starts to crash after 30 seconds, that definitely points to something bad in the old SpamSieve mailbundle… I’ll let you know.

Hmm, well resetting the corpus doesn’t touch the mailbundle. In fact, SpamSieve never touches the mailbundle except when you ask it to install a new copy. But I agree that a damaged mailbundle might cause the problems that you observed, and I’m glad that installing a fresh one fixed things.

Took a closer look
I noticed that SpamSieve installed things this time in ~/Library/Mail/Bundles instead of /Library/Mail/Bundles. It didn’t ask me during the install process where to install the Apple Mail plugin. This is kind of surprising. I’ve manually moved the SpamSieve mailbundle from ~/Library/Mail/Bundles to /Library/Mail/Bundles. Thus far, no crashes but why did SpamSieve not ask where I wanted to install the plugin (i.e., for “this” account’s sole use, i.e. ~/Library/Mail/Bundle, or for the use of any account on the machine, i.e., /Library/Mail/Bundles)? Maybe a feature request?

~/Library/Mail/Bundles is the normal install location. I don’t see any reason to install it in /Library and possibly interfere with other user accounts. Even if it were in /Library, other users who want to use SpamSieve would still need to install the plug-in (because installation does more than copy the .mailbundle) and complete the rule setup in Mail.

In that case…
…something is funky. When I installed SpamSieve the first time, I did not move anything (i.e., I didn’t move the SpamSieve mailbundle from ~/Library/Mail/Bundles to /Library/Mail/Bundles)–I just followed the instructions. However, /Library/Mail/Bundles was where I found the corrupted SpamSieve mailbundle (and nobody else has any access to my machine, admin or otherwise). There was no SpamSieve mailbundle in ~/Library/Mail/Bundles until I reinstalled per your instructions.

I don’t know what to say. No version of SpamSieve has ever installed into /Library/Mail/Bundles. Maybe some other utility moved it?