U4-5749 - Unable to multiple delete members when in groups

Created by Damian Green 03 Nov 2014, 19:44:39 Updated by Simon Steed 01 Aug 2018, 09:23:34

If you select multiple members to delete and they belong to a group (subscribers for example) then the delete fails with a locking error:

System.Data.SqlClient.SqlException: Transaction (Process ID 70) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. STACKTRACE:

at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteNonQuery() in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling\Data\ProfiledDbCommand.cs:line 279 at Umbraco.Core.Persistence.PetaPocoCommandExtensions.<>c__DisplayClass1.b__0() at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func1 func) at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteNonQueryWithRetry(IDbCommand command, RetryPolicy cmdRetryPolicy, RetryPolicy conRetryPolicy) at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteNonQueryWithRetry(IDbCommand command, RetryPolicy retryPolicy) at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteNonQueryWithRetry(IDbCommand command) at Umbraco.Core.Persistence.Database.Execute(String sql, Object[] args) at Umbraco.Core.Persistence.Repositories.PetaPocoRepositoryBase2.PersistDeletedItem(TEntity entity) at Umbraco.Core.Persistence.Repositories.MemberRepository.PersistDeletedItem(IMember entity) at Umbraco.Core.Persistence.Repositories.RepositoryBase2.PersistDeletedItem(IEntity entity) at Umbraco.Core.Persistence.UnitOfWork.PetaPocoUnitOfWork.Commit(Action1 transactionCompleting) at Umbraco.Core.Persistence.UnitOfWork.PetaPocoUnitOfWork.Commit() at Umbraco.Core.Services.MemberService.Delete(IMember member) at Umbraco.Web.Editors.MemberController.DeleteByKey(Guid key) at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.b__c(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.<>c__DisplayClass5.b__4() at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)

Comments

Greg Fyans 11 Jul 2015, 17:49:05

@Damian.Green did you ever find a fix for this? having the same problem on 7.2.6.


Jeavon Leopold 18 Aug 2015, 16:47:23

@zpqrtbnk @Shandem any ideas on this issue, we have just hit this with v7.2.8


John Seto 21 Aug 2015, 09:36:15

@crumpled_jeavon This is an issue for us too same version....


Sebastiaan Janssen 27 Aug 2015, 12:45:44

I can repro! Also if the member is not in a group.

Only get an error in backoffice, not in the log:

Received an error from the server Failed to delete item 188b066cdf96492bb5d50c971e9f8587

Object reference not set to an instance of an object.

EXCEPTION DETAILS:

System.NullReferenceException: Object reference not set to an instance of an object. STACKTRACE:

at Umbraco.Core.Persistence.Repositories.MemberRepository.PersistDeletedItem(IMember entity) at Umbraco.Core.Persistence.Repositories.RepositoryBase2.PersistDeletedItem(IEntity entity) at Umbraco.Core.Persistence.UnitOfWork.PetaPocoUnitOfWork.Commit(Action1 transactionCompleting) at Umbraco.Core.Persistence.UnitOfWork.PetaPocoUnitOfWork.Commit() at Umbraco.Core.Services.MemberService.Delete(IMember member) at Umbraco.Web.Editors.MemberController.DeleteByKey(Guid key) at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.b__c(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.<>c__DisplayClass5.b__4() at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)


Sebastiaan Janssen 27 Aug 2015, 13:32:10

I was a bit too hasty here I guess ,this seems to be two issues. I can't delete a single member from the backoffice and it might deadlock if I try to delete multiple members. Sorry for the confusion! :-)


Stephan 27 Aug 2015, 13:53:53

probably same issue as with the list view, looking into it


Stephan 27 Aug 2015, 13:59:42

in fact, by my tests, it now works?


Simon Steed 01 Aug 2018, 09:23:34

For anyone needing to fix this, upgrading to 7.4.3 resolved this for me!


Priority: Normal

Type: Bug

State: Fixed

Assignee: Stephan

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.2.0, 7.2.8

Due in version: 7.3.0

Sprint:

Story Points:

Cycle: