migrate_from_trac is not run in database transaction
If there is an error in the migrate_from_trac script, changes to the database are not rolled back. This could leave the project in a state where you can encounter a lot of 500 Internal errors.
E.g. after #14843 there are no users in the database yet, but there are already links to users. Clicking on a user link fails with Internal error.