保存时出现间歇性异常

Intermittant Exceptions On Save

我们一直在为拥有大型站点的客户大力投资 2sxc。我们构建了许多自定义应用程序,并向默认内容应用程序添加了相当多的内容类型。

大约一个月前,我们开始看到在保存前端数据和在 Content App 中保存 ContentType 时速度变慢(但仅限于此)。该站点需要 20 - 30 秒才能保存。现在情况变得更糟,开始间歇性地抛出异常。保存不超过 30 秒。其他时候是 60 秒。间歇性地无法保存内容,我们收到下面列出的错误消息和异常。

但是,我们在其他应用程序(如博客应用程序和我们的自定义应用程序)中保存内容没有任何问题。那里的表现很好。此外,2sxc 模块通常似乎可以很好地为前端用户呈现。

我们在 DNN 7.4.2 上 运行 2sxc 8.4.5。


这是初始错误消息:

Had an error talking to the server (status 400)
Message: Bad Request
Detail: Error getting List of Stream.
Stream Name: Default
DataSource Name: QuickCache

Failed to load resource: the server responded with a status of 400 (Bad Request)
POST [removed]/en-us/desktopmodules/2sxc/api/eav/entities/savemany?appId=2 400 (Bad Request)
(anonymous) @ VM2141:2
(anonymous) @ set.min.js?sxcver=8.9.1.13916:103
n @ set.min.js?sxcver=8.9.1.13916:99
(anonymous) @ set.min.js?sxcver=8.9.1.13916:96
(anonymous) @ set.min.js?sxcver=8.9.1.13916:131
$eval @ set.min.js?sxcver=8.9.1.13916:145
$digest @ set.min.js?sxcver=8.9.1.13916:142
$apply @ set.min.js?sxcver=8.9.1.13916:146
(anonymous) @ set.min.js?sxcver=8.9.1.13916:276
Sf @ set.min.js?sxcver=8.9.1.13916:37
d @ set.min.js?sxcver=8.9.1.13916:37

DNN 事件日志中出现两个异常。每次保存失败都会出现两次。


General Exception
AbsoluteURL:/en-us/desktopmodules/2sxc/api/eav/entities/savemany
DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke
ExceptionGUID:7888b675-2f38-4664-96ab-786b27b3406c
AssemblyVersion:
PortalId:-1
UserId:-1
TabId:-1
RawUrl:
Referrer:
UserAgent:
ExceptionHash:QVy9pjR7G9IFD3vpE650/A==
Message:Error getting List of Stream. Stream Name: Default DataSource Name: QuickCache
StackTrace:
   at ToSic.Eav.DataSources.DataStream.get_LightList() in C:\Projects\eav-server\ToSic.Eav.DataSources\DataStream.cs:line 143
   at ToSic.Eav.DataSources.BaseDataSource.get_LightList() in C:\Projects\eav-server\ToSic.Eav.DataSources\BaseDataSource.cs:line 132
   at ToSic.Eav.Import.Import.RunImport(IEnumerable`1 newAttributeSets, IEnumerable`1 newEntities) in C:\Projects\eav-server\ToSic.Eav\ImportExport\Import.cs:line 71
   at ToSic.Eav.WebApi.EntitiesController.SaveMany(Int32 appId, List`1 items) in C:\Projects\eav-server\ToSic.Eav.WebApi\EntitiesController.cs:line 204
   at ToSic.SexyContent.EAVExtensions.EavApiProxies.EntitiesController.SaveMany(Int32 appId, List`1 items) in C:\ProjectsSexyContent\Web\DesktopModules\ToSIC_SexyContent\WebApi\EavApiProxies\EntitiesController.cs:line 109
   at lambda_method(Closure , Object , Object[] )
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.b__c(Object instance, Object[] methodParameters)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.<>c__DisplayClass5.b__4()
   at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)
InnerMessage:An error occurred while executing the command definition. See the inner exception for details.
InnerStackTrace:
   at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
   at System.Data.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
   at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
   at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable.GetEnumerator()
   at ToSic.Eav.BLL.DbLoadIntoEavDataStructure.GetAppDataPackage(Int32[] entityIds, Int32 appId, IDeferredEntitiesList source, Boolean entitiesOnly) in C:\Projects\eav-server\ToSic.Eav\BLL\DbLoadIntoEavDataStructure.cs:line 179
   at ToSic.Eav.DataSources.SqlSources.EavSqlStore.GetDataForCache(IDeferredEntitiesList targetCacheForDeferredLookups) in C:\Projects\eav-server\ToSic.Eav\DataSources\SqlSources\EavSqlStore.cs:line 68
   at ToSic.Eav.DataSources.Caches.BaseCache.EnsureCache() in C:\Projects\eav-server\ToSic.Eav.DataSources\Caches\BaseCache.cs:line 126
   at ToSic.Eav.DataSources.Caches.BaseCache.GetList() in C:\Projects\eav-server\ToSic.Eav.DataSources\Caches\BaseCache.cs:line 46
   at ToSic.Eav.DataSources.DataStream.get_LightList() in C:\Projects\eav-server\ToSic.Eav.DataSources\DataStream.cs:line 135
Source:ToSic.Eav.DataSources
FileName:
FileLineNumber:0
FileColumnNumber:0
Method:

Page Load Exception
AbsoluteURL:/Default.aspx
DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke
ExceptionGUID:c5449323-0a0a-486f-98cd-9849243fff19
AssemblyVersion:7.4.2
PortalId:0
UserId:-1
TabId:56
RawUrl:/en-us/
Referrer:http://www.cui.edu/en-us/
UserAgent:Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13F69 Safari/601.1
ExceptionHash:301KQ/ilLzYrwILN4yfdXA==
Message:Error getting List of Stream. Stream Name: Default DataSource Name: PublishingFilter
StackTrace:
InnerMessage:Error getting List of Stream. Stream Name: Default DataSource Name: PublishingFilter
InnerStackTrace:
   at ToSic.Eav.DataSources.DataStream.get_List() in C:\Projects\eav-server\ToSic.Eav.DataSources\DataStream.cs:line 98
   at ToSic.Eav.DataSources.BaseDataSource.get_List() in C:\Projects\eav-server\ToSic.Eav.DataSources\BaseDataSource.cs:line 127
   at ToSic.SexyContent.ContentGroup.get_Template() in C:\ProjectsSexyContent\Web\DesktopModules\ToSIC_SexyContent\SexyContent\ContentGroup.cs:line 71
   at ToSic.SexyContent.ContentBlock.ModuleContentBlock..ctor(ModuleInfo moduleInfo, IEnumerable`1 overrideParams) in C:\ProjectsSexyContent\Web\DesktopModules\ToSIC_SexyContent\SexyContent\ContentBlock\ModuleContentBlock.cs:line 77
   at ToSic.SexyContent.View.get_SxcI() in C:\ProjectsSexyContent\Web\DesktopModules\ToSIC_SexyContent\View.ascx.cs:line 18
   at ToSic.SexyContent.View.get_UserMayEditThisModule() in C:\ProjectsSexyContent\Web\DesktopModules\ToSIC_SexyContent\View.ascx.cs:line 90
   at ToSic.SexyContent.View.Page_Load(Object sender, EventArgs e) in C:\ProjectsSexyContent\Web\DesktopModules\ToSIC_SexyContent\View.ascx.cs:line 28
   at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Source:
FileName:
FileLineNumber:0
FileColumnNumber:0
Method:

感谢 Raphael Müller,这个问题已经解决了。他建议在数据库上重建索引。完成后,内容保存时间从 45 秒加上超时减少到 1.5 秒。男孩是我的脸红。哦,生活和学习。教训很简单:确保您的数据库有一个包括重建索引的维护计划。

以下是一些对可能遇到此问题的人有用的链接。

这是一个重建数据库中所有索引的脚本。理论上,该脚本不应锁定您的数据库或网站,但一切皆有可能,因此最好在下班时间执行。在我的大约 2.5 Gb 的 DNN 数据库上 运行 花了 5 分钟。 https://gallery.technet.microsoft.com/scriptcenter/Script-for-rebuilding-all-8d079754

Michelle Ufford 的索引碎片整理脚本是一种高级解决方案。我已经 运行 在我的舞台服务器上成功地使用了它,它似乎受到了社区的欢迎。 http://sqlfool.com/2011/06/index-defrag-script-v4-1/

这里有一个关于多久安排一次索引重建的有益讨论。 How Often should the indexes be re-build in sql-server DB?