Question on Program Hanging

M

Microsoft

Hi

I have a c# program that continually runs 24/7 and performs a variety of
tasks based on a timer.

There is one routine that hangs every Saturday morning without fail. If I
restart the program throughout the week is still hangs. I can restart it
immediatly after the hang and it runs fine until next Saturday.

There is nothing different about Saturday that I can think of.

Any help tracking this down would be appreciated!


Thanks

Robert



Here is the code snip:

af.AddToFile(Constants.c_LogFile,DateTime.Now.ToString() + " Start Grab New
Invoices") ; // Simply writes out to a log file

ds = gds.GrabTheData("NewInvoices"); // ar_GetEmailInvoice01 - Puts data
into a dataset

af.AddToFile(Constants.c_LogFile,DateTime.Now.ToString() + " End Grab New
Invoices") ;

af.AddToFile(Constants.c_LogFile, DateTime.Now.ToString() + " Start For
each");

af.AddToFile(Constants.c_LogFile, DateTime.Now.ToString() + " Start For each
Next");



// ****************************************** HANGS Here or

tempRowCount = ds.Tables[0].Rows.Count;

// ****************************************** HANGS Here

af.AddToFile(Constants.c_LogFile, DateTime.Now.ToString() + " Row Count " +
tempRowCount.ToString() ) ;

foreach (DataRow dr in ds.Tables[0].Rows)

{

af.AddToFile(Constants.c_LogFile,DateTime.Now.ToString() + " Email the
Invoice") ;

CreateInvoice(dr["CustNum"].ToString(),dr["OrdNum"].ToString()) ;

EmailInvoice(dr["CustNum"].ToString(),dr["OrdNum"].ToString()) ;



gds.CustNum = dr["CustNum"].ToString() ;

gds.QuoteNum = dr["OrdNum"].ToString() ;

gds.UpdateTheData("InvoicesEmailed") ;

}

af.AddToFile(Constants.c_LogFile,DateTime.Now.ToString() + " Exiting") ;
 
I

Ignacio Machin ( .NET/ C# MVP )

Hi

I have a c# program that continually runs 24/7 and performs a variety of
tasks based on a timer.

There is one routine that hangs every Saturday morning without fail. If I
restart the program throughout the week is still hangs. I can restart it
immediatly after the hang and it runs fine until next Saturday.

What error are you getting?
Check AppDomain.UnhandledException
 
S

Steven Cheng [MSFT]

Hi Robert,

As for such hang behavior problem, generally, if we can not get clear clus
from code logic, it will require some debugging work on it (such as find
the blocking thread and resource).

Not sure whether you've already read some about managed debugging on
application hang, here are some good blog article about managed debugging:

#.NET Debugging Demos Lab 1: Hang
http://blogs.msdn.com/tess/archive/2008/02/04/net-debugging-demos-lab-1-hang
.aspx

#.NET Hang Debugging Walkthrough
http://blogs.msdn.com/tess/archive/2006/10/16/net-hang-debugging-walkthrough
.aspx

BTW, as you provided the code snippet and the potential block point, how
did you originally track down to it? Also, it seems there are many method
calls on a custom class, has it accessed any particular resource or objects
that may cause problem?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Microsoft" <[email protected]>
Subject: Question on Program Hanging
Date: Tue, 13 May 2008 12:22:45 -0400
Hi

I have a c# program that continually runs 24/7 and performs a variety of
tasks based on a timer.

There is one routine that hangs every Saturday morning without fail. If I
restart the program throughout the week is still hangs. I can restart it
immediatly after the hang and it runs fine until next Saturday.

There is nothing different about Saturday that I can think of.

Any help tracking this down would be appreciated!


Thanks

Robert



Here is the code snip:

af.AddToFile(Constants.c_LogFile,DateTime.Now.ToString() + " Start Grab New
Invoices") ; // Simply writes out to a log file

ds = gds.GrabTheData("NewInvoices"); // ar_GetEmailInvoice01 - Puts data
into a dataset

af.AddToFile(Constants.c_LogFile,DateTime.Now.ToString() + " End Grab New
Invoices") ;

af.AddToFile(Constants.c_LogFile, DateTime.Now.ToString() + " Start For
each");

af.AddToFile(Constants.c_LogFile, DateTime.Now.ToString() + " Start For each
Next");



// ****************************************** HANGS Here or

tempRowCount = ds.Tables[0].Rows.Count;

// ****************************************** HANGS Here

af.AddToFile(Constants.c_LogFile, DateTime.Now.ToString() + " Row Count " +
tempRowCount.ToString() ) ;

foreach (DataRow dr in ds.Tables[0].Rows)

{

af.AddToFile(Constants.c_LogFile,DateTime.Now.ToString() + " Email the
Invoice") ;

CreateInvoice(dr["CustNum"].ToString(),dr["OrdNum"].ToString()) ;

EmailInvoice(dr["CustNum"].ToString(),dr["OrdNum"].ToString()) ;



gds.CustNum = dr["CustNum"].ToString() ;

gds.QuoteNum = dr["OrdNum"].ToString() ;

gds.UpdateTheData("InvoicesEmailed") ;

}

af.AddToFile(Constants.c_LogFile,DateTime.Now.ToString() + " Exiting") ;
 
S

Steven Cheng [MSFT]

Hi Robert,

Have you got any progress on this issue or does those information help
some? Since such hanging or crash problem is likely to be hard for
troubleshooting, especially in production environment. If you still have no
luck on this and feel it an urgent issue, I would suggest you consider
contacting CSS for incident based support:

Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: (e-mail address removed) (Steven Cheng [MSFT])
Organization: Microsoft
Date: Wed, 14 May 2008 04:55:02 GMT
Subject: RE: Question on Program Hanging
Hi Robert,

As for such hang behavior problem, generally, if we can not get clear clus
from code logic, it will require some debugging work on it (such as find
the blocking thread and resource).

Not sure whether you've already read some about managed debugging on
application hang, here are some good blog article about managed debugging:

#.NET Debugging Demos Lab 1: Hang
http://blogs.msdn.com/tess/archive/2008/02/04/net-debugging-demos-lab-1-han g
.aspx

#.NET Hang Debugging Walkthrough
http://blogs.msdn.com/tess/archive/2006/10/16/net-hang-debugging-walkthroug h
.aspx

BTW, as you provided the code snippet and the potential block point, how
did you originally track down to it? Also, it seems there are many method
calls on a custom class, has it accessed any particular resource or objects
that may cause problem?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#noti f
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Microsoft" <[email protected]>
Subject: Question on Program Hanging
Date: Tue, 13 May 2008 12:22:45 -0400
Hi

I have a c# program that continually runs 24/7 and performs a variety of
tasks based on a timer.

There is one routine that hangs every Saturday morning without fail. If I
restart the program throughout the week is still hangs. I can restart it
immediatly after the hang and it runs fine until next Saturday.

There is nothing different about Saturday that I can think of.

Any help tracking this down would be appreciated!


Thanks

Robert



Here is the code snip:

af.AddToFile(Constants.c_LogFile,DateTime.Now.ToString() + " Start Grab New
Invoices") ; // Simply writes out to a log file

ds = gds.GrabTheData("NewInvoices"); // ar_GetEmailInvoice01 - Puts data
into a dataset

af.AddToFile(Constants.c_LogFile,DateTime.Now.ToString() + " End Grab New
Invoices") ;

af.AddToFile(Constants.c_LogFile, DateTime.Now.ToString() + " Start For
each");

af.AddToFile(Constants.c_LogFile, DateTime.Now.ToString() + " Start For each
Next");



// ****************************************** HANGS Here or

tempRowCount = ds.Tables[0].Rows.Count;

// ****************************************** HANGS Here

af.AddToFile(Constants.c_LogFile, DateTime.Now.ToString() + " Row Count " +
tempRowCount.ToString() ) ;

foreach (DataRow dr in ds.Tables[0].Rows)

{

af.AddToFile(Constants.c_LogFile,DateTime.Now.ToString() + " Email the
Invoice") ;

CreateInvoice(dr["CustNum"].ToString(),dr["OrdNum"].ToString()) ;

EmailInvoice(dr["CustNum"].ToString(),dr["OrdNum"].ToString()) ;



gds.CustNum = dr["CustNum"].ToString() ;

gds.QuoteNum = dr["OrdNum"].ToString() ;

gds.UpdateTheData("InvoicesEmailed") ;

}

af.AddToFile(Constants.c_LogFile,DateTime.Now.ToString() + " Exiting") ;
 
Top