简体   繁体   English

Windows Server 2003 Enterprise Edition Service Pack 2上的StackOverflowException

[英]StackOverflowException on Windows Server 2003 Enterprise Edition Service Pack 2

I have built a standalone console app that is throwing intermittent StackOverFlow exceptions only when installed on a Windows Server 2003 Enterprise Edition Service Pack 2 test machine. 我已经构建了一个独立的控制台应用程序,该应用程序仅在安装在Windows Server 2003 Enterprise Edition Service Pack 2测试计算机上时才会引发间歇性StackOverFlow异常。 The code is far too complex to post, but here are the details: 该代码过于复杂以至于无法发布,但以下是详细信息:
Source code is C# VS 2010. 源代码是C#VS 2010。
There are no recursive calls in the source code, but it does use a worker thread. 源代码中没有递归调用,但是它确实使用了工作线程。
The running process is not terminated when the StackOverflowException occurs. 发生StackOverflowException时,正在运行的进程不会终止。
When the exception occurs, it will consistently occur in the same location. 发生异常时,它将始终在同一位置发生。
When the exception occurs, it almost always occurs when the code is trying to initialize across a COM boundary ie: CAsset asset = new CAsset() where CAsset is a COM object written in C++. 当发生异常时,几乎总是在代码尝试跨COM边界进行初始化时发生,即:CAsset asset = new CAsset()其中,CAsset是用C ++编写的COM对象。
Replacing the direct initialization with a call to System.Activator.CreateInstance 通过调用System.Activator.CreateInstance代替直接初始化

            System.Type assetType = System.Type.GetTypeFromProgID("GDMTCommon.HansenAsset");
            object activated = System.Activator.CreateInstance(assetType);
            asset = activated as CHansenAsset;

does not solve the problem, but it does move the point of failure to a different location in the code. 不能解决问题,但是可以将故障点移到代码中的其他位置。 Also the above code does not throw an error, but the asset variable is null after the direct cast. 上面的代码也不会引发错误,但是直接转换后asset变量为null。 This instance is the one time that the failure does not occur on initializing a COM object. 此实例是一次初始化COM对象时不会发生故障的情况。
The most baffling behavior is that I can run the tool on two different sets of source data on the test machine, and for one set of source data the code will run to completion without error, on the other the code fails. 最令人困惑的行为是,我可以在测试计算机上的两组不同的源数据上运行该工具,对于一组源数据,代码将无错误地运行至完整,而另一组代码将失败。
I have installed the same tool on two different Windows 7 test machines and could not reproduce the error on either machine. 我已经安装在两个不同的Windows 7测试机器相同的工具,无法生育任一机器上的错误。 I also installed the tool on a Windows Server 2003 Standard Edition Service Pack 2 test machine and could not reproduce the error on that machine. 我还在Windows Server 2003 Standard Edition Service Pack 2测试计算机上安装了该工具,无法在该计算机上重现该错误。
Numerous searches have turned up a couple of other questions where code working on one OS starts throwing StackOverflowExceptions on when installed on Windows Server 2003 , but I did not see any definitive solutions. 大量搜索提出了其他一些问题,其中在一个操作系统上运行的代码在Windows Server 2003上安装时开始引发StackOverflowExceptions,但是我没有找到任何确定的解决方案。
I found this knowledge base article that seems to describe my problem: 我发现这篇知识库文章似乎描述了我的问题:
http://support.microsoft.com/kb/915750 http://support.microsoft.com/kb/915750
But according to the article, the problem is fixed in Service Pack 2 and I have verified that Service Pack 2 is installed on the test machine. 但是根据这篇文章,此问题已在Service Pack 2中修复,并且我已验证Service Pack 2已安装在测试计算机上。
Any assistance will be greatly appreciated. 任何帮助将不胜感激。
Regards, 问候,
Jay 周杰伦

Running Windows Update and applying all of the available updates to the machine resolved the stack overflow problems. 运行Windows Update并将所有可用更新应用于计算机可解决堆栈溢出问题。 Still unsure what was causing them in the first place. 仍然不确定到底是什么导致了他们。 Since this was a client machine that I did not have access to, I had to wait for them to apply the updates. 由于这是我无法访问的客户端计算机,因此我不得不等待他们应用更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM