Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Adam Shallcross 55 posts 211 karma points MVP c-trib
    Sep 25, 2019 @ 08:51
    Adam Shallcross
    0

    Media skipping recycle bin when deleted

    So we had a really strange issue happen last night on a new client site (Umb 7.15.2).

    They were trying to delete a media item from the library, but somehow have managed to delete a folder in the media library named 'images' that they had setup that of course held all their images - over 2k of them!!

    However, for some reason these seem to have totally disappeared from the Umbraco instance!!

    They aren't in the recycle bin at all. They have literally been deleted. The site is on Azrue so we hold the media in blob storage. And they have been deleted from there.

    Looking at the logs we can see that there were ~ 2k transactions at around the time the client deleted the items so clearly this was processing the deletion.

    The client also swears blind they didn't right click > delete > go to recycle bin > empty recycle bin.

    We still have other previously deleted items in there as well, just none if the 2k images that we are referring too here.

    So my questions are:-

    • Has anyone ever seen this happen before??
    • Is there some limit on numbers of items that can be moved to the recycle bin so in this instance it was skipped?
    • Is there something in the Azure File System Object that makes images stored in blob storage skip the recycle bin?
    • Have we just uncovered a really bizarre Umbraco bug?

    Any one with any thoughts or experience around this :)

  • Kevin Jump 2343 posts 14890 karma points MVP 8x c-trib
    Sep 25, 2019 @ 09:54
    Kevin Jump
    0

    Hi,

    Are you 100% sure no one emptied the bin / there isn't a job to do it or anything?

    It will be logged if it happened - even if the user doesn't think they did it :(

    SELECT *  FROM [umbracoLog] WHERE NodeId = -21;
    
  • Rasmus John Pedersen 14 posts 485 karma points hq c-trib
    Sep 25, 2019 @ 10:02
    Rasmus John Pedersen
    1

    I've seen it happend with content if you click the delete button twice, it first sends it to the recycle bin and the deletes it.

    This was fixed in 7.5 (https://github.com/umbraco/Umbraco-CMS/pull/1432) for the actions menu, but it looks like it's still possible to double click the confirm delete button in the list view

  • gmargol 1 post 71 karma points
    Sep 25, 2019 @ 10:10
    gmargol
    0

    Just to add more details, that's the log from when it happened:

    2019-09-24 13:07:28,326 [P6320/D3/T30] ERROR Umbraco.Core.Persistence.UmbracoDatabase - Exception (807e338e).
    System.Data.SqlClient.SqlException (0x80131904): Transaction (Process ID 106) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 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.SqlDataReader.TryConsumeMetaData()
       at System.Data.SqlClient.SqlDataReader.get_MetaData()
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteScalar()
       at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteScalar() in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling\Data\ProfiledDbCommand.cs:line 299
       at Umbraco.Core.Persistence.PetaPocoCommandExtensions.<>c__DisplayClass11_0.<ExecuteScalarWithRetry>b__0()
       at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
       at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteScalarWithRetry(IDbCommand command, RetryPolicy cmdRetryPolicy, RetryPolicy conRetryPolicy)
       at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteScalarWithRetry(IDbCommand command, RetryPolicy retryPolicy)
       at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteScalarWithRetry(IDbCommand command)
       at Umbraco.Core.Persistence.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco)
    ClientConnectionId:84fa3c61-bcac-41cb-916f-5c1731dedef3
    Error Number:1205,State:51,Class:13
    ClientConnectionId before routing:a79c72bc-4039-4ed0-aa60-e03d4277f814
    Routing Destination:b1f2e3ead951.tr3.uksouth1-a.worker.database.windows.net,11031
     2019-09-24 13:07:36,315 [P6320/D3/T30] ERROR Umbraco.Web.Editors.MediaController - Unhandled controller exception occurred
    System.Data.SqlClient.SqlException (0x80131904): Transaction (Process ID 106) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 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.SqlDataReader.TryConsumeMetaData()
       at System.Data.SqlClient.SqlDataReader.get_MetaData()
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteScalar()
       at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteScalar() in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling\Data\ProfiledDbCommand.cs:line 299
       at Umbraco.Core.Persistence.PetaPocoCommandExtensions.<>c__DisplayClass11_0.<ExecuteScalarWithRetry>b__0()
       at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
       at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteScalarWithRetry(IDbCommand command, RetryPolicy cmdRetryPolicy, RetryPolicy conRetryPolicy)
       at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteScalarWithRetry(IDbCommand command, RetryPolicy retryPolicy)
       at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteScalarWithRetry(IDbCommand command)
       at Umbraco.Core.Persistence.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco)
       at Umbraco.Core.Persistence.Database.Insert(Object poco)
       at Umbraco.Core.Persistence.Repositories.RelationRepository.PersistNewItem(IRelation entity)
       at Umbraco.Core.Cache.NoRepositoryCachePolicy`2.Create(TEntity entity, Action`1 persistNew)
       at Umbraco.Core.Persistence.Repositories.RepositoryBase`2.PersistNewItem(IEntity entity)
       at Umbraco.Core.Persistence.UnitOfWork.ScopeUnitOfWork.Commit(Action`1 transactionCompleting)
       at Umbraco.Core.Persistence.UnitOfWork.ScopeUnitOfWork.Commit()
       at Umbraco.Core.Services.RelationService.Save(IRelation relation)
       at Umbraco.Core.Strategies.RelateOnTrashHandler.MediaService_Trashed(IMediaService sender, MoveEventArgs`1 e)
       at Umbraco.Core.Events.TypedEventHandler`2.Invoke(TSender sender, TEventArgs e)
       at Umbraco.Core.Events.EventDefinition`2.RaiseEvent()
       at Umbraco.Core.Events.ScopeEventDispatcher.ScopeExitCompleted()
       at Umbraco.Core.Events.ScopeEventDispatcherBase.ScopeExit(Boolean completed)
       at Umbraco.Core.Scoping.Scope.<>c__DisplayClass70_0.<RobustExit>b__1()
       at Umbraco.Core.Scoping.Scope.TryFinally(Int32 index, Action[] actions)
       at Umbraco.Core.Scoping.Scope.TryFinally(Int32 index, Action[] actions)
       at Umbraco.Core.Scoping.Scope.RobustExit(Boolean completed, Boolean onException)
       at Umbraco.Core.Scoping.Scope.DisposeLastScope()
       at Umbraco.Core.Scoping.Scope.Dispose()
       at Umbraco.Core.Persistence.UnitOfWork.ScopeUnitOfWork.DisposeResources()
       at Umbraco.Core.DisposableObjectSlim.Dispose(Boolean disposing)
       at Umbraco.Core.DisposableObjectSlim.Dispose()
       at Umbraco.Core.Services.MediaService.MoveToRecycleBinDo(IMedia media, Int32 userId, Boolean ignoreDescendants)
       at Umbraco.Core.Services.MediaService.Umbraco.Core.Services.IMediaServiceOperations.MoveToRecycleBin(IMedia media, Int32 userId)
       at Umbraco.Web.Editors.MediaController.DeleteById(Int32 id)
       at lambda_method(Closure , Object , Object[] )
       at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.<GetExecutor>b__2(Object instance, Object[] methodParameters)
       at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
       at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
    
  • Kevin Jump 2343 posts 14890 karma points MVP 8x c-trib
    Sep 25, 2019 @ 10:10
    Kevin Jump
    1

    Yeah

    just tested this - i can delete files completely if I start the delete twice (in two browser tabs) I got an SQL error but at the end of it all the images where gone :(

    Kevin

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Sep 25, 2019 @ 10:17
    Dan Diplo
    0

    I know this won't help with your current problem, but I've started adding a "Prevent Deletion" checkbox to Media folders and then use an event to cancel any delete or send to recycle bin if it's checked. Can prevent nasty accidents like this.

  • Adam Shallcross 55 posts 211 karma points MVP c-trib
    Sep 25, 2019 @ 10:27
    Adam Shallcross
    1

    Wow, thanks for the responses everyone!!

    Seems like we have a root cause and a solution...thanks for the pointers and help!

    Maybe we should create an issue to look at this in both V7 and V8 so we can make sure this doesn't happen to anyone else.

    For now we have rolled back the DB to before the deletion and the client is gathering all 2k images together so we can reupload them to Azure and wire everything back together again...but this is something that should definitely be addressed in the core.

    Cheers

  • Kevin Jump 2343 posts 14890 karma points MVP 8x c-trib
    Sep 25, 2019 @ 10:53
    Kevin Jump
    0

    Bit Stable Door after the horse has gone thing - but I've knocked up a uSync backed "delete protection" class. That will save a media items config and the file before it leaves the recycle bin.

    https://gist.github.com/KevinJump/06010031797b93a4b22d696b8fb4271c

    in theory, you could then put this into a usync folder and it would reimport the media and any config.

    but you'd probably want to combine with something like Dan has to stop it happening at all :(

    (and that gist doesn't support azure blob storage, so basically it's useless to you.. sorry.)

Please Sign in or register to post replies

Write your reply to:

Draft