ExecuteReader Null exception in heavy traffic

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a created an application using web services and sql server. On my dev
server, it's working, but when I switched to the production server with
heavier traffic (100 users at the same time), I got this error:

System.NullReferenceException: Object reference not set to an instance of an
object.
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteReader()
at LiveSnapDotNet.server.database.BDSqlServer.executeSQLQuery(SqlCommand
sqlCommand)



Here's my code:

/* Opens a connection, sets the connection with new SqlConnection() */
openConnection();
if (connection != null)
{
try
{
/* Sets the command properties */
sqlCommand.Connection = connection;
sqlCommand.CommandType = CommandType.StoredProcedure;
sqlCommand.CommandText = "sp_getUsers"
/* Executes it */
resultSet = sqlCommand.ExecuteReader();
}
catch(Exception e)
{
...
}


Why this error keeps occuring when there's many users? DO I have to increase
the connection pool max size?

Thanks for any help.

Stephane
 
Stephanie,

Could this be a reentrancy issue? What is the possibility that the below
code is placed in a class that is being instance pooled? Is your code
threadsafe? Try putting a lock{} around the problematic code section.

- Sahil Malik
You can reach me thru my blog -
http://www.dotnetjunkies.com/weblog/sahilmalik
 
Back
Top