I'm currently getting the error:
System.Data.SqlClient.SqlException: Transaction (Process ID 109) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
From what I understand from my research, the system is killing the process with the smallest amount of access to the database to resolve a deadlock. This isn't ideal, because it guarantees that this process will enter an error state. I'm in a situation where it would not be undesirable for the process to wait for the deadlock to resolve; this isn't a super time-critical process.
Here are my questions:
- Is it possible to instruct Entity Framework via connection string or some other configuration to simply halt the least expensive deadlocked process rather than killing it? If so, how?
- Is it possible to report the stack trace for all dead locked processes, instead of just the process that got killed? It's basically impossible for me to troubleshoot otherwise.
Updated: I understand that it may not be possible to resolve the deadlock by simply halting one process. In this case, just focus on the second question.