Showing posts with label running. Show all posts
Showing posts with label running. Show all posts

Saturday, March 31, 2012

There is already an open DataReader associated with this Connection

I have an ASP .NET application. [VS 2002, .NET Framework 1.0 SP2]

In the application, if I execute a long running query (which may time
out or something I guess) from one browser window, and in another
instance of the same web application in another browser window,
execute a very quick query, I get the above error message.

I have noted the fix at:
http://support.microsoft.com/defaul...b;en-us;Q319345

But I already have Service Pack 2 installed. Please help!

Thanks in Advance
Jamesbug in your code.

you probably have a connection defined a static variable (shared or public
in a module in vb.net). this would lead to the same connection being used by
all page requests (even concurrent), and as a connection only supports one
active query at a time, you get this error.

-- bruce (sqlwork.com)

"James Brown" <jbrown_gtfc@.hotmail.com> wrote in message
news:7a947814.0306260125.6425510a@.posting.google.c om...
> I have an ASP .NET application. [VS 2002, .NET Framework 1.0 SP2]
> In the application, if I execute a long running query (which may time
> out or something I guess) from one browser window, and in another
> instance of the same web application in another browser window,
> execute a very quick query, I get the above error message.
> I have noted the fix at:
> http://support.microsoft.com/defaul...b;en-us;Q319345
> But I already have Service Pack 2 installed. Please help!
> Thanks in Advance
> James

Monday, March 26, 2012

This is a basic overall question. Please note I am new

This is a basic overall question. Please note I am new
to ASP!
I am currently running IIS 5/Access 2000/Windows 2000 and
have developed a web application.

>From what I have been told, to really emulate a
master/detail form, the best way would be to use ASP.net
to do so.
1. is that true?
2. if so, does ASP.net run against Access or SQLServer?
3. what would I need to purchase to emulate this?
Thank you for your help.
Chow Wai<hkhellhkhell@.hotmail.com> wrote in message
news:1159516927.801834.168640@.i3g2000cwc.googlegroups.com...
> This is a basic overall question. Please note I am new
> to ASP!
> I am currently running IIS 5/Access 2000/Windows 2000 and
> have developed a web application.
>
> master/detail form, the best way would be to use ASP.net
> to do so.
> 1. is that true?
It is easy with a GridView and DetailsView, so if easy is your criteria for
best, then I would say yes.

> 2. if so, does ASP.net run against Access or SQLServer?
Both.

> 3. what would I need to purchase to emulate this?
Visual Studio, but you can download the free versions to get started:
http://msdn.microsoft.com/vstudio/express/default.aspx
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
****************************************
*********
Think outside of the box!
****************************************
*********
If you have .NET 2.0 (Visual Studio 2005) master forms are supported by
default on it and are basically effortless to implement... ASP.NET can run
against any OLEDB or ODBC database provider or SQL Server Client, as long as
you have the provider installed on the host system (OLEDB Drivers, or ODBC
drivers)
<hkhellhkhell@.hotmail.com> wrote in message
news:1159516927.801834.168640@.i3g2000cwc.googlegroups.com...
> This is a basic overall question. Please note I am new
> to ASP!
> I am currently running IIS 5/Access 2000/Windows 2000 and
> have developed a web application.
>
> master/detail form, the best way would be to use ASP.net
> to do so.
> 1. is that true?
> 2. if so, does ASP.net run against Access or SQLServer?
> 3. what would I need to purchase to emulate this?
> Thank you for your help.
> Chow Wai
>

This is a basic overall question. Please note I am new

This is a basic overall question. Please note I am new
to ASP!

I am currently running IIS 5/Access 2000/Windows 2000 and
have developed a web application.

Quote:

Originally Posted by

>From what I have been told, to really emulate a


master/detail form, the best way would be to use ASP.net
to do so.

1. is that true?
2. if so, does ASP.net run against Access or SQLServer?
3. what would I need to purchase to emulate this?

Thank you for your help.

Chow Waihkhellhkhell@.hotmail.com wrote:

Quote:

Originally Posted by

This is a basic overall question. Please note I am new
to ASP!
>


Hi, Chow.

Quote:

Originally Posted by

I am currently running IIS 5/Access 2000/Windows 2000 and
have developed a web application.
>

Quote:

Originally Posted by

From what I have been told, to really emulate a


master/detail form, the best way would be to use ASP.net
to do so.
>


ASP.Net has some really nice features for beginners. If you have a copy
of Visual Web Developer Express
[http://msdn.microsoft.com/vstudio/express/vwd/] you can very quickly
put together a web app without any real need for custom programming.

Have a look at the samples here
[http://msdn2.microsoft.com/en-us/library/stc0szde.asp]

Quote:

Originally Posted by

1. is that true?


It's definitely a pretty good way, and if you're happy with the
defaults provided by Microsoft, you can do it really REALLY easily.

Quote:

Originally Posted by

2. if so, does ASP.net run against Access or SQLServer?


Yes. And Oracle, and MySql, and flat text files if you're so inclined.

Quote:

Originally Posted by

3. what would I need to purchase to emulate this?
>


Nothing! If you've already got Access, that will do nicely as a
database for playing around with. ASP.Net has classes for communicating
with Access out of the box, so you shouldn't have any problems.

Quote:

Originally Posted by

Thank you for your help.
>


One thing, you mention that you've already developed a web
application... waht have you developed, what have you written it in,
and why are you considering ASP.Net to run just a small part of it? Or
have I misunderstood?

Quote:

Originally Posted by

Chow Wai


Scott Mitchell has written some excellent ASP.NET tutorials that
demonstrate how to build master/detail pages:

http://www.asp.net/learn/dataaccess...tabid=63#master
hkhellhkhell@.hotmail.com wrote:

Quote:

Originally Posted by

This is a basic overall question. Please note I am new
to ASP!
>
I am currently running IIS 5/Access 2000/Windows 2000 and
have developed a web application.
>

Quote:

Originally Posted by

From what I have been told, to really emulate a


master/detail form, the best way would be to use ASP.net
to do so.
>
1. is that true?
2. if so, does ASP.net run against Access or SQLServer?
3. what would I need to purchase to emulate this?
>
Thank you for your help.
>
Chow Wai


<hkhellhkhell@.hotmail.comwrote in message
news:1159516927.801834.168640@.i3g2000cwc.googlegro ups.com...

Quote:

Originally Posted by

This is a basic overall question. Please note I am new
to ASP!
>
I am currently running IIS 5/Access 2000/Windows 2000 and
have developed a web application.
>

Quote:

Originally Posted by

>>From what I have been told, to really emulate a


master/detail form, the best way would be to use ASP.net
to do so.
>
1. is that true?


It is easy with a GridView and DetailsView, so if easy is your criteria for
best, then I would say yes.

Quote:

Originally Posted by

2. if so, does ASP.net run against Access or SQLServer?


Both.

Quote:

Originally Posted by

3. what would I need to purchase to emulate this?


Visual Studio, but you can download the free versions to get started:
http://msdn.microsoft.com/vstudio/express/default.aspx
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
*************************************************
Think outside of the box!
*************************************************
If you have .NET 2.0 (Visual Studio 2005) master forms are supported by
default on it and are basically effortless to implement... ASP.NET can run
against any OLEDB or ODBC database provider or SQL Server Client, as long as
you have the provider installed on the host system (OLEDB Drivers, or ODBC
drivers)

<hkhellhkhell@.hotmail.comwrote in message
news:1159516927.801834.168640@.i3g2000cwc.googlegro ups.com...

Quote:

Originally Posted by

This is a basic overall question. Please note I am new
to ASP!
>
I am currently running IIS 5/Access 2000/Windows 2000 and
have developed a web application.
>

Quote:

Originally Posted by

>>From what I have been told, to really emulate a


master/detail form, the best way would be to use ASP.net
to do so.
>
1. is that true?
2. if so, does ASP.net run against Access or SQLServer?
3. what would I need to purchase to emulate this?
>
Thank you for your help.
>
Chow Wai
>

Saturday, March 24, 2012

this trouble me a long time :(

Hi,

I developed some applications in asp & asp.net and running together under iis5.
I found they have own set of variables each of them, that is to say, they cannot pass a variable between the asp and asp.net applications.

i.e.
I set a session in asp: session("counter") = 100
I cannot get its value in asp.net by: session["counter"] because "counter" not be given.

I do wanna exchange information between them, but how can I? Any good idea?

thanksSession sharing between ASP and ASP.NET

Remember, Google knows all.

This type of page is not served.

I am beginning to create my first .net website and am running into a problem. Google provided little help. I tried to access an .asp file within one of my subfolders and am receiving the following error:


This type of page is not served.


Description: The type of page you have requested is not served because it has been explicitly forbidden. The extension '.asp' may be incorrect. Please review the URL below and make sure that it is spelled correctly.

Is it possible to change the web.config or machine.config file to allow access to an .asp page? I'm new to .Net 2.0.

Thanks!

Hi,

do you use windows server 2003 in combination with IIS6? If so you need to know that IIS6, by default, has the settings set to off for serving ASP.NET or classic ASP pages.

Besides that, ASP.NET webforms need to have the extension .aspx, not .asp. This is needed to have IIS use the correct ISAPI filters.

Grz, Kris.


Yes, I'm on a win2003 server with IIS 6. What I'm basically trying to accomplish is create a 2.0 login system to replace our current system. We currently have a lot of sites written in classic asp and a few newer sites written in .NET 2.0. So what I have done is set up a test and everything works well, until I try to access an .asp page inside of one of our sites. I know that webforms need the .aspx extension, but am unsure of how to configure ISAPI or httphandlers to allow the execution of .asp pages. A general diagram of our system is below:

Our_Portal -- main folder, has 2.0 login features with links to the following subfolders/sites

Site_A -- .NET 2.0 site

Site_B -- classic ASP

Site_C -- classic ASP

When I try to access sites B and C, I get the "cannot serve pages" error. Is this more clear?

Thursday, March 22, 2012

Thread just stops running

I have noticed how the thread I created just stops running. I have added
several exceptions to the thread
System.Threading.SynchronizationLockException
System.Threading.ThreadAbortException
System.Threading.ThreadInterruptedException
System.Threading.ThreadStateException
to see if I could get more information about why the thread stops running
but that code is never executed. Any ideas on how I can debug this?
Thanks in advance.You need to provide more context than this if you want the problem to be
solved
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
----
"mareal" <m@.m.com> wrote in message
news:39C9F5D2-4988-4F95-A4C3-3EBF68E773FD@.microsoft.com...
>I have noticed how the thread I created just stops running. I have added
> several exceptions to the thread
> System.Threading.SynchronizationLockException
> System.Threading.ThreadAbortException
> System.Threading.ThreadInterruptedException
> System.Threading.ThreadStateException
> to see if I could get more information about why the thread stops running
> but that code is never executed. Any ideas on how I can debug this?
> Thanks in advance.
>
A thread stops running as soon as its parent thread stops running.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
What You S Is What You Get.
"mareal" <m@.m.com> wrote in message
news:39C9F5D2-4988-4F95-A4C3-3EBF68E773FD@.microsoft.com...
>I have noticed how the thread I created just stops running. I have added
> several exceptions to the thread
> System.Threading.SynchronizationLockException
> System.Threading.ThreadAbortException
> System.Threading.ThreadInterruptedException
> System.Threading.ThreadStateException
> to see if I could get more information about why the thread stops running
> but that code is never executed. Any ideas on how I can debug this?
> Thanks in advance.
>
Thanks Kevin. The parent thread (as I understand it) is the aspnet_wp proces
s
and as far I can tell, it is still running. The reason why I am saying this
is because I can access other ASP.NET applications on the same server. I hav
e
also checked the event log and I don't aspnet_wp being recycled. What am I
missing?
"Kevin Spencer" wrote:

> A thread stops running as soon as its parent thread stops running.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> ..Net Developer
> What You S Is What You Get.
> "mareal" <m@.m.com> wrote in message
> news:39C9F5D2-4988-4F95-A4C3-3EBF68E773FD@.microsoft.com...
>
>
what is the looping structure in your thread? are you sure you are catching
all errors? what is its normal exit trigger?
if you code it correctly a thread will run the life of the appdomain its
created in.
-- bruce (sqlwork.com)
"mareal" <m@.m.com> wrote in message
news:E860CABF-18CE-4099-B44C-CB844EE57925@.microsoft.com...
| Thanks Kevin. The parent thread (as I understand it) is the aspnet_wp
process
| and as far I can tell, it is still running. The reason why I am saying
this
| is because I can access other ASP.NET applications on the same server. I
have
| also checked the event log and I don't aspnet_wp being recycled. What am I
| missing?
|
| "Kevin Spencer" wrote:
|
| > A thread stops running as soon as its parent thread stops running.
| >
| > --
| > HTH,
| >
| > Kevin Spencer
| > Microsoft MVP
| > ..Net Developer
| > What You S Is What You Get.
| >
| > "mareal" <m@.m.com> wrote in message
| > news:39C9F5D2-4988-4F95-A4C3-3EBF68E773FD@.microsoft.com...
| > >I have noticed how the thread I created just stops running. I have
added
| > > several exceptions to the thread
| > >
| > > System.Threading.SynchronizationLockException
| > > System.Threading.ThreadAbortException
| > > System.Threading.ThreadInterruptedException
| > > System.Threading.ThreadStateException
| > >
| > > to see if I could get more information about why the thread stops
running
| > > but that code is never executed. Any ideas on how I can debug this?
| > >
| > > Thanks in advance.
| > >
| >
| >
| >
Hello Bruce. I am sure I am catching all errors:
System.Threading.SynchronizationLockException
System.Threading.ThreadAbortException
System.Threading.ThreadInterruptedException
System.Threading.ThreadStateException
System.Exception
The looping structure is a
While True
... (local code)
... Call another method
... (+ local code)
End While
I have not added an exit trigger yet. I wanted to fix this problem first.
"bruce barker" wrote:

> what is the looping structure in your thread? are you sure you are catchin
g
> all errors? what is its normal exit trigger?
> if you code it correctly a thread will run the life of the appdomain its
> created in.
> -- bruce (sqlwork.com)
>
>
> "mareal" <m@.m.com> wrote in message
> news:E860CABF-18CE-4099-B44C-CB844EE57925@.microsoft.com...
> | Thanks Kevin. The parent thread (as I understand it) is the aspnet_wp
> process
> | and as far I can tell, it is still running. The reason why I am saying
> this
> | is because I can access other ASP.NET applications on the same server. I
> have
> | also checked the event log and I don't aspnet_wp being recycled. What am
I
> | missing?
> |
> | "Kevin Spencer" wrote:
> |
> | > A thread stops running as soon as its parent thread stops running.
> | >
> | > --
> | > HTH,
> | >
> | > Kevin Spencer
> | > Microsoft MVP
> | > ..Net Developer
> | > What You S Is What You Get.
> | >
> | > "mareal" <m@.m.com> wrote in message
> | > news:39C9F5D2-4988-4F95-A4C3-3EBF68E773FD@.microsoft.com...
> | > >I have noticed how the thread I created just stops running. I have
> added
> | > > several exceptions to the thread
> | > >
> | > > System.Threading.SynchronizationLockException
> | > > System.Threading.ThreadAbortException
> | > > System.Threading.ThreadInterruptedException
> | > > System.Threading.ThreadStateException
> | > >
> | > > to see if I could get more information about why the thread stops
> running
> | > > but that code is never executed. Any ideas on how I can debug this?
> | > >
> | > > Thanks in advance.
> | > >
> | >
> | >
> | >
>
>
then try
while true
try
.. your thread code
catch
try
log error
catch
. can't log
end try
end try
end while
note: your thread will be running with the asp.net worker process id, and
will have limited permissions.
-- bruce (sqlwork.com)
"mareal" <m@.m.com> wrote in message
news:6D2FC2CE-2FC8-40C9-A073-A02C859511F4@.microsoft.com...
| Hello Bruce. I am sure I am catching all errors:
|
| System.Threading.SynchronizationLockException
| System.Threading.ThreadAbortException
| System.Threading.ThreadInterruptedException
| System.Threading.ThreadStateException
| System.Exception
|
| The looping structure is a
|
| While True
| ... (local code)
| ... Call another method
| ... (+ local code)
| End While
|
| I have not added an exit trigger yet. I wanted to fix this problem first.
|
|
| "bruce barker" wrote:
|
| > what is the looping structure in your thread? are you sure you are
catching
| > all errors? what is its normal exit trigger?
| >
| > if you code it correctly a thread will run the life of the appdomain
its
| > created in.
| >
| > -- bruce (sqlwork.com)
| >
| >
| >
| >
| >
| > "mareal" <m@.m.com> wrote in message
| > news:E860CABF-18CE-4099-B44C-CB844EE57925@.microsoft.com...
| > | Thanks Kevin. The parent thread (as I understand it) is the aspnet_wp
| > process
| > | and as far I can tell, it is still running. The reason why I am saying
| > this
| > | is because I can access other ASP.NET applications on the same server.
I
| > have
| > | also checked the event log and I don't aspnet_wp being recycled. What
am I
| > | missing?
| > |
| > | "Kevin Spencer" wrote:
| > |
| > | > A thread stops running as soon as its parent thread stops running.
| > | >
| > | > --
| > | > HTH,
| > | >
| > | > Kevin Spencer
| > | > Microsoft MVP
| > | > ..Net Developer
| > | > What You S Is What You Get.
| > | >
| > | > "mareal" <m@.m.com> wrote in message
| > | > news:39C9F5D2-4988-4F95-A4C3-3EBF68E773FD@.microsoft.com...
| > | > >I have noticed how the thread I created just stops running. I have
| > added
| > | > > several exceptions to the thread
| > | > >
| > | > > System.Threading.SynchronizationLockException
| > | > > System.Threading.ThreadAbortException
| > | > > System.Threading.ThreadInterruptedException
| > | > > System.Threading.ThreadStateException
| > | > >
| > | > > to see if I could get more information about why the thread stops
| > running
| > | > > but that code is never executed. Any ideas on how I can debug
this?
| > | > >
| > | > > Thanks in advance.
| > | > >
| > | >
| > | >
| > | >
| >
| >
| >
Hello Bruce and thank you for your suggestion. I did what you told me and
unfortunately nothing changed. I can still see one thread (I only created
two) dying. Look at the log I am outputting:
The entry at the bottom represents me stopping the aspnet_wp.exe process.
Then you will thread 1 and 2. Around 8:37:04 is when thread 0 died...
DATE,TIME,EVENT CONTENT
3/9/2005,8:38:49 AM,Thread ID# 1;
3/9/2005,8:38:46 AM,Thread ID# 1;
3/9/2005,8:38:42 AM,Thread ID# 1;
3/9/2005,8:38:39 AM,Thread ID# 1;
3/9/2005,8:38:36 AM,Thread ID# 1;
3/9/2005,8:38:33 AM,Thread ID# 1;
3/9/2005,8:38:30 AM,Thread ID# 1;
3/9/2005,8:38:27 AM,Thread ID# 1;
3/9/2005,8:38:24 AM,Thread ID# 1;
3/9/2005,8:38:20 AM,Thread ID# 1;
3/9/2005,8:38:17 AM,Thread ID# 1;
3/9/2005,8:38:14 AM,Thread ID# 1;
3/9/2005,8:38:11 AM,Thread ID# 1;
3/9/2005,8:38:08 AM,Thread ID# 1;
3/9/2005,8:38:05 AM,Thread ID# 1;
3/9/2005,8:38:02 AM,Thread ID# 1;
3/9/2005,8:37:58 AM,Thread ID# 1;
3/9/2005,8:37:55 AM,Thread ID# 1;
3/9/2005,8:37:52 AM,Thread ID# 1;
3/9/2005,8:37:49 AM,Thread ID# 1;
3/9/2005,8:37:46 AM,Thread ID# 1;
3/9/2005,8:37:42 AM,Thread ID# 1;
3/9/2005,8:37:39 AM,Thread ID# 1;
3/9/2005,8:37:36 AM,Thread ID# 1;
3/9/2005,8:37:33 AM,Thread ID# 1;
3/9/2005,8:37:30 AM,Thread ID# 1;
3/9/2005,8:37:27 AM,Thread ID# 1;
3/9/2005,8:37:24 AM,Thread ID# 1;
3/9/2005,8:37:21 AM,Thread ID# 1;
3/9/2005,8:37:17 AM,Thread ID# 1;
3/9/2005,8:37:14 AM,Thread ID# 1;
3/9/2005,8:37:11 AM,Thread ID# 1;
3/9/2005,8:37:08 AM,Thread ID# 1;
3/9/2005,8:37:04 AM,Thread ID# 1;
3/9/2005,8:37:04 AM,Thread ID# 0;
3/9/2005,8:37:01 AM,Thread ID# 1;
3/9/2005,8:37:01 AM,Thread ID# 0;
3/9/2005,8:36:58 AM,Thread ID# 1;
3/9/2005,8:36:58 AM,Thread ID# 0;
3/9/2005,8:36:55 AM,Thread ID# 1;
3/9/2005,8:36:54 AM,Thread ID# 0;
3/9/2005,8:36:52 AM,Thread ID# 1;
3/9/2005,8:36:51 AM,Thread ID# 0;
3/9/2005,8:36:49 AM,Thread ID# 1;
3/9/2005,8:36:48 AM,Thread ID# 0;
3/9/2005,8:36:45 AM,Thread ID# 1;
3/9/2005,8:36:45 AM,Thread ID# 0;
3/9/2005,8:36:42 AM,Thread ID# 0;
3/9/2005,8:36:42 AM,Thread ID# 1;
3/9/2005,8:36:39 AM,Thread ID# 0;
3/9/2005,8:36:39 AM,Thread ID# 1;
3/9/2005,8:36:36 AM,Thread ID# 1;
3/9/2005,8:36:33 AM,Thread ID# 1;
3/9/2005,8:36:30 AM,Thread ID# 1;
3/9/2005,8:36:27 AM,Thread ID# 1;
3/9/2005,8:36:26 AM,Thread ID# 0;
3/9/2005,8:36:23 AM,Thread ID# 1;
3/9/2005,8:36:22 AM,Thread ID# 0;
3/9/2005,8:36:20 AM,Thread ID# 1;
3/9/2005,8:36:18 AM,Thread ID# 0;
3/9/2005,8:36:17 AM,Thread ID# 1;
3/9/2005,8:36:14 AM,Thread ID# 0;
3/9/2005,8:36:14 AM,Thread ID# 1;
3/9/2005,8:36:10 AM,Thread ID# 1;
3/9/2005,8:36:10 AM,Thread ID# 0;
3/9/2005,8:36:07 AM,Thread ID# 1;
3/9/2005,8:36:06 AM,Thread ID# 0;
3/9/2005,8:36:04 AM,Thread ID# 1;
3/9/2005,8:36:02 AM,Thread ID# 0;
3/9/2005,8:36:01 AM,Thread ID# 1;
3/9/2005,8:35:58 AM,Thread ID# 0;
3/9/2005,8:35:57 AM,Thread ID# 1;
3/9/2005,8:35:54 AM,Thread ID# 1;
3/9/2005,8:35:54 AM,Thread ID# 0;
3/9/2005,8:35:51 AM,Thread ID# 1;
3/9/2005,8:35:50 AM,Thread ID# 0;
3/9/2005,8:35:48 AM,Thread ID# 1;
3/9/2005,8:35:46 AM,Thread ID# 0;
3/9/2005,8:35:45 AM,Thread ID# 1;
3/9/2005,8:35:43 AM,Thread ID# 0;
3/9/2005,8:35:42 AM,Thread ID# 1;
3/9/2005,8:35:40 AM,Thread ID# 0;
3/9/2005,8:35:38 AM,Thread ID# 1;
3/9/2005,8:35:37 AM,Thread ID# 0;
3/9/2005,8:35:35 AM,Thread ID# 1;
3/9/2005,8:35:34 AM,Thread ID# 0;
3/9/2005,8:35:32 AM,Thread ID# 1;
3/9/2005,8:35:31 AM,Thread ID# 0;
3/9/2005,8:35:29 AM,Thread ID# 1;
3/9/2005,8:35:28 AM,Thread ID# 0;
3/9/2005,8:35:26 AM,Thread ID# 1;
3/9/2005,8:35:25 AM,Thread ID# 0;
3/9/2005,8:35:23 AM,Thread ID# 1;
3/9/2005,8:35:21 AM,Thread ID# 0;
3/9/2005,8:35:20 AM,Thread ID# 1;
3/9/2005,8:35:18 AM,Thread ID# 0;
3/9/2005,8:35:16 AM,Thread ID# 1;
3/9/2005,8:35:15 AM,Thread ID# 0;
3/9/2005,8:35:13 AM,Thread ID# 1;
3/9/2005,8:35:12 AM,Thread ID# 0;
3/9/2005,8:35:10 AM,Thread ID# 1;
3/9/2005,8:35:09 AM,Thread ID# 0;
3/9/2005,8:35:07 AM,Thread ID# 1;
3/9/2005,8:35:06 AM,Thread ID# 0;
3/9/2005,8:35:03 AM,Thread ID# 1;
3/9/2005,8:35:03 AM,Thread ID# 0;
3/9/2005,8:35:00 AM,Thread ID# 1;
3/9/2005,8:35:00 AM,Thread ID# 0;
3/9/2005,8:34:57 AM,Thread ID# 1;
3/9/2005,8:34:57 AM,Thread ID# 0;
3/9/2005,8:34:54 AM,Thread ID# 1;
3/9/2005,8:34:54 AM,Thread ID# 0;
3/9/2005,8:34:51 AM,Thread ID# 1;
3/9/2005,8:34:51 AM,Thread ID# 0;
3/9/2005,8:34:48 AM,Thread ID# 1;
3/9/2005,8:34:48 AM,Thread ID# 0;
3/9/2005,8:34:45 AM,Thread ID# 1;
3/9/2005,8:34:45 AM,Thread ID# 0;
3/9/2005,8:34:42 AM,Thread ID# 1;
3/9/2005,8:34:41 AM,Thread ID# 0;
3/9/2005,8:34:38 AM,Thread ID# 1;
3/9/2005,8:34:38 AM,Thread ID# 0;
3/9/2005,8:34:23 AM,ASP.NET 1.1.4322.0,Error,1000,N/A,aspnet_wp.exe (PID:
3796) stopped unexpectedly.
"bruce barker" wrote:

> then try
> while true
> try
> ... your thread code
> catch
> try
> log error
> catch
> .. can't log
> end try
> end try
> end while
> note: your thread will be running with the asp.net worker process id, and
> will have limited permissions.
> -- bruce (sqlwork.com)
> "mareal" <m@.m.com> wrote in message
> news:6D2FC2CE-2FC8-40C9-A073-A02C859511F4@.microsoft.com...
> | Hello Bruce. I am sure I am catching all errors:
> |
> | System.Threading.SynchronizationLockException
> | System.Threading.ThreadAbortException
> | System.Threading.ThreadInterruptedException
> | System.Threading.ThreadStateException
> | System.Exception
> |
> | The looping structure is a
> |
> | While True
> | ... (local code)
> | ... Call another method
> | ... (+ local code)
> | End While
> |
> | I have not added an exit trigger yet. I wanted to fix this problem first
.
> |
> |
> | "bruce barker" wrote:
> |
> | > what is the looping structure in your thread? are you sure you are
> catching
> | > all errors? what is its normal exit trigger?
> | >
> | > if you code it correctly a thread will run the life of the appdomain
> its
> | > created in.
> | >
> | > -- bruce (sqlwork.com)
> | >
> | >
> | >
> | >
> | >
> | > "mareal" <m@.m.com> wrote in message
> | > news:E860CABF-18CE-4099-B44C-CB844EE57925@.microsoft.com...
> | > | Thanks Kevin. The parent thread (as I understand it) is the aspnet_w
p
> | > process
> | > | and as far I can tell, it is still running. The reason why I am sayi
ng
> | > this
> | > | is because I can access other ASP.NET applications on the same serve
r.
> I
> | > have
> | > | also checked the event log and I don't aspnet_wp being recycled. Wha
t
> am I
> | > | missing?
> | > |
> | > | "Kevin Spencer" wrote:
> | > |
> | > | > A thread stops running as soon as its parent thread stops running.
> | > | >
> | > | > --
> | > | > HTH,
> | > | >
> | > | > Kevin Spencer
> | > | > Microsoft MVP
> | > | > ..Net Developer
> | > | > What You S Is What You Get.
> | > | >
> | > | > "mareal" <m@.m.com> wrote in message
> | > | > news:39C9F5D2-4988-4F95-A4C3-3EBF68E773FD@.microsoft.com...
> | > | > >I have noticed how the thread I created just stops running. I hav
e
> | > added
> | > | > > several exceptions to the thread
> | > | > >
> | > | > > System.Threading.SynchronizationLockException
> | > | > > System.Threading.ThreadAbortException
> | > | > > System.Threading.ThreadInterruptedException
> | > | > > System.Threading.ThreadStateException
> | > | > >
> | > | > > to see if I could get more information about why the thread stop
s
> | > running
> | > | > > but that code is never executed. Any ideas on how I can debug
> this?
> | > | > >
> | > | > > Thanks in advance.
> | > | > >
> | > | >
> | > | >
> | > | >
> | >
> | >
> | >
>
>
I found the problem. It was in the method being called by the thread. After
adding tons of logging and bunch of catches I found it. Here are the details
:
One of my test cases was to simulate a server crash. During the crashing, if
there was any communication that was already started by the client, it could
not be finished. So the “waiting for data” routine went into an infinite
loop.
I also learned that the following command:
sender.SetSocketOption(System.Net.Sockets.SocketOptionLevel.Socket,
System.Net.Sockets.SocketOptionName.ReceiveTimeout, 10000)
does nothing if the server crashed right after the communication
(client/server) started. So I added a timer in the “waiting for data”
routine. When the time expires I exit the loop throwing an exception, which
gives control back to the thread.
Thank you Bruce, Kevin and Alvin.
"mareal" wrote:
> Hello Bruce and thank you for your suggestion. I did what you told me and
> unfortunately nothing changed. I can still see one thread (I only created
> two) dying. Look at the log I am outputting:
> The entry at the bottom represents me stopping the aspnet_wp.exe process.
> Then you will thread 1 and 2. Around 8:37:04 is when thread 0 died...
> DATE,TIME,EVENT CONTENT
> 3/9/2005,8:38:49 AM,Thread ID# 1;
> 3/9/2005,8:38:46 AM,Thread ID# 1;
> 3/9/2005,8:38:42 AM,Thread ID# 1;
> 3/9/2005,8:38:39 AM,Thread ID# 1;
> 3/9/2005,8:38:36 AM,Thread ID# 1;
> 3/9/2005,8:38:33 AM,Thread ID# 1;
> 3/9/2005,8:38:30 AM,Thread ID# 1;
> 3/9/2005,8:38:27 AM,Thread ID# 1;
> 3/9/2005,8:38:24 AM,Thread ID# 1;
> 3/9/2005,8:38:20 AM,Thread ID# 1;
> 3/9/2005,8:38:17 AM,Thread ID# 1;
> 3/9/2005,8:38:14 AM,Thread ID# 1;
> 3/9/2005,8:38:11 AM,Thread ID# 1;
> 3/9/2005,8:38:08 AM,Thread ID# 1;
> 3/9/2005,8:38:05 AM,Thread ID# 1;
> 3/9/2005,8:38:02 AM,Thread ID# 1;
> 3/9/2005,8:37:58 AM,Thread ID# 1;
> 3/9/2005,8:37:55 AM,Thread ID# 1;
> 3/9/2005,8:37:52 AM,Thread ID# 1;
> 3/9/2005,8:37:49 AM,Thread ID# 1;
> 3/9/2005,8:37:46 AM,Thread ID# 1;
> 3/9/2005,8:37:42 AM,Thread ID# 1;
> 3/9/2005,8:37:39 AM,Thread ID# 1;
> 3/9/2005,8:37:36 AM,Thread ID# 1;
> 3/9/2005,8:37:33 AM,Thread ID# 1;
> 3/9/2005,8:37:30 AM,Thread ID# 1;
> 3/9/2005,8:37:27 AM,Thread ID# 1;
> 3/9/2005,8:37:24 AM,Thread ID# 1;
> 3/9/2005,8:37:21 AM,Thread ID# 1;
> 3/9/2005,8:37:17 AM,Thread ID# 1;
> 3/9/2005,8:37:14 AM,Thread ID# 1;
> 3/9/2005,8:37:11 AM,Thread ID# 1;
> 3/9/2005,8:37:08 AM,Thread ID# 1;
> 3/9/2005,8:37:04 AM,Thread ID# 1;
> 3/9/2005,8:37:04 AM,Thread ID# 0;
> 3/9/2005,8:37:01 AM,Thread ID# 1;
> 3/9/2005,8:37:01 AM,Thread ID# 0;
> 3/9/2005,8:36:58 AM,Thread ID# 1;
> 3/9/2005,8:36:58 AM,Thread ID# 0;
> 3/9/2005,8:36:55 AM,Thread ID# 1;
> 3/9/2005,8:36:54 AM,Thread ID# 0;
> 3/9/2005,8:36:52 AM,Thread ID# 1;
> 3/9/2005,8:36:51 AM,Thread ID# 0;
> 3/9/2005,8:36:49 AM,Thread ID# 1;
> 3/9/2005,8:36:48 AM,Thread ID# 0;
> 3/9/2005,8:36:45 AM,Thread ID# 1;
> 3/9/2005,8:36:45 AM,Thread ID# 0;
> 3/9/2005,8:36:42 AM,Thread ID# 0;
> 3/9/2005,8:36:42 AM,Thread ID# 1;
> 3/9/2005,8:36:39 AM,Thread ID# 0;
> 3/9/2005,8:36:39 AM,Thread ID# 1;
> 3/9/2005,8:36:36 AM,Thread ID# 1;
> 3/9/2005,8:36:33 AM,Thread ID# 1;
> 3/9/2005,8:36:30 AM,Thread ID# 1;
> 3/9/2005,8:36:27 AM,Thread ID# 1;
> 3/9/2005,8:36:26 AM,Thread ID# 0;
> 3/9/2005,8:36:23 AM,Thread ID# 1;
> 3/9/2005,8:36:22 AM,Thread ID# 0;
> 3/9/2005,8:36:20 AM,Thread ID# 1;
> 3/9/2005,8:36:18 AM,Thread ID# 0;
> 3/9/2005,8:36:17 AM,Thread ID# 1;
> 3/9/2005,8:36:14 AM,Thread ID# 0;
> 3/9/2005,8:36:14 AM,Thread ID# 1;
> 3/9/2005,8:36:10 AM,Thread ID# 1;
> 3/9/2005,8:36:10 AM,Thread ID# 0;
> 3/9/2005,8:36:07 AM,Thread ID# 1;
> 3/9/2005,8:36:06 AM,Thread ID# 0;
> 3/9/2005,8:36:04 AM,Thread ID# 1;
> 3/9/2005,8:36:02 AM,Thread ID# 0;
> 3/9/2005,8:36:01 AM,Thread ID# 1;
> 3/9/2005,8:35:58 AM,Thread ID# 0;
> 3/9/2005,8:35:57 AM,Thread ID# 1;
> 3/9/2005,8:35:54 AM,Thread ID# 1;
> 3/9/2005,8:35:54 AM,Thread ID# 0;
> 3/9/2005,8:35:51 AM,Thread ID# 1;
> 3/9/2005,8:35:50 AM,Thread ID# 0;
> 3/9/2005,8:35:48 AM,Thread ID# 1;
> 3/9/2005,8:35:46 AM,Thread ID# 0;
> 3/9/2005,8:35:45 AM,Thread ID# 1;
> 3/9/2005,8:35:43 AM,Thread ID# 0;
> 3/9/2005,8:35:42 AM,Thread ID# 1;
> 3/9/2005,8:35:40 AM,Thread ID# 0;
> 3/9/2005,8:35:38 AM,Thread ID# 1;
> 3/9/2005,8:35:37 AM,Thread ID# 0;
> 3/9/2005,8:35:35 AM,Thread ID# 1;
> 3/9/2005,8:35:34 AM,Thread ID# 0;
> 3/9/2005,8:35:32 AM,Thread ID# 1;
> 3/9/2005,8:35:31 AM,Thread ID# 0;
> 3/9/2005,8:35:29 AM,Thread ID# 1;
> 3/9/2005,8:35:28 AM,Thread ID# 0;
> 3/9/2005,8:35:26 AM,Thread ID# 1;
> 3/9/2005,8:35:25 AM,Thread ID# 0;
> 3/9/2005,8:35:23 AM,Thread ID# 1;
> 3/9/2005,8:35:21 AM,Thread ID# 0;
> 3/9/2005,8:35:20 AM,Thread ID# 1;
> 3/9/2005,8:35:18 AM,Thread ID# 0;
> 3/9/2005,8:35:16 AM,Thread ID# 1;
> 3/9/2005,8:35:15 AM,Thread ID# 0;
> 3/9/2005,8:35:13 AM,Thread ID# 1;
> 3/9/2005,8:35:12 AM,Thread ID# 0;
> 3/9/2005,8:35:10 AM,Thread ID# 1;
> 3/9/2005,8:35:09 AM,Thread ID# 0;
> 3/9/2005,8:35:07 AM,Thread ID# 1;
> 3/9/2005,8:35:06 AM,Thread ID# 0;
> 3/9/2005,8:35:03 AM,Thread ID# 1;
> 3/9/2005,8:35:03 AM,Thread ID# 0;
> 3/9/2005,8:35:00 AM,Thread ID# 1;
> 3/9/2005,8:35:00 AM,Thread ID# 0;
> 3/9/2005,8:34:57 AM,Thread ID# 1;
> 3/9/2005,8:34:57 AM,Thread ID# 0;
> 3/9/2005,8:34:54 AM,Thread ID# 1;
> 3/9/2005,8:34:54 AM,Thread ID# 0;
> 3/9/2005,8:34:51 AM,Thread ID# 1;
> 3/9/2005,8:34:51 AM,Thread ID# 0;
> 3/9/2005,8:34:48 AM,Thread ID# 1;
> 3/9/2005,8:34:48 AM,Thread ID# 0;
> 3/9/2005,8:34:45 AM,Thread ID# 1;
> 3/9/2005,8:34:45 AM,Thread ID# 0;
> 3/9/2005,8:34:42 AM,Thread ID# 1;
> 3/9/2005,8:34:41 AM,Thread ID# 0;
> 3/9/2005,8:34:38 AM,Thread ID# 1;
> 3/9/2005,8:34:38 AM,Thread ID# 0;
> 3/9/2005,8:34:23 AM,ASP.NET 1.1.4322.0,Error,1000,N/A,aspnet_wp.exe (PID:
> 3796) stopped unexpectedly.
>
> "bruce barker" wrote:
>
Nice debugging work!
Kevin Spencer
Microsoft MVP
.Net Developer
What You S Is What You Get.
"mareal" <m@.m.com> wrote in message
news:078C5B1D-6B25-4E0E-B0B5-3B9326193A32@.microsoft.com...
>I found the problem. It was in the method being called by the thread. After
> adding tons of logging and bunch of catches I found it. Here are the
> details:
> One of my test cases was to simulate a server crash. During the crashing,
> if
> there was any communication that was already started by the client, it
> could
> not be finished. So the "waiting for data" routine went into an infinite
> loop.
> I also learned that the following command:
> sender.SetSocketOption(System.Net.Sockets.SocketOptionLevel.Socket,
> System.Net.Sockets.SocketOptionName.ReceiveTimeout, 10000)
> does nothing if the server crashed right after the communication
> (client/server) started. So I added a timer in the "waiting for data"
> routine. When the time expires I exit the loop throwing an exception,
> which
> gives control back to the thread.
> Thank you Bruce, Kevin and Alvin.
> "mareal" wrote:
>

Thread issue/leak?

I am creating a worker thread from inside an aspx page and the thread does
the stuff it should do, no problem.
However, I have noticed running it in the debugger that it seems as if the
threads are not killed/garbage-collected after a thread terminates. I have a
breakpoint in the thread itself and every time it breaks, in the Threads
window I observe the new thread, but the previous thread is still there as
well. The exact same code in a windows app performs as expected, on every
break there are two threads, the main thread and the current worker thread.
The simplified code below also gives the same results, so nothing strange in
the thread itself. If I put the code in a loop of 2000 cycles and break
after the last, then there are 2000 worker threads displayed in the Threads
window.

Dim ttt As Thread = New Thread(AddressOf TheThreadProc)
ttt.ApartmentState = Threading.ApartmentState.STA
ttt.Start()
ttt.Join()

And the simple thread:

Private Sub TheThreadProc()
Dim iii As Integer = 10
End SubThis is because you are using a Single-Threaded Apartment. There is nothing
in the thread to receive messages. When you use COM in an ASP.Net
application, you create an Interop class that is disposable, and therefore,
the thread can be killed. IOW, don't use an STA thread unless you are doing
Interop.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Everybody picks their nose,
But some people are better at hiding it.

"Chris Botha" <chris_s_botha@.AThotmail.com> wrote in message
news:uo5YHs9lFHA.2916@.TK2MSFTNGP14.phx.gbl...
>I am creating a worker thread from inside an aspx page and the thread does
> the stuff it should do, no problem.
> However, I have noticed running it in the debugger that it seems as if the
> threads are not killed/garbage-collected after a thread terminates. I have
> a
> breakpoint in the thread itself and every time it breaks, in the Threads
> window I observe the new thread, but the previous thread is still there as
> well. The exact same code in a windows app performs as expected, on every
> break there are two threads, the main thread and the current worker
> thread.
> The simplified code below also gives the same results, so nothing strange
> in
> the thread itself. If I put the code in a loop of 2000 cycles and break
> after the last, then there are 2000 worker threads displayed in the
> Threads
> window.
> Dim ttt As Thread = New Thread(AddressOf TheThreadProc)
> ttt.ApartmentState = Threading.ApartmentState.STA
> ttt.Start()
> ttt.Join()
> And the simple thread:
> Private Sub TheThreadProc()
> Dim iii As Integer = 10
> End Sub
Kevin, thanks for the response, however this is not it, I tested it without
STA before I posted the problem, same result.
The true thread is doing Interop, the simple example below is not (the
simple example produces the error/issue, with or without the STA statement).

"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:uhEpuHEmFHA.3300@.TK2MSFTNGP15.phx.gbl...
> This is because you are using a Single-Threaded Apartment. There is
> nothing in the thread to receive messages. When you use COM in an ASP.Net
> application, you create an Interop class that is disposable, and
> therefore, the thread can be killed. IOW, don't use an STA thread unless
> you are doing Interop.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> Everybody picks their nose,
> But some people are better at hiding it.
> "Chris Botha" <chris_s_botha@.AThotmail.com> wrote in message
> news:uo5YHs9lFHA.2916@.TK2MSFTNGP14.phx.gbl...
>>I am creating a worker thread from inside an aspx page and the thread does
>> the stuff it should do, no problem.
>> However, I have noticed running it in the debugger that it seems as if
>> the
>> threads are not killed/garbage-collected after a thread terminates. I
>> have a
>> breakpoint in the thread itself and every time it breaks, in the Threads
>> window I observe the new thread, but the previous thread is still there
>> as
>> well. The exact same code in a windows app performs as expected, on every
>> break there are two threads, the main thread and the current worker
>> thread.
>> The simplified code below also gives the same results, so nothing strange
>> in
>> the thread itself. If I put the code in a loop of 2000 cycles and break
>> after the last, then there are 2000 worker threads displayed in the
>> Threads
>> window.
>>
>> Dim ttt As Thread = New Thread(AddressOf TheThreadProc)
>> ttt.ApartmentState = Threading.ApartmentState.STA
>> ttt.Start()
>> ttt.Join()
>>
>> And the simple thread:
>>
>> Private Sub TheThreadProc()
>> Dim iii As Integer = 10
>> End Sub
>>
>>
Are you setting the "aspcompat" attribute?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Everybody picks their nose,
But some people are better at hiding it.

"Chris Botha" <chris_s_botha@.AThotmail.com> wrote in message
news:OqkgITEmFHA.708@.TK2MSFTNGP09.phx.gbl...
> Kevin, thanks for the response, however this is not it, I tested it
> without STA before I posted the problem, same result.
> The true thread is doing Interop, the simple example below is not (the
> simple example produces the error/issue, with or without the STA
> statement).
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:uhEpuHEmFHA.3300@.TK2MSFTNGP15.phx.gbl...
>> This is because you are using a Single-Threaded Apartment. There is
>> nothing in the thread to receive messages. When you use COM in an ASP.Net
>> application, you create an Interop class that is disposable, and
>> therefore, the thread can be killed. IOW, don't use an STA thread unless
>> you are doing Interop.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> .Net Developer
>> Everybody picks their nose,
>> But some people are better at hiding it.
>>
>> "Chris Botha" <chris_s_botha@.AThotmail.com> wrote in message
>> news:uo5YHs9lFHA.2916@.TK2MSFTNGP14.phx.gbl...
>>>I am creating a worker thread from inside an aspx page and the thread
>>>does
>>> the stuff it should do, no problem.
>>> However, I have noticed running it in the debugger that it seems as if
>>> the
>>> threads are not killed/garbage-collected after a thread terminates. I
>>> have a
>>> breakpoint in the thread itself and every time it breaks, in the Threads
>>> window I observe the new thread, but the previous thread is still there
>>> as
>>> well. The exact same code in a windows app performs as expected, on
>>> every
>>> break there are two threads, the main thread and the current worker
>>> thread.
>>> The simplified code below also gives the same results, so nothing
>>> strange in
>>> the thread itself. If I put the code in a loop of 2000 cycles and break
>>> after the last, then there are 2000 worker threads displayed in the
>>> Threads
>>> window.
>>>
>>> Dim ttt As Thread = New Thread(AddressOf TheThreadProc)
>>> ttt.ApartmentState = Threading.ApartmentState.STA
>>> ttt.Start()
>>> ttt.Join()
>>>
>>> And the simple thread:
>>>
>>> Private Sub TheThreadProc()
>>> Dim iii As Integer = 10
>>> End Sub
>>>
>>>
>>
>>
Also, Chris, as you didn't post your actual code, I can't really guess what
the problem is. However, I believe you can find your answers at one or more
of the following MSDN articles (and related links):

http://msdn.microsoft.com/library/e...asp?frame=true
http://msdn.microsoft.com/library/e...asp?frame=true

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Everybody picks their nose,
But some people are better at hiding it.

"Chris Botha" <chris_s_botha@.AThotmail.com> wrote in message
news:OqkgITEmFHA.708@.TK2MSFTNGP09.phx.gbl...
> Kevin, thanks for the response, however this is not it, I tested it
> without STA before I posted the problem, same result.
> The true thread is doing Interop, the simple example below is not (the
> simple example produces the error/issue, with or without the STA
> statement).
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:uhEpuHEmFHA.3300@.TK2MSFTNGP15.phx.gbl...
>> This is because you are using a Single-Threaded Apartment. There is
>> nothing in the thread to receive messages. When you use COM in an ASP.Net
>> application, you create an Interop class that is disposable, and
>> therefore, the thread can be killed. IOW, don't use an STA thread unless
>> you are doing Interop.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> .Net Developer
>> Everybody picks their nose,
>> But some people are better at hiding it.
>>
>> "Chris Botha" <chris_s_botha@.AThotmail.com> wrote in message
>> news:uo5YHs9lFHA.2916@.TK2MSFTNGP14.phx.gbl...
>>>I am creating a worker thread from inside an aspx page and the thread
>>>does
>>> the stuff it should do, no problem.
>>> However, I have noticed running it in the debugger that it seems as if
>>> the
>>> threads are not killed/garbage-collected after a thread terminates. I
>>> have a
>>> breakpoint in the thread itself and every time it breaks, in the Threads
>>> window I observe the new thread, but the previous thread is still there
>>> as
>>> well. The exact same code in a windows app performs as expected, on
>>> every
>>> break there are two threads, the main thread and the current worker
>>> thread.
>>> The simplified code below also gives the same results, so nothing
>>> strange in
>>> the thread itself. If I put the code in a loop of 2000 cycles and break
>>> after the last, then there are 2000 worker threads displayed in the
>>> Threads
>>> window.
>>>
>>> Dim ttt As Thread = New Thread(AddressOf TheThreadProc)
>>> ttt.ApartmentState = Threading.ApartmentState.STA
>>> ttt.Start()
>>> ttt.Join()
>>>
>>> And the simple thread:
>>>
>>> Private Sub TheThreadProc()
>>> Dim iii As Integer = 10
>>> End Sub
>>>
>>>
>>
>>
worker threads should be terminated, as you showed code of one
statement.
There would be 2000 (caller) main threads waiting for worker to be
terminated.

If you are saying worker thread (small one statement proc) is not
terminating (GC)
then Caller threads must also be alive.

Check ttt.IsAlive and do ttt.Abort() and ttt = Nothing
and test.

The (worker thread) code is being called by pageclass which is also
generated by some other asp.net parent thread (if that is calling abort
or someother stuff on the thread of pageclass this could affect).

Do let us know of your proceedings.

--
hB

Thread issue/leak?

I am creating a worker thread from inside an aspx page and the thread does
the stuff it should do, no problem.
However, I have noticed running it in the debugger that it seems as if the
threads are not killed/garbage-collected after a thread terminates. I have a
breakpoint in the thread itself and every time it breaks, in the Threads
window I observe the new thread, but the previous thread is still there as
well. The exact same code in a windows app performs as expected, on every
break there are two threads, the main thread and the current worker thread.
The simplified code below also gives the same results, so nothing strange in
the thread itself. If I put the code in a loop of 2000 cycles and break
after the last, then there are 2000 worker threads displayed in the Threads
window.
Dim ttt As Thread = New Thread(AddressOf TheThreadProc)
ttt.ApartmentState = Threading.ApartmentState.STA
ttt.Start()
ttt.Join()
And the simple thread:
Private Sub TheThreadProc()
Dim iii As Integer = 10
End SubThis is because you are using a Single-Threaded Apartment. There is nothing
in the thread to receive messages. When you use COM in an ASP.Net
application, you create an Interop class that is disposable, and therefore,
the thread can be killed. IOW, don't use an STA thread unless you are doing
Interop.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
Everybody picks their nose,
But some people are better at hiding it.
"Chris Botha" <chris_s_botha@.AThotmail.com> wrote in message
news:uo5YHs9lFHA.2916@.TK2MSFTNGP14.phx.gbl...
>I am creating a worker thread from inside an aspx page and the thread does
> the stuff it should do, no problem.
> However, I have noticed running it in the debugger that it seems as if the
> threads are not killed/garbage-collected after a thread terminates. I have
> a
> breakpoint in the thread itself and every time it breaks, in the Threads
> window I observe the new thread, but the previous thread is still there as
> well. The exact same code in a windows app performs as expected, on every
> break there are two threads, the main thread and the current worker
> thread.
> The simplified code below also gives the same results, so nothing strange
> in
> the thread itself. If I put the code in a loop of 2000 cycles and break
> after the last, then there are 2000 worker threads displayed in the
> Threads
> window.
> Dim ttt As Thread = New Thread(AddressOf TheThreadProc)
> ttt.ApartmentState = Threading.ApartmentState.STA
> ttt.Start()
> ttt.Join()
> And the simple thread:
> Private Sub TheThreadProc()
> Dim iii As Integer = 10
> End Sub
>
Kevin, thanks for the response, however this is not it, I tested it without
STA before I posted the problem, same result.
The true thread is doing Interop, the simple example below is not (the
simple example produces the error/issue, with or without the STA statement).
"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:uhEpuHEmFHA.3300@.TK2MSFTNGP15.phx.gbl...
> This is because you are using a Single-Threaded Apartment. There is
> nothing in the thread to receive messages. When you use COM in an ASP.Net
> application, you create an Interop class that is disposable, and
> therefore, the thread can be killed. IOW, don't use an STA thread unless
> you are doing Interop.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> Everybody picks their nose,
> But some people are better at hiding it.
> "Chris Botha" <chris_s_botha@.AThotmail.com> wrote in message
> news:uo5YHs9lFHA.2916@.TK2MSFTNGP14.phx.gbl...
>
Are you setting the "aspcompat" attribute?
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
Everybody picks their nose,
But some people are better at hiding it.
"Chris Botha" <chris_s_botha@.AThotmail.com> wrote in message
news:OqkgITEmFHA.708@.TK2MSFTNGP09.phx.gbl...
> Kevin, thanks for the response, however this is not it, I tested it
> without STA before I posted the problem, same result.
> The true thread is doing Interop, the simple example below is not (the
> simple example produces the error/issue, with or without the STA
> statement).
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:uhEpuHEmFHA.3300@.TK2MSFTNGP15.phx.gbl...
>
Also, Chris, as you didn't post your actual code, I can't really guess what
the problem is. However, I believe you can find your answers at one or more
of the following MSDN articles (and related links):
http://msdn.microsoft.com/library/e...
me=true
http://msdn.microsoft.com/library/e...br />
ame=true
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
Everybody picks their nose,
But some people are better at hiding it.
"Chris Botha" <chris_s_botha@.AThotmail.com> wrote in message
news:OqkgITEmFHA.708@.TK2MSFTNGP09.phx.gbl...
> Kevin, thanks for the response, however this is not it, I tested it
> without STA before I posted the problem, same result.
> The true thread is doing Interop, the simple example below is not (the
> simple example produces the error/issue, with or without the STA
> statement).
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:uhEpuHEmFHA.3300@.TK2MSFTNGP15.phx.gbl...
>
worker threads should be terminated, as you showed code of one
statement.
There would be 2000 (caller) main threads waiting for worker to be
terminated.
If you are saying worker thread (small one statement proc) is not
terminating (GC)
then Caller threads must also be alive.
Check ttt.IsAlive and do ttt.Abort() and ttt = Nothing
and test.
The (worker thread) code is being called by pageclass which is also
generated by some other asp.net parent thread (if that is calling abort
or someother stuff on the thread of pageclass this could affect).
Do let us know of your proceedings.
hB

Thread just stops running

I have noticed how the thread I created just stops running. I have added
several exceptions to the thread

System.Threading.SynchronizationLockException
System.Threading.ThreadAbortException
System.Threading.ThreadInterruptedException
System.Threading.ThreadStateException

to see if I could get more information about why the thread stops running
but that code is never executed. Any ideas on how I can debug this?

Thanks in advance.You need to provide more context than this if you want the problem to be
solved

--
Regards,
Alvin Bruney

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
------------------

"mareal" <m@.m.com> wrote in message
news:39C9F5D2-4988-4F95-A4C3-3EBF68E773FD@.microsoft.com...
>I have noticed how the thread I created just stops running. I have added
> several exceptions to the thread
> System.Threading.SynchronizationLockException
> System.Threading.ThreadAbortException
> System.Threading.ThreadInterruptedException
> System.Threading.ThreadStateException
> to see if I could get more information about why the thread stops running
> but that code is never executed. Any ideas on how I can debug this?
> Thanks in advance.
A thread stops running as soon as its parent thread stops running.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"mareal" <m@.m.com> wrote in message
news:39C9F5D2-4988-4F95-A4C3-3EBF68E773FD@.microsoft.com...
>I have noticed how the thread I created just stops running. I have added
> several exceptions to the thread
> System.Threading.SynchronizationLockException
> System.Threading.ThreadAbortException
> System.Threading.ThreadInterruptedException
> System.Threading.ThreadStateException
> to see if I could get more information about why the thread stops running
> but that code is never executed. Any ideas on how I can debug this?
> Thanks in advance.
Thanks Kevin. The parent thread (as I understand it) is the aspnet_wp process
and as far I can tell, it is still running. The reason why I am saying this
is because I can access other ASP.NET applications on the same server. I have
also checked the event log and I don't aspnet_wp being recycled. What am I
missing?

"Kevin Spencer" wrote:

> A thread stops running as soon as its parent thread stops running.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> ..Net Developer
> What You Seek Is What You Get.
> "mareal" <m@.m.com> wrote in message
> news:39C9F5D2-4988-4F95-A4C3-3EBF68E773FD@.microsoft.com...
> >I have noticed how the thread I created just stops running. I have added
> > several exceptions to the thread
> > System.Threading.SynchronizationLockException
> > System.Threading.ThreadAbortException
> > System.Threading.ThreadInterruptedException
> > System.Threading.ThreadStateException
> > to see if I could get more information about why the thread stops running
> > but that code is never executed. Any ideas on how I can debug this?
> > Thanks in advance.
>
what is the looping structure in your thread? are you sure you are catching
all errors? what is its normal exit trigger?

if you code it correctly a thread will run the life of the appdomain its
created in.

-- bruce (sqlwork.com)

"mareal" <m@.m.com> wrote in message
news:E860CABF-18CE-4099-B44C-CB844EE57925@.microsoft.com...
| Thanks Kevin. The parent thread (as I understand it) is the aspnet_wp
process
| and as far I can tell, it is still running. The reason why I am saying
this
| is because I can access other ASP.NET applications on the same server. I
have
| also checked the event log and I don't aspnet_wp being recycled. What am I
| missing?
|
| "Kevin Spencer" wrote:
|
| > A thread stops running as soon as its parent thread stops running.
| >
| > --
| > HTH,
| >
| > Kevin Spencer
| > Microsoft MVP
| > ..Net Developer
| > What You Seek Is What You Get.
| >
| > "mareal" <m@.m.com> wrote in message
| > news:39C9F5D2-4988-4F95-A4C3-3EBF68E773FD@.microsoft.com...
| > >I have noticed how the thread I created just stops running. I have
added
| > > several exceptions to the thread
| | > > System.Threading.SynchronizationLockException
| > > System.Threading.ThreadAbortException
| > > System.Threading.ThreadInterruptedException
| > > System.Threading.ThreadStateException
| | > > to see if I could get more information about why the thread stops
running
| > > but that code is never executed. Any ideas on how I can debug this?
| | > > Thanks in advance.
| | >
| >
|
Hello Bruce. I am sure I am catching all errors:

System.Threading.SynchronizationLockException
System.Threading.ThreadAbortException
System.Threading.ThreadInterruptedException
System.Threading.ThreadStateException
System.Exception

The looping structure is a

While True
... (local code)
... Call another method
... (+ local code)
End While

I have not added an exit trigger yet. I wanted to fix this problem first.

"bruce barker" wrote:

> what is the looping structure in your thread? are you sure you are catching
> all errors? what is its normal exit trigger?
> if you code it correctly a thread will run the life of the appdomain its
> created in.
> -- bruce (sqlwork.com)
>
>
> "mareal" <m@.m.com> wrote in message
> news:E860CABF-18CE-4099-B44C-CB844EE57925@.microsoft.com...
> | Thanks Kevin. The parent thread (as I understand it) is the aspnet_wp
> process
> | and as far I can tell, it is still running. The reason why I am saying
> this
> | is because I can access other ASP.NET applications on the same server. I
> have
> | also checked the event log and I don't aspnet_wp being recycled. What am I
> | missing?
> |
> | "Kevin Spencer" wrote:
> |
> | > A thread stops running as soon as its parent thread stops running.
> | >
> | > --
> | > HTH,
> | >
> | > Kevin Spencer
> | > Microsoft MVP
> | > ..Net Developer
> | > What You Seek Is What You Get.
> | >
> | > "mareal" <m@.m.com> wrote in message
> | > news:39C9F5D2-4988-4F95-A4C3-3EBF68E773FD@.microsoft.com...
> | > >I have noticed how the thread I created just stops running. I have
> added
> | > > several exceptions to the thread
> | > | > > System.Threading.SynchronizationLockException
> | > > System.Threading.ThreadAbortException
> | > > System.Threading.ThreadInterruptedException
> | > > System.Threading.ThreadStateException
> | > | > > to see if I could get more information about why the thread stops
> running
> | > > but that code is never executed. Any ideas on how I can debug this?
> | > | > > Thanks in advance.
> | > | >
> | >
> | >
>
then try

while true
try
... your thread code
catch
try
log error
catch
.. can't log
end try
end try
end while

note: your thread will be running with the asp.net worker process id, and
will have limited permissions.

-- bruce (sqlwork.com)

"mareal" <m@.m.com> wrote in message
news:6D2FC2CE-2FC8-40C9-A073-A02C859511F4@.microsoft.com...
| Hello Bruce. I am sure I am catching all errors:
|
| System.Threading.SynchronizationLockException
| System.Threading.ThreadAbortException
| System.Threading.ThreadInterruptedException
| System.Threading.ThreadStateException
| System.Exception
|
| The looping structure is a
|
| While True
| ... (local code)
| ... Call another method
| ... (+ local code)
| End While
|
| I have not added an exit trigger yet. I wanted to fix this problem first.
|
|
| "bruce barker" wrote:
|
| > what is the looping structure in your thread? are you sure you are
catching
| > all errors? what is its normal exit trigger?
| >
| > if you code it correctly a thread will run the life of the appdomain
its
| > created in.
| >
| > -- bruce (sqlwork.com)
| >
| >
| >
| >
| >
| > "mareal" <m@.m.com> wrote in message
| > news:E860CABF-18CE-4099-B44C-CB844EE57925@.microsoft.com...
| > | Thanks Kevin. The parent thread (as I understand it) is the aspnet_wp
| > process
| > | and as far I can tell, it is still running. The reason why I am saying
| > this
| > | is because I can access other ASP.NET applications on the same server.
I
| > have
| > | also checked the event log and I don't aspnet_wp being recycled. What
am I
| > | missing?
| > |
| > | "Kevin Spencer" wrote:
| > |
| > | > A thread stops running as soon as its parent thread stops running.
| > | >
| > | > --
| > | > HTH,
| > | >
| > | > Kevin Spencer
| > | > Microsoft MVP
| > | > ..Net Developer
| > | > What You Seek Is What You Get.
| > | >
| > | > "mareal" <m@.m.com> wrote in message
| > | > news:39C9F5D2-4988-4F95-A4C3-3EBF68E773FD@.microsoft.com...
| > | > >I have noticed how the thread I created just stops running. I have
| > added
| > | > > several exceptions to the thread
| > | | > | > > System.Threading.SynchronizationLockException
| > | > > System.Threading.ThreadAbortException
| > | > > System.Threading.ThreadInterruptedException
| > | > > System.Threading.ThreadStateException
| > | | > | > > to see if I could get more information about why the thread stops
| > running
| > | > > but that code is never executed. Any ideas on how I can debug
this?
| > | | > | > > Thanks in advance.
| > | | > | >
| > | >
| > | >
| >
| >
|
Hello Bruce and thank you for your suggestion. I did what you told me and
unfortunately nothing changed. I can still see one thread (I only created
two) dying. Look at the log I am outputting:

The entry at the bottom represents me stopping the aspnet_wp.exe process.
Then you will thread 1 and 2. Around 8:37:04 is when thread 0 died...

DATE,TIME,EVENT CONTENT

3/9/2005,8:38:49 AM,Thread ID# 1;
3/9/2005,8:38:46 AM,Thread ID# 1;
3/9/2005,8:38:42 AM,Thread ID# 1;
3/9/2005,8:38:39 AM,Thread ID# 1;
3/9/2005,8:38:36 AM,Thread ID# 1;
3/9/2005,8:38:33 AM,Thread ID# 1;
3/9/2005,8:38:30 AM,Thread ID# 1;
3/9/2005,8:38:27 AM,Thread ID# 1;
3/9/2005,8:38:24 AM,Thread ID# 1;
3/9/2005,8:38:20 AM,Thread ID# 1;
3/9/2005,8:38:17 AM,Thread ID# 1;
3/9/2005,8:38:14 AM,Thread ID# 1;
3/9/2005,8:38:11 AM,Thread ID# 1;
3/9/2005,8:38:08 AM,Thread ID# 1;
3/9/2005,8:38:05 AM,Thread ID# 1;
3/9/2005,8:38:02 AM,Thread ID# 1;
3/9/2005,8:37:58 AM,Thread ID# 1;
3/9/2005,8:37:55 AM,Thread ID# 1;
3/9/2005,8:37:52 AM,Thread ID# 1;
3/9/2005,8:37:49 AM,Thread ID# 1;
3/9/2005,8:37:46 AM,Thread ID# 1;
3/9/2005,8:37:42 AM,Thread ID# 1;
3/9/2005,8:37:39 AM,Thread ID# 1;
3/9/2005,8:37:36 AM,Thread ID# 1;
3/9/2005,8:37:33 AM,Thread ID# 1;
3/9/2005,8:37:30 AM,Thread ID# 1;
3/9/2005,8:37:27 AM,Thread ID# 1;
3/9/2005,8:37:24 AM,Thread ID# 1;
3/9/2005,8:37:21 AM,Thread ID# 1;
3/9/2005,8:37:17 AM,Thread ID# 1;
3/9/2005,8:37:14 AM,Thread ID# 1;
3/9/2005,8:37:11 AM,Thread ID# 1;
3/9/2005,8:37:08 AM,Thread ID# 1;
3/9/2005,8:37:04 AM,Thread ID# 1;
3/9/2005,8:37:04 AM,Thread ID# 0;
3/9/2005,8:37:01 AM,Thread ID# 1;
3/9/2005,8:37:01 AM,Thread ID# 0;
3/9/2005,8:36:58 AM,Thread ID# 1;
3/9/2005,8:36:58 AM,Thread ID# 0;
3/9/2005,8:36:55 AM,Thread ID# 1;
3/9/2005,8:36:54 AM,Thread ID# 0;
3/9/2005,8:36:52 AM,Thread ID# 1;
3/9/2005,8:36:51 AM,Thread ID# 0;
3/9/2005,8:36:49 AM,Thread ID# 1;
3/9/2005,8:36:48 AM,Thread ID# 0;
3/9/2005,8:36:45 AM,Thread ID# 1;
3/9/2005,8:36:45 AM,Thread ID# 0;
3/9/2005,8:36:42 AM,Thread ID# 0;
3/9/2005,8:36:42 AM,Thread ID# 1;
3/9/2005,8:36:39 AM,Thread ID# 0;
3/9/2005,8:36:39 AM,Thread ID# 1;
3/9/2005,8:36:36 AM,Thread ID# 1;
3/9/2005,8:36:33 AM,Thread ID# 1;
3/9/2005,8:36:30 AM,Thread ID# 1;
3/9/2005,8:36:27 AM,Thread ID# 1;
3/9/2005,8:36:26 AM,Thread ID# 0;
3/9/2005,8:36:23 AM,Thread ID# 1;
3/9/2005,8:36:22 AM,Thread ID# 0;
3/9/2005,8:36:20 AM,Thread ID# 1;
3/9/2005,8:36:18 AM,Thread ID# 0;
3/9/2005,8:36:17 AM,Thread ID# 1;
3/9/2005,8:36:14 AM,Thread ID# 0;
3/9/2005,8:36:14 AM,Thread ID# 1;
3/9/2005,8:36:10 AM,Thread ID# 1;
3/9/2005,8:36:10 AM,Thread ID# 0;
3/9/2005,8:36:07 AM,Thread ID# 1;
3/9/2005,8:36:06 AM,Thread ID# 0;
3/9/2005,8:36:04 AM,Thread ID# 1;
3/9/2005,8:36:02 AM,Thread ID# 0;
3/9/2005,8:36:01 AM,Thread ID# 1;
3/9/2005,8:35:58 AM,Thread ID# 0;
3/9/2005,8:35:57 AM,Thread ID# 1;
3/9/2005,8:35:54 AM,Thread ID# 1;
3/9/2005,8:35:54 AM,Thread ID# 0;
3/9/2005,8:35:51 AM,Thread ID# 1;
3/9/2005,8:35:50 AM,Thread ID# 0;
3/9/2005,8:35:48 AM,Thread ID# 1;
3/9/2005,8:35:46 AM,Thread ID# 0;
3/9/2005,8:35:45 AM,Thread ID# 1;
3/9/2005,8:35:43 AM,Thread ID# 0;
3/9/2005,8:35:42 AM,Thread ID# 1;
3/9/2005,8:35:40 AM,Thread ID# 0;
3/9/2005,8:35:38 AM,Thread ID# 1;
3/9/2005,8:35:37 AM,Thread ID# 0;
3/9/2005,8:35:35 AM,Thread ID# 1;
3/9/2005,8:35:34 AM,Thread ID# 0;
3/9/2005,8:35:32 AM,Thread ID# 1;
3/9/2005,8:35:31 AM,Thread ID# 0;
3/9/2005,8:35:29 AM,Thread ID# 1;
3/9/2005,8:35:28 AM,Thread ID# 0;
3/9/2005,8:35:26 AM,Thread ID# 1;
3/9/2005,8:35:25 AM,Thread ID# 0;
3/9/2005,8:35:23 AM,Thread ID# 1;
3/9/2005,8:35:21 AM,Thread ID# 0;
3/9/2005,8:35:20 AM,Thread ID# 1;
3/9/2005,8:35:18 AM,Thread ID# 0;
3/9/2005,8:35:16 AM,Thread ID# 1;
3/9/2005,8:35:15 AM,Thread ID# 0;
3/9/2005,8:35:13 AM,Thread ID# 1;
3/9/2005,8:35:12 AM,Thread ID# 0;
3/9/2005,8:35:10 AM,Thread ID# 1;
3/9/2005,8:35:09 AM,Thread ID# 0;
3/9/2005,8:35:07 AM,Thread ID# 1;
3/9/2005,8:35:06 AM,Thread ID# 0;
3/9/2005,8:35:03 AM,Thread ID# 1;
3/9/2005,8:35:03 AM,Thread ID# 0;
3/9/2005,8:35:00 AM,Thread ID# 1;
3/9/2005,8:35:00 AM,Thread ID# 0;
3/9/2005,8:34:57 AM,Thread ID# 1;
3/9/2005,8:34:57 AM,Thread ID# 0;
3/9/2005,8:34:54 AM,Thread ID# 1;
3/9/2005,8:34:54 AM,Thread ID# 0;
3/9/2005,8:34:51 AM,Thread ID# 1;
3/9/2005,8:34:51 AM,Thread ID# 0;
3/9/2005,8:34:48 AM,Thread ID# 1;
3/9/2005,8:34:48 AM,Thread ID# 0;
3/9/2005,8:34:45 AM,Thread ID# 1;
3/9/2005,8:34:45 AM,Thread ID# 0;
3/9/2005,8:34:42 AM,Thread ID# 1;
3/9/2005,8:34:41 AM,Thread ID# 0;
3/9/2005,8:34:38 AM,Thread ID# 1;
3/9/2005,8:34:38 AM,Thread ID# 0;
3/9/2005,8:34:23 AM,ASP.NET 1.1.4322.0,Error,1000,N/A,aspnet_wp.exe (PID:
3796) stopped unexpectedly.

"bruce barker" wrote:

> then try
> while true
> try
> ... your thread code
> catch
> try
> log error
> catch
> .. can't log
> end try
> end try
> end while
> note: your thread will be running with the asp.net worker process id, and
> will have limited permissions.
> -- bruce (sqlwork.com)
> "mareal" <m@.m.com> wrote in message
> news:6D2FC2CE-2FC8-40C9-A073-A02C859511F4@.microsoft.com...
> | Hello Bruce. I am sure I am catching all errors:
> |
> | System.Threading.SynchronizationLockException
> | System.Threading.ThreadAbortException
> | System.Threading.ThreadInterruptedException
> | System.Threading.ThreadStateException
> | System.Exception
> |
> | The looping structure is a
> |
> | While True
> | ... (local code)
> | ... Call another method
> | ... (+ local code)
> | End While
> |
> | I have not added an exit trigger yet. I wanted to fix this problem first.
> |
> |
> | "bruce barker" wrote:
> |
> | > what is the looping structure in your thread? are you sure you are
> catching
> | > all errors? what is its normal exit trigger?
> | >
> | > if you code it correctly a thread will run the life of the appdomain
> its
> | > created in.
> | >
> | > -- bruce (sqlwork.com)
> | >
> | >
> | >
> | >
> | >
> | > "mareal" <m@.m.com> wrote in message
> | > news:E860CABF-18CE-4099-B44C-CB844EE57925@.microsoft.com...
> | > | Thanks Kevin. The parent thread (as I understand it) is the aspnet_wp
> | > process
> | > | and as far I can tell, it is still running. The reason why I am saying
> | > this
> | > | is because I can access other ASP.NET applications on the same server.
> I
> | > have
> | > | also checked the event log and I don't aspnet_wp being recycled. What
> am I
> | > | missing?
> | > |
> | > | "Kevin Spencer" wrote:
> | > |
> | > | > A thread stops running as soon as its parent thread stops running.
> | > | >
> | > | > --
> | > | > HTH,
> | > | >
> | > | > Kevin Spencer
> | > | > Microsoft MVP
> | > | > ..Net Developer
> | > | > What You Seek Is What You Get.
> | > | >
> | > | > "mareal" <m@.m.com> wrote in message
> | > | > news:39C9F5D2-4988-4F95-A4C3-3EBF68E773FD@.microsoft.com...
> | > | > >I have noticed how the thread I created just stops running. I have
> | > added
> | > | > > several exceptions to the thread
> | > | > | > | > > System.Threading.SynchronizationLockException
> | > | > > System.Threading.ThreadAbortException
> | > | > > System.Threading.ThreadInterruptedException
> | > | > > System.Threading.ThreadStateException
> | > | > | > | > > to see if I could get more information about why the thread stops
> | > running
> | > | > > but that code is never executed. Any ideas on how I can debug
> this?
> | > | > | > | > > Thanks in advance.
> | > | > | > | >
> | > | >
> | > | >
> | >
> | >
> | >
>
I found the problem. It was in the method being called by the thread. After
adding tons of logging and bunch of catches I found it. Here are the details:

One of my test cases was to simulate a server crash. During the crashing, if
there was any communication that was already started by the client, it could
not be finished. So the "waiting for data" routine went into an infinite loop.

I also learned that the following command:

sender.SetSocketOption(System.Net.Sockets.SocketOp tionLevel.Socket,
System.Net.Sockets.SocketOptionName.ReceiveTimeout , 10000)

does nothing if the server crashed right after the communication
(client/server) started. So I added a timer in the "waiting for data"
routine. When the time expires I exit the loop throwing an exception, which
gives control back to the thread.

Thank you Bruce, Kevin and Alvin.

"mareal" wrote:

> Hello Bruce and thank you for your suggestion. I did what you told me and
> unfortunately nothing changed. I can still see one thread (I only created
> two) dying. Look at the log I am outputting:
> The entry at the bottom represents me stopping the aspnet_wp.exe process.
> Then you will thread 1 and 2. Around 8:37:04 is when thread 0 died...
> DATE,TIME,EVENT CONTENT
> 3/9/2005,8:38:49 AM,Thread ID# 1;
> 3/9/2005,8:38:46 AM,Thread ID# 1;
> 3/9/2005,8:38:42 AM,Thread ID# 1;
> 3/9/2005,8:38:39 AM,Thread ID# 1;
> 3/9/2005,8:38:36 AM,Thread ID# 1;
> 3/9/2005,8:38:33 AM,Thread ID# 1;
> 3/9/2005,8:38:30 AM,Thread ID# 1;
> 3/9/2005,8:38:27 AM,Thread ID# 1;
> 3/9/2005,8:38:24 AM,Thread ID# 1;
> 3/9/2005,8:38:20 AM,Thread ID# 1;
> 3/9/2005,8:38:17 AM,Thread ID# 1;
> 3/9/2005,8:38:14 AM,Thread ID# 1;
> 3/9/2005,8:38:11 AM,Thread ID# 1;
> 3/9/2005,8:38:08 AM,Thread ID# 1;
> 3/9/2005,8:38:05 AM,Thread ID# 1;
> 3/9/2005,8:38:02 AM,Thread ID# 1;
> 3/9/2005,8:37:58 AM,Thread ID# 1;
> 3/9/2005,8:37:55 AM,Thread ID# 1;
> 3/9/2005,8:37:52 AM,Thread ID# 1;
> 3/9/2005,8:37:49 AM,Thread ID# 1;
> 3/9/2005,8:37:46 AM,Thread ID# 1;
> 3/9/2005,8:37:42 AM,Thread ID# 1;
> 3/9/2005,8:37:39 AM,Thread ID# 1;
> 3/9/2005,8:37:36 AM,Thread ID# 1;
> 3/9/2005,8:37:33 AM,Thread ID# 1;
> 3/9/2005,8:37:30 AM,Thread ID# 1;
> 3/9/2005,8:37:27 AM,Thread ID# 1;
> 3/9/2005,8:37:24 AM,Thread ID# 1;
> 3/9/2005,8:37:21 AM,Thread ID# 1;
> 3/9/2005,8:37:17 AM,Thread ID# 1;
> 3/9/2005,8:37:14 AM,Thread ID# 1;
> 3/9/2005,8:37:11 AM,Thread ID# 1;
> 3/9/2005,8:37:08 AM,Thread ID# 1;
> 3/9/2005,8:37:04 AM,Thread ID# 1;
> 3/9/2005,8:37:04 AM,Thread ID# 0;
> 3/9/2005,8:37:01 AM,Thread ID# 1;
> 3/9/2005,8:37:01 AM,Thread ID# 0;
> 3/9/2005,8:36:58 AM,Thread ID# 1;
> 3/9/2005,8:36:58 AM,Thread ID# 0;
> 3/9/2005,8:36:55 AM,Thread ID# 1;
> 3/9/2005,8:36:54 AM,Thread ID# 0;
> 3/9/2005,8:36:52 AM,Thread ID# 1;
> 3/9/2005,8:36:51 AM,Thread ID# 0;
> 3/9/2005,8:36:49 AM,Thread ID# 1;
> 3/9/2005,8:36:48 AM,Thread ID# 0;
> 3/9/2005,8:36:45 AM,Thread ID# 1;
> 3/9/2005,8:36:45 AM,Thread ID# 0;
> 3/9/2005,8:36:42 AM,Thread ID# 0;
> 3/9/2005,8:36:42 AM,Thread ID# 1;
> 3/9/2005,8:36:39 AM,Thread ID# 0;
> 3/9/2005,8:36:39 AM,Thread ID# 1;
> 3/9/2005,8:36:36 AM,Thread ID# 1;
> 3/9/2005,8:36:33 AM,Thread ID# 1;
> 3/9/2005,8:36:30 AM,Thread ID# 1;
> 3/9/2005,8:36:27 AM,Thread ID# 1;
> 3/9/2005,8:36:26 AM,Thread ID# 0;
> 3/9/2005,8:36:23 AM,Thread ID# 1;
> 3/9/2005,8:36:22 AM,Thread ID# 0;
> 3/9/2005,8:36:20 AM,Thread ID# 1;
> 3/9/2005,8:36:18 AM,Thread ID# 0;
> 3/9/2005,8:36:17 AM,Thread ID# 1;
> 3/9/2005,8:36:14 AM,Thread ID# 0;
> 3/9/2005,8:36:14 AM,Thread ID# 1;
> 3/9/2005,8:36:10 AM,Thread ID# 1;
> 3/9/2005,8:36:10 AM,Thread ID# 0;
> 3/9/2005,8:36:07 AM,Thread ID# 1;
> 3/9/2005,8:36:06 AM,Thread ID# 0;
> 3/9/2005,8:36:04 AM,Thread ID# 1;
> 3/9/2005,8:36:02 AM,Thread ID# 0;
> 3/9/2005,8:36:01 AM,Thread ID# 1;
> 3/9/2005,8:35:58 AM,Thread ID# 0;
> 3/9/2005,8:35:57 AM,Thread ID# 1;
> 3/9/2005,8:35:54 AM,Thread ID# 1;
> 3/9/2005,8:35:54 AM,Thread ID# 0;
> 3/9/2005,8:35:51 AM,Thread ID# 1;
> 3/9/2005,8:35:50 AM,Thread ID# 0;
> 3/9/2005,8:35:48 AM,Thread ID# 1;
> 3/9/2005,8:35:46 AM,Thread ID# 0;
> 3/9/2005,8:35:45 AM,Thread ID# 1;
> 3/9/2005,8:35:43 AM,Thread ID# 0;
> 3/9/2005,8:35:42 AM,Thread ID# 1;
> 3/9/2005,8:35:40 AM,Thread ID# 0;
> 3/9/2005,8:35:38 AM,Thread ID# 1;
> 3/9/2005,8:35:37 AM,Thread ID# 0;
> 3/9/2005,8:35:35 AM,Thread ID# 1;
> 3/9/2005,8:35:34 AM,Thread ID# 0;
> 3/9/2005,8:35:32 AM,Thread ID# 1;
> 3/9/2005,8:35:31 AM,Thread ID# 0;
> 3/9/2005,8:35:29 AM,Thread ID# 1;
> 3/9/2005,8:35:28 AM,Thread ID# 0;
> 3/9/2005,8:35:26 AM,Thread ID# 1;
> 3/9/2005,8:35:25 AM,Thread ID# 0;
> 3/9/2005,8:35:23 AM,Thread ID# 1;
> 3/9/2005,8:35:21 AM,Thread ID# 0;
> 3/9/2005,8:35:20 AM,Thread ID# 1;
> 3/9/2005,8:35:18 AM,Thread ID# 0;
> 3/9/2005,8:35:16 AM,Thread ID# 1;
> 3/9/2005,8:35:15 AM,Thread ID# 0;
> 3/9/2005,8:35:13 AM,Thread ID# 1;
> 3/9/2005,8:35:12 AM,Thread ID# 0;
> 3/9/2005,8:35:10 AM,Thread ID# 1;
> 3/9/2005,8:35:09 AM,Thread ID# 0;
> 3/9/2005,8:35:07 AM,Thread ID# 1;
> 3/9/2005,8:35:06 AM,Thread ID# 0;
> 3/9/2005,8:35:03 AM,Thread ID# 1;
> 3/9/2005,8:35:03 AM,Thread ID# 0;
> 3/9/2005,8:35:00 AM,Thread ID# 1;
> 3/9/2005,8:35:00 AM,Thread ID# 0;
> 3/9/2005,8:34:57 AM,Thread ID# 1;
> 3/9/2005,8:34:57 AM,Thread ID# 0;
> 3/9/2005,8:34:54 AM,Thread ID# 1;
> 3/9/2005,8:34:54 AM,Thread ID# 0;
> 3/9/2005,8:34:51 AM,Thread ID# 1;
> 3/9/2005,8:34:51 AM,Thread ID# 0;
> 3/9/2005,8:34:48 AM,Thread ID# 1;
> 3/9/2005,8:34:48 AM,Thread ID# 0;
> 3/9/2005,8:34:45 AM,Thread ID# 1;
> 3/9/2005,8:34:45 AM,Thread ID# 0;
> 3/9/2005,8:34:42 AM,Thread ID# 1;
> 3/9/2005,8:34:41 AM,Thread ID# 0;
> 3/9/2005,8:34:38 AM,Thread ID# 1;
> 3/9/2005,8:34:38 AM,Thread ID# 0;
> 3/9/2005,8:34:23 AM,ASP.NET 1.1.4322.0,Error,1000,N/A,aspnet_wp.exe (PID:
> 3796) stopped unexpectedly.
>
> "bruce barker" wrote:
> > then try
> > while true
> > try
> > ... your thread code
> > catch
> > try
> > log error
> > catch
> > .. can't log
> > end try
> > end try
> > end while
> > note: your thread will be running with the asp.net worker process id, and
> > will have limited permissions.
> > -- bruce (sqlwork.com)
> > "mareal" <m@.m.com> wrote in message
> > news:6D2FC2CE-2FC8-40C9-A073-A02C859511F4@.microsoft.com...
> > | Hello Bruce. I am sure I am catching all errors:
> > |
> > | System.Threading.SynchronizationLockException
> > | System.Threading.ThreadAbortException
> > | System.Threading.ThreadInterruptedException
> > | System.Threading.ThreadStateException
> > | System.Exception
> > |
> > | The looping structure is a
> > |
> > | While True
> > | ... (local code)
> > | ... Call another method
> > | ... (+ local code)
> > | End While
> > |
> > | I have not added an exit trigger yet. I wanted to fix this problem first.
> > |
> > |
> > | "bruce barker" wrote:
> > |
> > | > what is the looping structure in your thread? are you sure you are
> > catching
> > | > all errors? what is its normal exit trigger?
> > | >
> > | > if you code it correctly a thread will run the life of the appdomain
> > its
> > | > created in.
> > | >
> > | > -- bruce (sqlwork.com)
> > | >
> > | >
> > | >
> > | >
> > | >
> > | > "mareal" <m@.m.com> wrote in message
> > | > news:E860CABF-18CE-4099-B44C-CB844EE57925@.microsoft.com...
> > | > | Thanks Kevin. The parent thread (as I understand it) is the aspnet_wp
> > | > process
> > | > | and as far I can tell, it is still running. The reason why I am saying
> > | > this
> > | > | is because I can access other ASP.NET applications on the same server.
> > I
> > | > have
> > | > | also checked the event log and I don't aspnet_wp being recycled. What
> > am I
> > | > | missing?
> > | > |
> > | > | "Kevin Spencer" wrote:
> > | > |
> > | > | > A thread stops running as soon as its parent thread stops running.
> > | > | >
> > | > | > --
> > | > | > HTH,
> > | > | >
> > | > | > Kevin Spencer
> > | > | > Microsoft MVP
> > | > | > ..Net Developer
> > | > | > What You Seek Is What You Get.
> > | > | >
> > | > | > "mareal" <m@.m.com> wrote in message
> > | > | > news:39C9F5D2-4988-4F95-A4C3-3EBF68E773FD@.microsoft.com...
> > | > | > >I have noticed how the thread I created just stops running. I have
> > | > added
> > | > | > > several exceptions to the thread
> > | > | > > | > | > > System.Threading.SynchronizationLockException
> > | > | > > System.Threading.ThreadAbortException
> > | > | > > System.Threading.ThreadInterruptedException
> > | > | > > System.Threading.ThreadStateException
> > | > | > > | > | > > to see if I could get more information about why the thread stops
> > | > running
> > | > | > > but that code is never executed. Any ideas on how I can debug
> > this?
> > | > | > > | > | > > Thanks in advance.
> > | > | > > | > | >
> > | > | >
> > | > | >
> > | >
> > | >
> > | >
Nice debugging work!

--
Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"mareal" <m@.m.com> wrote in message
news:078C5B1D-6B25-4E0E-B0B5-3B9326193A32@.microsoft.com...
>I found the problem. It was in the method being called by the thread. After
> adding tons of logging and bunch of catches I found it. Here are the
> details:
> One of my test cases was to simulate a server crash. During the crashing,
> if
> there was any communication that was already started by the client, it
> could
> not be finished. So the "waiting for data" routine went into an infinite
> loop.
> I also learned that the following command:
> sender.SetSocketOption(System.Net.Sockets.SocketOp tionLevel.Socket,
> System.Net.Sockets.SocketOptionName.ReceiveTimeout , 10000)
> does nothing if the server crashed right after the communication
> (client/server) started. So I added a timer in the "waiting for data"
> routine. When the time expires I exit the loop throwing an exception,
> which
> gives control back to the thread.
> Thank you Bruce, Kevin and Alvin.
> "mareal" wrote:
>> Hello Bruce and thank you for your suggestion. I did what you told me and
>> unfortunately nothing changed. I can still see one thread (I only created
>> two) dying. Look at the log I am outputting:
>>
>> The entry at the bottom represents me stopping the aspnet_wp.exe process.
>> Then you will thread 1 and 2. Around 8:37:04 is when thread 0 died...
>>
>> DATE,TIME,EVENT CONTENT
>>
>> 3/9/2005,8:38:49 AM,Thread ID# 1;
>> 3/9/2005,8:38:46 AM,Thread ID# 1;
>> 3/9/2005,8:38:42 AM,Thread ID# 1;
>> 3/9/2005,8:38:39 AM,Thread ID# 1;
>> 3/9/2005,8:38:36 AM,Thread ID# 1;
>> 3/9/2005,8:38:33 AM,Thread ID# 1;
>> 3/9/2005,8:38:30 AM,Thread ID# 1;
>> 3/9/2005,8:38:27 AM,Thread ID# 1;
>> 3/9/2005,8:38:24 AM,Thread ID# 1;
>> 3/9/2005,8:38:20 AM,Thread ID# 1;
>> 3/9/2005,8:38:17 AM,Thread ID# 1;
>> 3/9/2005,8:38:14 AM,Thread ID# 1;
>> 3/9/2005,8:38:11 AM,Thread ID# 1;
>> 3/9/2005,8:38:08 AM,Thread ID# 1;
>> 3/9/2005,8:38:05 AM,Thread ID# 1;
>> 3/9/2005,8:38:02 AM,Thread ID# 1;
>> 3/9/2005,8:37:58 AM,Thread ID# 1;
>> 3/9/2005,8:37:55 AM,Thread ID# 1;
>> 3/9/2005,8:37:52 AM,Thread ID# 1;
>> 3/9/2005,8:37:49 AM,Thread ID# 1;
>> 3/9/2005,8:37:46 AM,Thread ID# 1;
>> 3/9/2005,8:37:42 AM,Thread ID# 1;
>> 3/9/2005,8:37:39 AM,Thread ID# 1;
>> 3/9/2005,8:37:36 AM,Thread ID# 1;
>> 3/9/2005,8:37:33 AM,Thread ID# 1;
>> 3/9/2005,8:37:30 AM,Thread ID# 1;
>> 3/9/2005,8:37:27 AM,Thread ID# 1;
>> 3/9/2005,8:37:24 AM,Thread ID# 1;
>> 3/9/2005,8:37:21 AM,Thread ID# 1;
>> 3/9/2005,8:37:17 AM,Thread ID# 1;
>> 3/9/2005,8:37:14 AM,Thread ID# 1;
>> 3/9/2005,8:37:11 AM,Thread ID# 1;
>> 3/9/2005,8:37:08 AM,Thread ID# 1;
>> 3/9/2005,8:37:04 AM,Thread ID# 1;
>> 3/9/2005,8:37:04 AM,Thread ID# 0;
>> 3/9/2005,8:37:01 AM,Thread ID# 1;
>> 3/9/2005,8:37:01 AM,Thread ID# 0;
>> 3/9/2005,8:36:58 AM,Thread ID# 1;
>> 3/9/2005,8:36:58 AM,Thread ID# 0;
>> 3/9/2005,8:36:55 AM,Thread ID# 1;
>> 3/9/2005,8:36:54 AM,Thread ID# 0;
>> 3/9/2005,8:36:52 AM,Thread ID# 1;
>> 3/9/2005,8:36:51 AM,Thread ID# 0;
>> 3/9/2005,8:36:49 AM,Thread ID# 1;
>> 3/9/2005,8:36:48 AM,Thread ID# 0;
>> 3/9/2005,8:36:45 AM,Thread ID# 1;
>> 3/9/2005,8:36:45 AM,Thread ID# 0;
>> 3/9/2005,8:36:42 AM,Thread ID# 0;
>> 3/9/2005,8:36:42 AM,Thread ID# 1;
>> 3/9/2005,8:36:39 AM,Thread ID# 0;
>> 3/9/2005,8:36:39 AM,Thread ID# 1;
>> 3/9/2005,8:36:36 AM,Thread ID# 1;
>> 3/9/2005,8:36:33 AM,Thread ID# 1;
>> 3/9/2005,8:36:30 AM,Thread ID# 1;
>> 3/9/2005,8:36:27 AM,Thread ID# 1;
>> 3/9/2005,8:36:26 AM,Thread ID# 0;
>> 3/9/2005,8:36:23 AM,Thread ID# 1;
>> 3/9/2005,8:36:22 AM,Thread ID# 0;
>> 3/9/2005,8:36:20 AM,Thread ID# 1;
>> 3/9/2005,8:36:18 AM,Thread ID# 0;
>> 3/9/2005,8:36:17 AM,Thread ID# 1;
>> 3/9/2005,8:36:14 AM,Thread ID# 0;
>> 3/9/2005,8:36:14 AM,Thread ID# 1;
>> 3/9/2005,8:36:10 AM,Thread ID# 1;
>> 3/9/2005,8:36:10 AM,Thread ID# 0;
>> 3/9/2005,8:36:07 AM,Thread ID# 1;
>> 3/9/2005,8:36:06 AM,Thread ID# 0;
>> 3/9/2005,8:36:04 AM,Thread ID# 1;
>> 3/9/2005,8:36:02 AM,Thread ID# 0;
>> 3/9/2005,8:36:01 AM,Thread ID# 1;
>> 3/9/2005,8:35:58 AM,Thread ID# 0;
>> 3/9/2005,8:35:57 AM,Thread ID# 1;
>> 3/9/2005,8:35:54 AM,Thread ID# 1;
>> 3/9/2005,8:35:54 AM,Thread ID# 0;
>> 3/9/2005,8:35:51 AM,Thread ID# 1;
>> 3/9/2005,8:35:50 AM,Thread ID# 0;
>> 3/9/2005,8:35:48 AM,Thread ID# 1;
>> 3/9/2005,8:35:46 AM,Thread ID# 0;
>> 3/9/2005,8:35:45 AM,Thread ID# 1;
>> 3/9/2005,8:35:43 AM,Thread ID# 0;
>> 3/9/2005,8:35:42 AM,Thread ID# 1;
>> 3/9/2005,8:35:40 AM,Thread ID# 0;
>> 3/9/2005,8:35:38 AM,Thread ID# 1;
>> 3/9/2005,8:35:37 AM,Thread ID# 0;
>> 3/9/2005,8:35:35 AM,Thread ID# 1;
>> 3/9/2005,8:35:34 AM,Thread ID# 0;
>> 3/9/2005,8:35:32 AM,Thread ID# 1;
>> 3/9/2005,8:35:31 AM,Thread ID# 0;
>> 3/9/2005,8:35:29 AM,Thread ID# 1;
>> 3/9/2005,8:35:28 AM,Thread ID# 0;
>> 3/9/2005,8:35:26 AM,Thread ID# 1;
>> 3/9/2005,8:35:25 AM,Thread ID# 0;
>> 3/9/2005,8:35:23 AM,Thread ID# 1;
>> 3/9/2005,8:35:21 AM,Thread ID# 0;
>> 3/9/2005,8:35:20 AM,Thread ID# 1;
>> 3/9/2005,8:35:18 AM,Thread ID# 0;
>> 3/9/2005,8:35:16 AM,Thread ID# 1;
>> 3/9/2005,8:35:15 AM,Thread ID# 0;
>> 3/9/2005,8:35:13 AM,Thread ID# 1;
>> 3/9/2005,8:35:12 AM,Thread ID# 0;
>> 3/9/2005,8:35:10 AM,Thread ID# 1;
>> 3/9/2005,8:35:09 AM,Thread ID# 0;
>> 3/9/2005,8:35:07 AM,Thread ID# 1;
>> 3/9/2005,8:35:06 AM,Thread ID# 0;
>> 3/9/2005,8:35:03 AM,Thread ID# 1;
>> 3/9/2005,8:35:03 AM,Thread ID# 0;
>> 3/9/2005,8:35:00 AM,Thread ID# 1;
>> 3/9/2005,8:35:00 AM,Thread ID# 0;
>> 3/9/2005,8:34:57 AM,Thread ID# 1;
>> 3/9/2005,8:34:57 AM,Thread ID# 0;
>> 3/9/2005,8:34:54 AM,Thread ID# 1;
>> 3/9/2005,8:34:54 AM,Thread ID# 0;
>> 3/9/2005,8:34:51 AM,Thread ID# 1;
>> 3/9/2005,8:34:51 AM,Thread ID# 0;
>> 3/9/2005,8:34:48 AM,Thread ID# 1;
>> 3/9/2005,8:34:48 AM,Thread ID# 0;
>> 3/9/2005,8:34:45 AM,Thread ID# 1;
>> 3/9/2005,8:34:45 AM,Thread ID# 0;
>> 3/9/2005,8:34:42 AM,Thread ID# 1;
>> 3/9/2005,8:34:41 AM,Thread ID# 0;
>> 3/9/2005,8:34:38 AM,Thread ID# 1;
>> 3/9/2005,8:34:38 AM,Thread ID# 0;
>> 3/9/2005,8:34:23 AM,ASP.NET 1.1.4322.0,Error,1000,N/A,aspnet_wp.exe
>> (PID:
>> 3796) stopped unexpectedly.
>>
>>
>> "bruce barker" wrote:
>>
>> > then try
>>> > while true
>> > try
>> > ... your thread code
>> > catch
>> > try
>> > log error
>> > catch
>> > .. can't log
>> > end try
>> > end try
>> > end while
>>> > note: your thread will be running with the asp.net worker process id,
>> > and
>> > will have limited permissions.
>>> > -- bruce (sqlwork.com)
>>> > "mareal" <m@.m.com> wrote in message
>> > news:6D2FC2CE-2FC8-40C9-A073-A02C859511F4@.microsoft.com...
>> > | Hello Bruce. I am sure I am catching all errors:
>> > |
>> > | System.Threading.SynchronizationLockException
>> > | System.Threading.ThreadAbortException
>> > | System.Threading.ThreadInterruptedException
>> > | System.Threading.ThreadStateException
>> > | System.Exception
>> > |
>> > | The looping structure is a
>> > |
>> > | While True
>> > | ... (local code)
>> > | ... Call another method
>> > | ... (+ local code)
>> > | End While
>> > |
>> > | I have not added an exit trigger yet. I wanted to fix this problem
>> > first.
>> > |
>> > |
>> > | "bruce barker" wrote:
>> > |
>> > | > what is the looping structure in your thread? are you sure you are
>> > catching
>> > | > all errors? what is its normal exit trigger?
>> > | >
>> > | > if you code it correctly a thread will run the life of the
>> > appdomain
>> > its
>> > | > created in.
>> > | >
>> > | > -- bruce (sqlwork.com)
>> > | >
>> > | >
>> > | >
>> > | >
>> > | >
>> > | > "mareal" <m@.m.com> wrote in message
>> > | > news:E860CABF-18CE-4099-B44C-CB844EE57925@.microsoft.com...
>> > | > | Thanks Kevin. The parent thread (as I understand it) is the
>> > aspnet_wp
>> > | > process
>> > | > | and as far I can tell, it is still running. The reason why I am
>> > saying
>> > | > this
>> > | > | is because I can access other ASP.NET applications on the same
>> > server.
>> > I
>> > | > have
>> > | > | also checked the event log and I don't aspnet_wp being recycled.
>> > What
>> > am I
>> > | > | missing?
>> > | > |
>> > | > | "Kevin Spencer" wrote:
>> > | > |
>> > | > | > A thread stops running as soon as its parent thread stops
>> > running.
>> > | > | >
>> > | > | > --
>> > | > | > HTH,
>> > | > | >
>> > | > | > Kevin Spencer
>> > | > | > Microsoft MVP
>> > | > | > ..Net Developer
>> > | > | > What You Seek Is What You Get.
>> > | > | >
>> > | > | > "mareal" <m@.m.com> wrote in message
>> > | > | > news:39C9F5D2-4988-4F95-A4C3-3EBF68E773FD@.microsoft.com...
>> > | > | > >I have noticed how the thread I created just stops running. I
>> > have
>> > | > added
>> > | > | > > several exceptions to the thread
>> > | > | >> > | > | > > System.Threading.SynchronizationLockException
>> > | > | > > System.Threading.ThreadAbortException
>> > | > | > > System.Threading.ThreadInterruptedException
>> > | > | > > System.Threading.ThreadStateException
>> > | > | >> > | > | > > to see if I could get more information about why the thread
>> > stops
>> > | > running
>> > | > | > > but that code is never executed. Any ideas on how I can debug
>> > this?
>> > | > | >> > | > | > > Thanks in advance.
>> > | > | >> > | > | >
>> > | > | >
>> > | > | >
>> > | >
>> > | >
>> > | >
>>>