Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nhibernate error messages in Azure SQL Managed Instance and on prem SQL server #8778

Open
andrewmadueke opened this issue Apr 3, 2024 · 4 comments

Comments

@andrewmadueke
Copy link

andrewmadueke commented Apr 3, 2024

Has anyone encountered similar issues? The exception below just started popping up out of nowhere after many years of using Orchard. The site gets locked and no one is able to navigate for periods of time.
Would it help to upgrade Nhibernate to a newer version? Should I also look at upgrading orchard Framework to version 1.10.3?
Moving to Orchard Core is out of question for now due to budget.

Current Orchard Framework Version: 1.10.2
Current Nhibernate version: 4.0.4.4000

Exception NHibernate.Exceptions.GenericADOException: could not execute batch command.[SQL: SQL not available] ---> System.Data.SqlClient.SqlException: Execution Timeout Expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.  Operation cancelled by user.  The statement has been terminated. ---> System.ComponentModel.Win32Exception: The wait operation timed out     --- End of inner exception stack trace ---     
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 System.Data.SqlClient.SqlCommandSet.ExecuteNonQuery()     
at NHibernate.AdoNet.SqlClientBatchingBatcher.DoExecuteBatch(IDbCommand ps)     --- End of inner exception stack trace ---     
at NHibernate.AdoNet.SqlClientBatchingBatcher.DoExecuteBatch(IDbCommand ps)     
at NHibernate.AdoNet.AbstractBatcher.ExecuteBatchWithTiming(IDbCommand ps)     
at NHibernate.AdoNet.AbstractBatcher.ExecuteBatch()     
at NHibernate.Engine.ActionQueue.ExecuteActions()     
at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)     
at NHibernate.Event.Default.DefaultAutoFlushEventListener.OnAutoFlush(AutoFlushEvent event)     
at NHibernate.Impl.SessionImpl.AutoFlushIfRequired(ISet`1 querySpaces)     
at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results)     
at NHibernate.Impl.CriteriaImpl.List(IList results)     
at NHibernate.Impl.CriteriaImpl.List[T]()     
at Orchard.ContentManagement.DefaultContentQuery.Slice(Int32 skip, Int32 count)     
at Orchard.ContentManagement.DefaultContentQuery.ContentQuery`1.Orchard.ContentManagement.IContentQuery<T>.List()     
at Orchard.Widgets.Services.DefaultLayerEvaluationService.PopulateActiveLayers() in D:\a\1\s\GMS_Portal\Workforce\KLP_Branch_GMS_Portal\src\Modules\Orchard.Widgets\Services\DefaultLayerEvaluationService.cs:line 45     
at Orchard.ContentManagement.Utilities.LazyField`1.GetValue()     
at Orchard.ContentManagement.Utilities.LazyField`1.get_Value()     
at Orchard.Widgets.Services.DefaultLayerEvaluationService.GetActiveLayerIds() in D:\a\1\s\GMS_Portal\Workforce\KLP_Branch_GMS_Portal\src\Modules\Orchard.Widgets\Services\DefaultLayerEvaluationService.cs:line 38     
at Orchard.Widgets.Filters.WidgetFilter.OnResultExecuting(ResultExecutingContext filterContext) in D:\a\1\s\GMS_Portal\Workforce\KLP_Branch_GMS_Portal\src\Modules\Orchard.Widgets\Filters\WidgetFilter.cs:line 52     
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)     
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)     
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)     
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)     
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)     
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)     
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)     
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)     
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)     
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)     
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)     
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass3_1.<BeginInvokeAction>b__1(IAsyncResult asyncResult) has been thrown in controller Tax.Core.Framework.Controllers.HomeController redirecting user to '~/Login/ApplicationError'
@damongroenveld
Copy link

damongroenveld commented Apr 3, 2024 via email

@andrewmadueke andrewmadueke changed the title Nhibernate error messages in Azure SQL and SQL server Nhibernate error messages in Azure SQL Managed Instance and on prem SQL server Apr 3, 2024
@andrewmadueke
Copy link
Author

Let me also mention that we're not using the Orchard.sdf. We're reading the orchard settings from databases in a Sql Managed Instance and Sql Server on Prem. Thanks

@sebastienros
Copy link
Member

There was a perf improvement in 1.10.3 for the query that is the issue in your logs, due to a SELECT n+1 problem, which could explain why it's timing out. You could try to apply this fix or move to 1.10.3.

The dev branch (1.11) also added some caching on top of this improvement, which is something you could also try, and would probably help a lot.

Check the DefaultLayerEvaluationService.PopulateActiveLayers in both 1.10.3 tags and dev branch to see these two improvements.

@andrewmadueke
Copy link
Author

I'll look into this Sebastien. Thanks for the quick reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants