ColdFusion · Database exception

SQL Server Deadlock Inside cftransaction

What does SQL Server Deadlock Inside cftransaction mean in ColdFusion?

SQL Server error 1205 fires when two concurrent cfquery calls each hold a lock the other needs, and SQL Server picks one as the deadlock victim and rolls it back. Inside a cftransaction, catching and retrying just the failed query does not resume the transaction cleanly — ColdFusion still rolls back every cfquery already executed earlier in that same transaction block.

SQL Server Deadlock Inside cftransactionAdobe ColdFusion · Lucee

Condition

SQL Server error 1205 fires when two concurrent cfquery calls each hold a lock the other needs, and SQL Server picks one as the deadlock victim and rolls it back. Inside a cftransaction, catching and retrying just the failed query does not resume the transaction cleanly — ColdFusion still rolls back every cfquery already executed earlier in that same transaction block.

Fix

Wrap the entire cftransaction in the cftry, not individual queries inside it, and implement retry logic at the transaction level; also enforce a consistent table access order across code paths to reduce how often the deadlock happens.

Pending source verification. Not yet checked against official documentation.

Related database exception