Avast adds a mail rule that calls an AppleScript. If I had to guess the Applescript has a timeout issue or an exception the Applescript is not smart enough to deal with. Anyway remove the Mail.app Rule and your re-indexing issues will go away.
Mail → Preferences → Rules → (Avast something or other Don’t Remove).
If you like me just disabled Avast on startup it does not remove this rule and if you don’t delete the Avast application the AppleScript continues to be called.