473,473 Members | 2,131 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Abnormal Thread Termination

I have a problem in my multithreaded application. The problem is reproducible
very rarely, only once in 6000 similar execution (through same code path).

Problem: One of multiple threads gets abnormally terminated. It does not
goes through the try-catch-finally sequence. The mehtod gets hanged and the
object used inside the method gets collected by GC.

Bacground about the application: I am using COM-Interop. The threads are
created in unmanaged code which calls methods from managed code. One of the
thread abnormally terminates when executing .NET method.

Observation: I have observed that the thread terminates only in those
methods where I am using IO Stream operation.

As I said this is very rare and the same code works fine except once or
twice in 6000 executions.

This is the code under which thread terminates mostly.

<CODE>

// I am generating log file for comments, to see the actual execution path
public string GetRequestFile(string strFileName)
{
// Log method enterd
StreamReader reader = null;
try
{
reader = new StreamReader(strFileName);
return reader.ReadToEnd();
}
catch(Exception exc)
{
// Log error occurred
throw;
}
finally
{
if(reader != null)
reader.Close();
// Log finally executed
}
}

<CODE>

Please let me know if there is any similar bug reported under .NET I/O
Stream operation.

Thanks in advance for your help.

Cheers,
Rahul Anand
Nov 17 '05 #1
2 2970
stop cross posting, you already got two replies in the other newsgroup. did
you check these solutions before posting here?

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
"Rahul Anand" <Ra********@discussions.microsoft.com> wrote in message
news:FB**********************************@microsof t.com...
I have a problem in my multithreaded application. The problem is
reproducible
very rarely, only once in 6000 similar execution (through same code path).

Problem: One of multiple threads gets abnormally terminated. It does not
goes through the try-catch-finally sequence. The mehtod gets hanged and
the
object used inside the method gets collected by GC.

Bacground about the application: I am using COM-Interop. The threads are
created in unmanaged code which calls methods from managed code. One of
the
thread abnormally terminates when executing .NET method.

Observation: I have observed that the thread terminates only in those
methods where I am using IO Stream operation.

As I said this is very rare and the same code works fine except once or
twice in 6000 executions.

This is the code under which thread terminates mostly.

<CODE>

// I am generating log file for comments, to see the actual execution path
public string GetRequestFile(string strFileName)
{
// Log method enterd
StreamReader reader = null;
try
{
reader = new StreamReader(strFileName);
return reader.ReadToEnd();
}
catch(Exception exc)
{
// Log error occurred
throw;
}
finally
{
if(reader != null)
reader.Close();
// Log finally executed
}
}

<CODE>

Please let me know if there is any similar bug reported under .NET I/O
Stream operation.

Thanks in advance for your help.

Cheers,
Rahul Anand

Nov 17 '05 #2
Hi Alvin,

I have posted my problem in this group and at the same time in other gorups
related to CLR and INTEROP as I was not sure where I can get a solution. And
the problem is related to C#, and HowThreading is Handled by CLR, and also
the scenario involves of COM-InterOP. Therefore I have posted my problem to
all related groups so that all related community will be benifitted with this
discussion.

Regards,
Rahul Anand

"Alvin Bruney [MVP - ASP.NET]" wrote:
stop cross posting, you already got two replies in the other newsgroup. did
you check these solutions before posting here?

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
"Rahul Anand" <Ra********@discussions.microsoft.com> wrote in message
news:FB**********************************@microsof t.com...
I have a problem in my multithreaded application. The problem is
reproducible
very rarely, only once in 6000 similar execution (through same code path).

Problem: One of multiple threads gets abnormally terminated. It does not
goes through the try-catch-finally sequence. The mehtod gets hanged and
the
object used inside the method gets collected by GC.

Bacground about the application: I am using COM-Interop. The threads are
created in unmanaged code which calls methods from managed code. One of
the
thread abnormally terminates when executing .NET method.

Observation: I have observed that the thread terminates only in those
methods where I am using IO Stream operation.

As I said this is very rare and the same code works fine except once or
twice in 6000 executions.

This is the code under which thread terminates mostly.

<CODE>

// I am generating log file for comments, to see the actual execution path
public string GetRequestFile(string strFileName)
{
// Log method enterd
StreamReader reader = null;
try
{
reader = new StreamReader(strFileName);
return reader.ReadToEnd();
}
catch(Exception exc)
{
// Log error occurred
throw;
}
finally
{
if(reader != null)
reader.Close();
// Log finally executed
}
}

<CODE>

Please let me know if there is any similar bug reported under .NET I/O
Stream operation.

Thanks in advance for your help.

Cheers,
Rahul Anand


Nov 17 '05 #3

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

Similar topics

2
by: John Pote | last post by:
Running my programme in Python 2.3.4 I received the following msg in the consol :- (Pent III running W2K prof) """ Exception in Tkinter callback Traceback (most recent call last): File...
1
by: R6_2003 | last post by:
Hello all, i dunno if that's the right newsgroup to ask, but i'll try, please ignore me if u feel its not 0:) i've been messing with a control panel app for so long.. previously i was using...
3
by: Mahmood Ahmad | last post by:
Hello, I have written a program that reads three types of records, validates them acording to certain requirements and writes the valid records into a binary file. The invalid records are...
2
by: Hugh | last post by:
Hello, Apologies if this has already been answered in here and I can't find it, but can anyone help with this problem? I hope the example code and comments state clearly enough what is...
0
by: Alexander F?hrmann | last post by:
Grüß euch! Wir haben hier in der Firma ein Problem mit Access! Sobald man im Access den VBA-Editor aufrufen will, kommt folgender fehler! -------------------- Runtime Error!
16
by: PyDenis | last post by:
Today, I found strange error while using py2exe: 1. I wrote simple program and save as 1.py: import win32ui import win32con win32ui.MessageBox('Test messageBox.' , 'Test', win32con.MB_OK |...
9
by: ehabaziz2001 | last post by:
I am facing that error message with no idea WHY the reason ? "Abnormal program termination" E:\programs\c_lang\iti01\tc201\ch06\ownarr01o01 Enter a number : 25 More numbers (y/n)? y...
6
by: helpswat4 | last post by:
I was wondering if someone could help me with this problem...i get a runtime error everytime i try to play Swat 4 on my PC.It says abnormal program termination and i have no idea why....could someone...
6
by: k3xji | last post by:
Hi all, Is there anyway to detect abnormal interpreter shutdown like (closing from task manager, power shutdown of the PC..etc)? Regards,
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.