JeffDarchuk / SitecoreSidekick

Framework for angularjs based microservice architecture operations.
MIT License
48 stars 33 forks source link

Multi thread issue when using 4 databaseWriterThreads #63

Open markgibbons25 opened 3 years ago

markgibbons25 commented 3 years ago
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

JeffDarchuk commented 3 years ago

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 commented 3 years ago

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