-
Notifications
You must be signed in to change notification settings - Fork 60
EntityWorkItemRepository.RunInTransaction leads to InvalidOperationException - the connection was not closed #7
Comments
Hi, I've been seeing this a lot too, and it seems to kill the job / stop it from recurring. Any thoughts? |
So, read through EntityWorkItemRepository code a little.
The problem scenario is likely that |
Just found evidence to confirm the theory, so I'll work on the pull request. Before the first InvalidOperationException in the logs we have a stack trace going through RunInTransaction. System.Data.Entity.Infrastructure.DbUpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.Data.UpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.Data.SqlClient.SqlException: Transaction (Process ID 495) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. |
…action (from miscellaneous failures such as SqlException) fail to restore _context to a valid state that allows further calls to RunInTransaction.
We've seen a lot of errors showing up in our logs like this.
System.InvalidOperationException: The connection was not closed.
at System.Data.EntityClient.EntityConnection.Open()
at WebBackgrounder.EntityWorkItemRepository.RunInTransaction(Action query)
at WebBackgrounder.WebFarmJobCoordinator.ReserveWork(String workerId, IJob job)
at WebBackgrounder.WebFarmJobCoordinator.GetWork(IJob job)
at WebBackgrounder.JobManager.DoNextJob()
at WebBackgrounder.JobManager.OnTimerElapsed(Object sender)
The text was updated successfully, but these errors were encountered: