473,396 Members | 1,725 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Multi Threaded App - Stack Trace Error

I have a multi threaded app that runs fine 99 percent of the time. However,
sporadically, I receive error {Cannot evaluate expression because the
current thread is in a stack overflow state.} at different spots in the
code. Random lines of code seem to generate this error, never the same line
twice so far. The threading is defined like so... I'm hoping that there may
be a way to accomplish the same threading and without generating this
sporadic error... Any thoughts would be greatly appreciated. I have removed
most code for readability.

public partial class Form1 : Form
{
private LH[] LA;
LH lh = new LH();

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
int iF = 0;
int iT = 7;

LA = new LH[iT - iF + 1];

for (int iTr = iF; iTr <= iT; iTr++)
{
LH L = new LH();
LA[iTr - iF] = L;
L.iTr = iTr;
ThreadStart ts = new ThreadStart(L.ProcessingThread);
Thread wrkThread = new Thread(ts);
wrkThread.SetApartmentState(ApartmentState.STA);
wrkThread.Name = iTr.ToString();
wrkThread.Start();
}
return;
}

public class LH
{
static readonly object countLock = new object();

public void ProcessingThread()
{
try
{
lock (countLock)
{
//
}
}
catch (COMException e)
{
//
}
catch (Exception e)
{
//
}

Application.Run();

GC.Collect();
GC.WaitForPendingFinalizers();
}

}


Apr 24 '07 #1
1 3331
Hey,

Just out of curiosity did you deliberately try and obfuscate certain
class and variables names, or do you actually have variables like 'iF',
'iT' and 'L' and classes like 'LH'?

e.g.
int iF = 0;
int iT = 7;

LA = new LH[iT - iF + 1];

for (int iTr = iF; iTr <= iT; iTr++)
{
LH L = new LH();
LA[iTr - iF] = L;
L.iTr = iTr;

Just curious...

Thanks

'S'
May 30 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Lane LiaBraaten | last post by:
I am working on an app that uses the threading module and Queue.Queue(s) for communicating between the threads. Everything was working on Linux (Redhat 7.3) but when I tried it on WinNT 4.0 it...
0
by: Atul Kshirsagar | last post by:
I am embedding python in my C++ application. I am using Python *2.3.2* with a C++ extention DLL in multi-threaded environment. I am using SWIG-1.3.19 to generate C++ to Python interface. Now to...
7
by: Andy Fish | last post by:
Hi, in my c# code I have something like this: try { ... } catch (Exception ex) { ... throw ex; }
4
by: Mark Fletcher | last post by:
Hi, Im in the process of writing a program that crawls a website. Im using the HttpWebRequest and HttpWebResponse classed to get content. To make my application more scalable, my application is...
5
by: Rob Durant | last post by:
Hi, I have a multi-threaded application (have also tried as service - same behaviour) that runs fine on XP, but not on 2003. Symptoms are: Threads are started normally, locks acquired and...
3
by: Jeremy | last post by:
While working with ASP.NET I've sometimes encountered errors in my applications, but I've always known exactly why I'm getting the error and have been able to fix it. So I've never needed to...
9
by: Stu | last post by:
Hi, I have a web service that does database access and calculations However it keeps falling over becuase its not multi threaded and each call to it is not in its own space!! I dont want to use...
2
by: Noah | last post by:
I'm trying to use the trace module to build coverage files for a multi-threaded program. http://docs.python.org/lib/module-trace.html I test my application using trace.py from the command-line...
6
by: dbuchanan | last post by:
There are three parts to this 1.) How do I cascade menus? 2.) And, how do I cascade menus with a multi-select CheckBoxList?
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.