0

我们使用 WCSF 框架和 .NET 2.0 创建了一个网站。

目前,该应用程序已上线并被 1000 多名用户使用。我们已在 Windows 2008 Server R2 下的 IIS 7 中将其部署在云中。我们还使用 Sql Server 2008 R2 数据库作为后端。部署架构如下所述。

在负载均衡器(基于硬件)下使用粘性会话连接了两个 Web 服务器。这两台服务器与两台数据库服务器通信,600 多个数据库均匀分布在它们之间。所有请求将首先转到管理数据库,该数据库重定向到适当的数据库服务器。

现在到这个问题......

我们在两台服务器上每天都会遇到大约 4 到 5 次 w3wp 崩溃。在此期间,连接到应用程序的所有用户都将被注销。

错误应用程序名称:w3wp.exe,版本:7.5.7601.17514,时间戳:0x4ce7afa2 错误模块名称:KERNELBASE.dll,版本:6.1.7601.18229,时间戳:0x51fb1677 异常代码:0xe053534f 错误偏移:0x000000000000940d 错误进程9 错误应用程序启动时间:0x%10 错误应用程序路径:%11 错误模块路径:%12 报告 ID:%13

最近我们与 MS 建立了一个案例,他们的评论如下。

---开始微软回应---

由于堆栈溢出问题,该进程崩溃。

.Net 调用堆栈:

System.Enum.System.IConvertible.ToInt64(System.IFormatProvider)
System.Convert.ToInt64(System.Object, System.IFormatProvider)
System.Enum.ToUInt64(System.Object)
System.Enum.IsDefined(System.Type, System.Object)
Microsoft.Practices.ObjectBuilder.Locator.Get(System.Object, Microsoft.Practices.ObjectBuilder.SearchMode)
Microsoft.Practices.ObjectBuilder.ReadableLocator.Get[[System.__Canon, mscorlib]](System.Object)
<Trimmed>
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.CompositeWeb.BuilderStrategies.ContainerAwareTypeMappingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.CompositeWeb.BuilderStrategies.ContainerAwareTypeMappingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.CompositeWeb.BuilderStrategies.ContainerAwareTypeMappingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.CompositeWeb.BuilderStrategies.ContainerAwareTypeMappingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.CompositeWeb.BuilderStrategies.ContainerAwareTypeMappingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.CompositeWeb.BuilderStrategies.ContainerAwareTypeMappingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.CompositeWeb.BuilderStrategies.ContainerAwareTypeMappingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.CompositeWeb.BuilderStrategies.ContainerAwareTypeMappingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.CompositeWeb.BuilderStrategies.ContainerAwareTypeMappingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.CompositeWeb.BuilderStrategies.ContainerAwareTypeMappingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.CompositeWeb.BuilderStrategies.ContainerAwareTypeMappingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)

完整的调用堆栈

我们看到调用是针对 URL 进行的:- ASP.xxxdashboards_recordlistview_aspx

ntdll!ZwTerminateProcess
KERNELBASE!TerminateProcess+2f
mscorwks!EEPolicy::HandleFatalStackOverflow+13b
mscorwks!EEPolicy::HandleStackOverflow+212
mscorwks!CLRVectoredExceptionHandler+3de1be
mscorwks!CLRVectoredExceptionHandlerShim+42
ntdll!RtlpCallVectoredHandlers+a8
ntdll!RtlDispatchException+22
ntdll!KiUserExceptionDispatch+2e
KERNELBASE!RaiseException+39
mscorwks!AllocateObject+34aeb1
mscorwks!MethodTable::FastBox+43
mscorwks!MethodTable::Box+5b
mscorwks!ReflectionEnum::InternalGetEnumValue+139
System.Enum.System.IConvertible.ToInt64(System.IFormatProvider)+b
System.Convert.ToInt64(System.Object, System.IFormatProvider)+35
System.Enum.ToUInt64(System.Object)+9d
System.Enum.IsDefined(System.Type, System.Object)+ff
Microsoft.Practices.ObjectBuilder.Locator.Get(System.Object, Microsoft.Practices.ObjectBuilder.SearchMode)+4d
Microsoft.Practices.ObjectBuilder.ReadableLocator.Get[[System.__Canon, mscorlib]](System.Object)+10
Microsoft.Practices.CompositeWeb.BuilderStrategies.SessionStateBindingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)+11f
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)+56
Microsoft.Practices.CompositeWeb.BuilderStrategies.SessionStateBindingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)+2be
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)+56
Microsoft.Practices.CompositeWeb.BuilderStrategies.SessionStateBindingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)+2be
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)+56
Microsoft.Practices.CompositeWeb.BuilderStrategies.SessionStateBindingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)+2be
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)+56
Microsoft.Practices.CompositeWeb.BuilderStrategies.SessionStateBindingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)+2be
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)+56
Microsoft.Practices.CompositeWeb.BuilderStrategies.SessionStateBindingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)+2be

<Trimmed>

Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)+56
Microsoft.Practices.CompositeWeb.BuilderStrategies.ContainerAwareTypeMappingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)+28e
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)+56
Microsoft.Practices.CompositeWeb.BuilderStrategies.ContainerAwareTypeMappingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)+28e
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)+56
Microsoft.Practices.CompositeWeb.BuilderStrategies.ContainerAwareTypeMappingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)+28e
Microsoft.Practices.CompositeWeb.ObjectBuilder.WCSFBuilderBase`1[[Microsoft.Practices.CompositeWeb.ObjectBuilder.WCSFBuilderStage, Microsoft.Practices.CompositeWeb]].DoBuildUp(Microsoft.Practices.ObjectBuilder.IReadWriteLocator, System.Type, System.String, System.Object, Microsoft.Practices.ObjectBuilder.PolicyList[])+13a
Microsoft.Practices.CompositeWeb.ObjectBuilder.WCSFBuilderBase`1[[Microsoft.Practices.CompositeWeb.ObjectBuilder.WCSFBuilderStage, Microsoft.Practices.CompositeWeb]].BuildUp(Microsoft.Practices.ObjectBuilder.IReadWriteLocator, System.Type, System.String, System.Object, Microsoft.Practices.ObjectBuilder.PolicyList[])+64
Microsoft.Practices.CompositeWeb.CompositionContainer.BuildItem(Microsoft.Practices.ObjectBuilder.IBuilder`1<Microsoft.Practices.CompositeWeb.ObjectBuilder.WCSFBuilderStage>, Microsoft.Practices.ObjectBuilder.IReadWriteLocator, System.Object)+334
Microsoft.Practices.CompositeWeb.WebClientApplication.BuildItemWithCurrentContext(System.Object)+121
Microsoft.Practices.CompositeWeb.Web.UI.UserControl.OnInit(System.EventArgs)+3f
System.Web.UI.Control.InitRecursive(System.Web.UI.Control)+8f
System.Web.UI.Control.InitRecursive(System.Web.UI.Control)+187
System.Web.UI.Control.InitRecursive(System.Web.UI.Control)+187
System.Web.UI.Control.InitRecursive(System.Web.UI.Control)+187
System.Web.UI.Control.AddedControl(System.Web.UI.Control, Int32)+10f
DevExpress.Web.ASPxTabControl.Internal.PCContentsControl.CreateControlHierarchy()+2ae
DevExpress.Web.ASPxClasses.ASPxWebControlBase.CreateChildControls()+33

<Trimmed>
System.Web.UI.Control.EnsureChildControls()+92
DevExpress.Web.ASPxClasses.ASPxWebControlBase.EnsureChildControls()+9
DevExpress.Web.ASPxClasses.ASPxWebControlBase.DevExpress.Web.ASPxClasses.Internal.IASPxWebControl.EnsureChildControls()+d
DevExpress.Web.ASPxClasses.Internal.RenderUtils.EnsureChildControlsRecursive(System.Web.UI.Control, Boolean)+3e
DevExpress.Web.ASPxClasses.Internal.RenderUtils.EnsureChildControlsRecursive(System.Web.UI.Control, Boolean)+d0
DevExpress.Web.ASPxClasses.ASPxWebControlBase.EnsureChildControlsRecursive(System.Web.UI.Control)+25
DevExpress.Web.ASPxClasses.ASPxWebControl.CreateChildControls()+166
System.Web.UI.Control.EnsureChildControls()+92
DevExpress.Web.ASPxClasses.ASPxWebControlBase.EnsureChildControls()+9
DevExpress.Web.ASPxClasses.ASPxWebControlBase.DevExpress.Web.ASPxClasses.Internal.IASPxWebControl.EnsureChildControls()+d
DevExpress.Web.ASPxClasses.Internal.RenderUtils.EnsureChildControlsRecursive(System.Web.UI.Control, Boolean)+3e
DevExpress.Web.ASPxClasses.Internal.RenderUtils.EnsureChildControlsRecursive(System.Web.UI.Control, Boolean)+d0
DevExpress.Web.ASPxClasses.ASPxWebControlBase.EnsureChildControlsRecursive(System.Web.UI.Control)+25
DevExpress.Web.ASPxClasses.ASPxWebControl.CreateChildControls()+166
System.Web.UI.Control.EnsureChildControls()+92
DevExpress.Web.ASPxClasses.ASPxWebControlBase.EnsureChildControls()+9
DevExpress.Web.ASPxClasses.ASPxWebControl.InitInternal()+48
DevExpress.Web.ASPxClasses.ASPxDataWebControlBase.OnInit(System.EventArgs)+1c
System.Web.UI.Control.InitRecursive(System.Web.UI.Control)+8f
System.Web.UI.Control.InitRecursive(System.Web.UI.Control)+187
System.Web.UI.Control.InitRecursive(System.Web.UI.Control)+187
System.Web.UI.Control.InitRecursive(System.Web.UI.Control)+187
System.Web.UI.Control.InitRecursive(System.Web.UI.Control)+187
System.Web.UI.Control.InitRecursive(System.Web.UI.Control)+187
System.Web.UI.Page.ProcessRequestMain(Boolean, Boolean)+5c5
System.Web.UI.Page.ProcessRequest(Boolean, Boolean)+a0
System.Web.UI.Page.ProcessRequest()+5b
System.Web.UI.Page.ProcessRequest(System.Web.HttpContext)+f0
ASP.xxxdashboards_recordlistview_aspx.ProcessRequest(System.Web.HttpContext)+9

我们在紧密的递归循环中看到以下代码,最终导致 StackOverflow 情况。

Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.CompositeWeb.BuilderStrategies.ContainerAwareTypeMappingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)
Microsoft.Practices.CompositeWeb.BuilderStrategies.ContainerAwareTypeMappingStrategy.BuildUp(Microsoft.Practices.ObjectBuilder.IBuilderContext, System.Type, System.Object, System.String)

此外,他们还添加了以下内容。
查看代码以查看无限循环,这似乎是
Microsoft_Practices_CompositeWeb!Microsoft.Practices.CompositeWeb.BuilderStrategies.SessionStateBindingStrategy 内部的情况

public override object BuildUp(IBuilderContext context, Type typeToBuild, object existing, string idToBuild)
{
    ISessionStateLocatorService service = context.Locator.(object);" href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://Microsoft.Practices.ObjectBuilder:1.0.51206.0:b03f5f7f11d50a3a/Microsoft.Practices.ObjectBuilder.IReadableLocator/Get<>(Object):"Get<ISessionStateLocatorService>(new DependencyResolutionLocatorKey(typeof(ISessionStateLocatorService), null));
    if (service != null)
    {
        IHttpSessionState sessionState = service.GetSessionState();
        foreach (FieldInfo info in typeToBuild.GetFields())
        {
            this.SetFieldValue(existing, info, sessionState);
        }
    }
    return base.BuildUp(context, typeToBuild, existing, idToBuild);
}

所以这会调用 Microsoft_Practices_ObjectBuilder!Microsoft.Practices.ObjectBuilder.BuilderStrategy 中定义的 BuildUp

public virtual object BuildUp(IBuilderContext context, Type typeToBuild, object existing, string idToBuild)
{
    IBuilderStrategy nextInChain = context.GetNextInChain(this);
    if (nextInChain != null)
    {
        return nextInChain.BuildUp(context, typeToBuild, existing, idToBuild);
    }
    return existing;
}

这导致无限循环。

---结束微软回复---

我们目前不确定在哪里寻找问题,如果有人可以帮助我们解决问题,我们将不胜感激。

4

1 回答 1

1

我遇到了与 IIS 崩溃和异常代码“0xc00000fd”类似的问题。我建议您捕获故障转储。

1) 安装软件以获取故障转储。我推荐DebugDiag 工具

2) 安装后,按照以下说明 配置DebugDiag Tool :

  • 选择崩溃规则 选择 IIS 应用程序池 (w3wp.exe)
  • 选择应用程序的应用程序池
  • 在高级设置/异常中配置堆栈溢出异常 (0xc00000fd) 并完成设置。

3) 等待在文件夹位置创建第一个故障转储。例如:C:\DebugDiag\Logs。创建故障转储后,使用DebugDiag 分析从 C:\DebugDiag\Logs 打开文件,然后将创建 HTML 报告。

4)在报告中,您可以在页面顶部的分析摘要中快速看到问题。就我而言,有一个没有停止条件的递归函数导致应用程序投票失败。

于 2015-03-02T22:09:43.580 回答