SitecoreSidekick icon indicating copy to clipboard operation
SitecoreSidekick copied to clipboard

Multi thread issue when using 4 databaseWriterThreads

Open markgibbons25 opened this issue 4 years ago • 2 comments

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Data.SqlClient.SqlException: The parameterized query '(@p0 uniqueidentifier,@p1 nvarchar(6),@p2 uniqueidentifier,@p3 n' expects the parameter '@p980', which was not supplied.
   at System.Data.SqlClient.SqlConnection.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.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.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at Sitecore.Data.DataProviders.Sql.DataProviderTransaction.Flush()
   at Sitecore.Data.DataProviders.Sql.DataProviderTransaction.Dispose()
   at Sitecore.Links.SqlBatchLinksOperationWorker.<TryStartProcessingBatches>b__21_0()
   at Sitecore.Data.DataProviders.NullRetryer.ExecuteNoResult(Action action, Action recover)
   at Sitecore.Links.SqlBatchLinksOperationWorker.AddItemLink(SqlInsertLinksModel sqlInsertLinks)
   at Sitecore.Data.SqlServer.SqlServerBatchLinkDatabase.UpdateLinks(Item item, ItemLink[] links)
   at Sitecore.Data.Managers.ItemProvider.RemoveVersion(Item item, SecurityCheck securityCheck)
   at Sitecore.Data.Items.ItemVersions.RemoveAll(Boolean includeAllLanguages)
   at Rainbow.Storage.Sc.Deserialization.DefaultDeserializer.CreateTargetItem(IItemData serializedItemData, Item destinationParentItem)
   at Rainbow.Storage.Sc.Deserialization.DefaultDeserializer.GetOrCreateTargetItem(IItemData serializedItemData, Boolean& newItemWasCreated)
   at Rainbow.Storage.Sc.Deserialization.DefaultDeserializer.Deserialize(IItemData serializedItemData, IFieldValueManipulator fieldValueManipulator)
   at Rainbow.Storage.Sc.SitecoreDataStore.Save(IItemData item, IFieldValueManipulator fieldValueManipulator)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at ScsContentMigrator.Services.DatastoreSaver.Save(IDataStore store, IItemData data)
   at ScsContentMigrator.Core.ContentItemInstaller.ProcessItem(PullItemModel args, IItemData localData, IItemData remoteData)

Getting about 500 or so errors like this out of a 3k item pull.

image

image

markgibbons25 avatar Nov 01 '20 01:11 markgibbons25

this one is an interesting one. The system works that threads don't get seeded unless the parent item is already installed, so outside of having an error occur it shouldn't be able to attempt to install a child before a parent.

That being said there're a few puzzling things about this one

  1. That error message makes no sense, which is a bummer
  2. Given the black box nature of the Sitecore item APIs (brokered through Rainbow) it would be hard to address in a purely Sidekick context
  3. It's definitely a raw SQL error and generally in the past when I've seen such errors it's been because of some sort of data corruption.

However, there's definitely merit in Sidekick being able to more gracefully recover from errors such as this. As you've stated, it appears that after this kind of error it seeds the children installation thread. At the very least, it should make sure that doesn't happen.

JeffDarchuk avatar Nov 01 '20 14:11 JeffDarchuk

for reference, there is some code built to protect this kind of child before the parent install scenario seen here

JeffDarchuk avatar Nov 01 '20 14:11 JeffDarchuk