Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Thread just stops running

Reply
Thread Tools

Thread just stops running

 
 
=?Utf-8?B?bWFyZWFs?=
Guest
Posts: n/a
 
      03-08-2005
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.

 
Reply With Quote
 
 
 
 
Alvin Bruney [ASP.NET MVP]
Guest
Posts: n/a
 
      03-08-2005
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" <> wrote in message
news:39C9F5D2-4988-4F95-A4C3-...
>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.
>



 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      03-08-2005
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" <> wrote in message
news:39C9F5D2-4988-4F95-A4C3-...
>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.
>



 
Reply With Quote
 
=?Utf-8?B?bWFyZWFs?=
Guest
Posts: n/a
 
      03-08-2005
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" <> wrote in message
> news:39C9F5D2-4988-4F95-A4C3-...
> >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.
> >

>
>
>

 
Reply With Quote
 
bruce barker
Guest
Posts: n/a
 
      03-08-2005
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" <> wrote in message
news:E860CABF-18CE-4099-B44C-...
| 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" <> wrote in message
| > news:39C9F5D2-4988-4F95-A4C3-...
| > >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.
| > >
| >
| >
| >


 
Reply With Quote
 
=?Utf-8?B?bWFyZWFs?=
Guest
Posts: n/a
 
      03-08-2005
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" <> wrote in message
> news:E860CABF-18CE-4099-B44C-...
> | 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" <> wrote in message
> | > news:39C9F5D2-4988-4F95-A4C3-...
> | > >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.
> | > >
> | >
> | >
> | >
>
>
>

 
Reply With Quote
 
bruce barker
Guest
Posts: n/a
 
      03-08-2005
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" <> wrote in message
news:6D2FC2CE-2FC8-40C9-A073-...
| 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" <> wrote in message
| > news:E860CABF-18CE-4099-B44C-...
| > | 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" <> wrote in message
| > | > news:39C9F5D2-4988-4F95-A4C3-...
| > | > >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.
| > | > >
| > | >
| > | >
| > | >
| >
| >
| >


 
Reply With Quote
 
=?Utf-8?B?bWFyZWFs?=
Guest
Posts: n/a
 
      03-09-2005
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" <> wrote in message
> news:6D2FC2CE-2FC8-40C9-A073-...
> | 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" <> wrote in message
> | > news:E860CABF-18CE-4099-B44C-...
> | > | 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" <> wrote in message
> | > | > news:39C9F5D2-4988-4F95-A4C3-...
> | > | > >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.
> | > | > >
> | > | >
> | > | >
> | > | >
> | >
> | >
> | >
>
>
>

 
Reply With Quote
 
=?Utf-8?B?bWFyZWFs?=
Guest
Posts: n/a
 
      03-09-2005
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" <> wrote in message
> > news:6D2FC2CE-2FC8-40C9-A073-...
> > | 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" <> wrote in message
> > | > news:E860CABF-18CE-4099-B44C-...
> > | > | 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" <> wrote in message
> > | > | > news:39C9F5D2-4988-4F95-A4C3-...
> > | > | > >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.
> > | > | > >
> > | > | >
> > | > | >
> > | > | >
> > | >
> > | >
> > | >
> >
> >
> >

 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      03-09-2005
Nice debugging work!

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

"mareal" <> wrote in message
news:078C5B1D-6B25-4E0E-B0B5-...
>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" <> wrote in message
>> > news:6D2FC2CE-2FC8-40C9-A073-...
>> > | 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" <> wrote in message
>> > | > news:E860CABF-18CE-4099-B44C-...
>> > | > | 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" <> wrote in message
>> > | > | > news:39C9F5D2-4988-4F95-A4C3-...
>> > | > | > >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.
>> > | > | > >
>> > | > | >
>> > | > | >
>> > | > | >
>> > | >
>> > | >
>> > | >
>> >
>> >
>> >



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Win a copy of the just::thread C++0x thread library Anthony Williams C++ 1 10-19-2009 08:43 PM
Stinger just stops running - why? dontspam@dontspam.dontspam Computer Support 11 12-04-2007 06:51 AM
Everything stops when a Thread is running on the server =?Utf-8?B?QW1yaXQgS29obGk=?= ASP .Net 4 07-31-2007 05:14 PM
Terminating program run from thread (not just the thread) Jeffrey Barish Python 0 05-28-2004 02:02 AM
Timer thread stops running Todd ASP .Net 4 04-08-2004 03:21 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57