Thread was being aborted error

D

Dave Morgereth

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(Comman
dBehavior 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.
 
K

Kevin Yu [MSFT]

Hi Dave,

Could you provide us with more information about the environment? Are you
using the clustering or load balancer? Can this exception always be
reproduced?

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
D

Dave Morgereth

We are not using clustering or load balancing. The exception is
intermittent and usually occurs under "heavy" load.

Thanks
Dave
 
K

Kevin Yu [MSFT]

Hi Dave

Thank you for using MSDN Newsgroup! My name is Kevin, and I will be
assisting you on this issue.

From your description, I understand that you received a "Thread was being
aborted." error message when filling a DataSet with a SqlDataAdapter. The
data source is a SQL Server 2000. Would please also tell me which version
of .net framework are you developing on? Do you share the dataset, command,
and adapter objects between threads or just working one a single thread?

If you're working a multi-threaded one, please try to check if you have
protected shared resource between threads. According to MSDN document,
DataSet type is safe for multithreaded read operations. We must synchronize
any write operations.

However, if the problem still persists, please help me collect more
information for further troubleshooting. Thanks.

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
D

Dave Morgereth

Thank you for your help Kevin

We are running v 1.0.3705 of the framework in both development and
production. We do not share the dataset, sqlcommand or adapter objects.
 
K

Kevin Yu [MSFT]

Hi Dave,

Based on my research, since the SQL command is executed within a Web
Service it could be that the Web Service execution timed out instead.

You may try increase the max execution time value in the httpRuntime
element in the machine.config file on the machine which provides the Web
Service, so that the Web Service will wait more time before timeouts. Here
are the steps:

1. Since you're using .NET framework v1.0.3705, the machine.config file has
to be in the directory: %windir%\Microsoft.NET\Framework\v1.0.3705\CONFIG

2. In the file, try to find the httpRuntime element. It looks like the
following:

<httpRuntime executionTimeout="90" maxRequestLength="4096"
useFullyQualifiedRedirectUrl="false" minFreeThreads="8"
minLocalRequestFreeThreads="4" appRequestQueueLimit="100"
enableVersionHeader="true"/>

Increase the executionTimeout attribute of that element to 180 or longer.

3. We have to reset IIS to make sure that the modifications will take
effect. Click Start -> Run, type "iisreset" and press enter.

If the problem still persists, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top