Solved

Thread was being aborted exception with Web Service/SQL Server

Posted on 2003-11-13
13
2,957 Views
Last Modified: 2007-12-19
Hi

We have a C# web service which calls SPs (via the ADO.NET SqlCommand and SqlDataAdapter objects) to read data from a SQL Sever 2000 database.  We get the following exception intermittently

Thread was being aborted.
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)    
at System.Data.SqlClient.SqlCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)    
at System.Data.Common.DbDataAdapter.Fill(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)    
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable, IDbCommand command, CommandBehavior behavior)     at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)  

Our connection and command timeouts are set to 30 seconds.

If anyone can help, I'd greatly appreciate an explanation or (even better) a workaround

TIA
Wile_E
0
Comment
Question by:wile_e_coyote
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
13 Comments
 
LVL 42

Expert Comment

by:frodoman
ID: 9742198
Check your maximum concurrent connections on SQL Server.  Possibly this is intermittent because you're exceeding the max connections specified - your thread will wait for a free connection and then timeout if one isn't freed up.

0
 
LVL 5

Expert Comment

by:mondayblueboy
ID: 9746018
Do you have exception handler in the code? If yes, I suspect the error comes from a line in the try block. Post code might be helpful.

0
 
LVL 4

Author Comment

by:wile_e_coyote
ID: 9750586
Frodoman - I'm looking into your suggestion.

MondayBlueBoy - Here is (more or less) the code.   But take a look at the stack trace from above.  The error is occuring in the Fill method of the dataadapter.

DataSet ds = new DataSet();
SqlConnection cn = new SqlConnection (...);
SqlDataAdapter da = new SqlDataAdapter ();
da.SelectCommand = mySelectCmd;     //mySelectCmd is on the web service designer and is an SP call

try
{
  da.Fill (ds);
}
catch (Exception e)
...



0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 5

Expert Comment

by:mondayblueboy
ID: 9751466
Just one more q.
Is that all code in the try block?
0
 
LVL 4

Author Comment

by:wile_e_coyote
ID: 9751470
Yes
0
 
LVL 4

Author Comment

by:wile_e_coyote
ID: 9817968
Frodoman - our DBA says we are set up to allow unlimited connections
0
 
LVL 42

Expert Comment

by:frodoman
ID: 9818067
Possible user interaction during the time your fill is being executed?  Normally the "Thread being aborted" message occurs on a webform during a response.redirect / response.end type of execution (both of which always throw a ThreadAbortException).

I may be completely off base here, but if it's an intermittent problem is it possible that a user is clicking something during the fill that is causing the page to try to reload / change before the dataset is full?
0
 
LVL 4

Author Comment

by:wile_e_coyote
ID: 9818192
Naw - the error is reported by the web service (on the SqlDataAdapter.Fill call), not the UI (which is a windows forms app).
0
 
LVL 42

Expert Comment

by:frodoman
ID: 9818313
Sorry wile_e - Nothing else I can think of, but good luck solving it!
0
 
LVL 4

Author Comment

by:wile_e_coyote
ID: 9853437
Its worth an additional 250 points for me to make some progress on this.   Any takers?
0
 
LVL 4

Accepted Solution

by:
wile_e_coyote earned 0 total points
ID: 10236236
Turns out that the httpRuntime executionTimeout setting in the machine.config file on the web server was causing IIS to kill the thread after 90 seconds.   Increasing this setting resolved the problem

I'm going to request that this question be closed.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question