Solved

Current thread is in a stack overflow state - random occurence

Posted on 2010-09-02
2
815 Views
Last Modified: 2012-05-10
Experts,
Here's my issue:
I have an ASP.Net 2.0 application running on an XP sp3 development laptop (Pentium M 1.86GHz 2GB RAM) using an SQL Server 2000 database and the IDE is VS2008.  This laptop has been used for 3 years and all software is up to date.  The application runs without any issues on this laptop and there are no issues within VS2008...the application builds normally, no warnings or errors on build, and has been running in production (Windows 2003 server) for nearly 4 years.

Recently I began testing the application on a new laptop (i7-720QM Quad Core 1.60GHz 6MB 4GB RAM) running Windows 7 Ultimate, SQL Server 2005, and VS2008 targeting the 2.0 framework.  The application builds without errors or warnings in the IDE and runs as expected on the laptop or when being debugged except:

- One page that is large (35,000+ lines of code) and produces a complex cost report is generating a "Cannot evaluate expression because the current thread is in a stack overflow state" error.  The error occurs at different locations in the code even though the same data queries are being used to produce the report.  Commenting out sections of the report only moves the error to another location!  If enough code is commented out the page runs without error...and it doesn't seem to matter which code is commented out.  If no code is commented out the error often occurs before the Page_Load event or just after the event begins.

Considering the application runs without problems on the XP laptop I have to think there is something going on with the new laptop's architecture...what I don't know and I'm not sure how to isolate this issue.

Any thoughts?
Thanks!

0
Comment
Question by:heathde
2 Comments
 
LVL 3

Accepted Solution

by:
Peter_Werner earned 500 total points
ID: 33590432
I can imagine that the new OS has has a new API that uses more stack and that is enough to overflow the stack of your threads. Unfortunately you can't configure the default thread size. It is possible by some binary hacking and disabling system file protection, but that is hardcore hackery.

You could review your code and try to replace bigger local variables by global ones, but I can imagine it's not quite possible.

Another way is to create some wrapper code and roll your own threads.  If you create a thread you can specify the stack size.  http://support.microsoft.com/kb/932909

Another approach is to investigate the stack usage by Sysinternal's Process explorer
(check the stack usage in the working environment and in the crashing one).
http://support.microsoft.com/kb/932909
0
 

Author Comment

by:heathde
ID: 33591551
Peter,
Thanks for the quick response and direction...the page does contain several large local arrays which may be the problem.  I didn't think stack size would be an issue on the new laptop but having read some stuff related to your post I can see that you might be right.  I'll look over the code and see what changes I can make.
Thanks!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
A quick guide on how to use Group Policy to create a custom power plan and set it active on Windows 7.
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question