I'm guessing these are two sides of the same problem - it's building branches then rolling them back because it's doing mining. We're aware of a related issue and we should be able to resolve them together.
In the meantime as a workaround please issue the pause mining command while it's catching up, then resume mining once it's finished.