Persistance timeout exception deleting nodes with Content Service
Umb 7.12.4
This works sometimes but mostly it times out as shown below...
Importing records from a JSON object via an API. First thing I do is delete all existing records using this code which appears to be causing the timeout issues:-
// Set up ContentService to SaveAndPublish
IContentService contentService = ApplicationContext.Current.Services.ContentService;
try {
contentService.DeleteContentOfType(1078);
} catch (Exception ex) {
LogHelper.Error(MethodBase.GetCurrentMethod().DeclaringType, "Error Deleting Properties ", ex);
}
The errors I get in the TraceLog are:-
2018-11-24 13:39:23,855 [P2664/D2/T1] INFO Umbraco.Core.Publishing.PublishingStrategy - Content 'Some record title' with Id '2912' has been unpublished.
2018-11-24 13:39:53,946 [P2664/D2/T1] ERROR Umbraco.Core.Persistence.UmbracoDatabase - Exception (ebc34c4d).
System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out
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.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.ExecuteReader(CommandBehavior behavior, String method)
at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteDbDataReader(CommandBehavior behavior) in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling\Data\ProfiledDbCommand.cs:line 248
at Umbraco.Core.Persistence.PetaPocoCommandExtensions.<>c__DisplayClass5_0.<ExecuteReaderWithRetry>b__0()
at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
at Umbraco.Core.Persistence.Database.<Query>d__74`1.MoveNext()
ClientConnectionId:89340de4-337d-4097-bdbe-e62462b1150b
Error Number:-2,State:0,Class:11
2018-11-24 13:39:53,966 [P2664/D2/T1] INFO Umbraco.Core.Publishing.PublishingStrategy - Content 'Another record title' with Id '2913' has been unpublished.
This is how they appear but I'm not sure which comes first, the unpublished lines or the exception so I've put them as they appear to me. The next line would be another exception.
I suspect I'm not doing the deleting in the right way. The DB is SQLExpress on the same PC as Visual Studio. The site is being run via the installed IIS.
I should probably mention this is in a separate class and is currently called on application start for dev/sanity purposes. The intention being to run it on a schedule for production.
Persistance timeout exception deleting nodes with Content Service
Umb 7.12.4
This works sometimes but mostly it times out as shown below...
Importing records from a JSON object via an API. First thing I do is delete all existing records using this code which appears to be causing the timeout issues:-
The errors I get in the TraceLog are:-
This is how they appear but I'm not sure which comes first, the unpublished lines or the exception so I've put them as they appear to me. The next line would be another exception.
I suspect I'm not doing the deleting in the right way. The DB is SQLExpress on the same PC as Visual Studio. The site is being run via the installed IIS.
I should probably mention this is in a separate class and is currently called on application start for dev/sanity purposes. The intention being to run it on a schedule for production.
Any clues or advice would be appreciated.
Craig
Following a Slack channel suggestion I changed:-
To:-
And it appears to be working flawlessly :)
is working on a reply...