.. include:: /Includes.rst.txt .. _bugfix-1793003689: ============================================ Bugfix: A deadlock no longer ends the import ============================================ Description =========== When a messenger worker handled attendance work for the employees an import was writing, the database could end the import in a deadlock. The failed flush closed the entity manager, the run died with ``The EntityManager is closed`` without a cause, and its record stayed ``running``. A batch that runs into a lock conflict (a deadlock or a lock wait timeout) is now rolled back and tried again on a fresh entity manager, up to three times with a growing pause. If it still fails, the stage ends as failed with the issue ``targetLocked`` and the SQLSTATE of the database error, the batches committed before stay, and the next run continues after them. A stage that fails for any other reason is also marked as failed, with the cause shown. The installation guide says to stop the workers during the import. Impact ====== An import survives a deadlock instead of aborting, and a failed stage never stays ``running``. .. index:: Migration, package:adsum-migration