AstDB issues after upgrading using the scripts

I’ve seen this many times and I’m not sure if the root cause here:
I have many installations of FreePBX Distro out there, and on Numerous occasions I’ve had asterisk consume 100% of the CPU all of the time after doing updates/maintenance.

I can typically fix this with the following however I would love to know what is actually causing this:

amportal stop

rm /var/lib/asterisk/astdb*

amportal start

Then navigate to FreePBX and go to Applications -> Bulk Extensions then export extensions
Pull the csv into Excel and in column A enter “edit” (noquotes) next to each extension and save

Use Notepad++ or TextWrangler to convert the file to UNIX linefeed format

Import into the Bulk Extensions module and apply changes.