General network error.

  • Thread starter Thread starter Kevin Burton
  • Start date Start date
K

Kevin Burton

Does anyone here understand what a 'General network
error.' is? I have two machines one of them works
flawlessly, the other gives me errors intermittently
declaring a 'General network error.' in the SqlException.
I have looked in MSDN and found nothing really helpful.
One page suggested using the latest patch (which we
already have) another suggested disabling OLE DB pooling
(the connection string would not parse when we added "OLE
DB Services=-2"). I am at a loss. Any ideas?

Thank you.

Kevin
 
I've gotten them a few times and each time it was when either a NIC went bad
or the FileServer went down. Not sure if this is the problem, but it has
been in some cases with us.
 
I general terms, a General Network Error is just that.

It is saying that there there is a problem with your network rather than
there is a problem with your software.

You need to to start looking at the hardware involved, including (but not
definitive):

Network adaptor
Could be dying of old age
Could be flakey for any number of reasons

Cable connectors
Could be loose
Could be damaged (the old bent pin perhaps)

Jumper Cable
Is it the right rating (Cat4, Cat5, Cat6 etc)
Has it been kinked

State of the network
Is the machine on a particularly busy segment

Although a given piece of Cat4 cable might carry 100MB just fine, another
piece might not. I have also seen Cat6 cable that won't carry 100MB.

There are many other things that need to be considered and somethings have
to be considered together.
 
Thank you for your reply. At least I know that someone has
also received this error.

I don't think that the situation when I get the error and
when you have seen the error are the same. If the NIC went
bad it would either affect both machines trying to access
the database (if the NIC was the SQL server's NIC) or it
would affect every SQL query. Neither is the case here. I
only see it on one client machine and not all SQL calls
seem to be affected. I think it would be the same if the
FileServer was down.

Thanks again.

Kevin
 
I expect that this can also happen when the Ethernet collapses. The NIC
tries to send packets but has to wait if the wire is busy. It backs off for
a random length of time and retries for awhile. Other NICs are doing the
same thing--holding packets to be sent and waiting for a quiet wire.
However, when the number of packets exceeds the capacity and the NIC retry
count is exhausted and the NIC returns a message to the sender that there
was something wrong with the wire or the network hardware. This is why an
Ethernet won't go down (immediately) when the wire is disconnected. The best
thing you can do is back off, wait and retry.

Our Ethernet would go down like this when someone was running a program that
hogged the wire or flooded it with traffic (a game that sent a packet with
each movement of a mouse did it). It also failed when someone drove through
the parking garage--the radio antennas hit the raised ceiling and bumped the
Ethernet taps.

hth

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
I have actually seen this error when the NIC in the *client* machine is
starting to go bad and has intermittent problems.
If different SQL calls fail on that particular machine, but no other machine
has any problems, then this is a very probable case. If the exact same SQL
call is failing, which it doesn't sound like, then there might be some other
problem going on.
 
Stephany,

So how would you isolate the problem? I have used PerfMon to monitor network
traffic and I am not seeing any errors. If the network adaptor or other
hardware is failing how can I isolate the problem and get it fixed? This
thread is taking a turn that I did not anticipate but if you have any
suggestions as to how I can isolate the problem please let me know.

Thank you.

Kevin
 
I am not a Network Engineer but I would recommend that you consult one.

Taking what you said into account my starting point would be to find out
what the differences are between the machine where it works 'flawlessly' and
the machine where there are 'errors intermittently'.

Unfortunately it is a fact of life that intermittent errors are the hardest
ones to track down.
 
Thank you for your input.

Although this does not specifically seem to address my
problem there are some similarities. Like the reference
below I have been unable to determine a "network" problem.
Also like the reference below I am using SqlCommand.
Unlike the reference below I am not using the "auto"
features. My program seems to consistently fail on one
particular instance of command. Is what I am trying to do
is count the rows that would be returned. Read only the
required rows. Write a record to the database indicating
that this query took place. The failure always seems to
happen on the final "write" command and only in one
particular instance where the "history" or "write" command
is preceeded by a rather lengthy query using DataReader.

Kevin
 
Hi Kevin,

the problem I was experiencing was not directly related to using the
"auto features". It occurred (not always) when a stored procedure was
called with wrong parameters.

For example I had a stored procedure with a VarChar parameter. When
preparing the SqlCommand object, I added a NVarChar parameter (instead
of VarChar). When calling ExecuteReader, I got the "general network
error" exception (sometimes, might have depended on the number of
characters passed in the parameter).

I also think, that the problem started to occur after updating my sql
server 2000 to SP3 plus some cumulative update (but I'm not sure about
this).

Martin
 
FYI.


The more I test the more I feel is is not a network
problem.

I have been able to get it to consistently fail in one
routine and with virtually the same stack trace:

11
Type: System.Data.SqlClient.SqlException
Source: .Net SqlClient Data Provider
Target Site: Void InternalClose(Boolean)
Description: General network error. Check your network
documentation.
Stack Trace: at
System.Data.SqlClient.SqlDataReader.InternalClose(Boolean
closeReader)
at System.Data.SqlClient.SqlDataReader.Close()
at visa.dps.ppc.data.SearchRequest.Execute() in
d:\projects\visa\serializationtest\dataaccessxml\search.cs:
line 2005

It fails at InternalClose almost every time. (I do get
some timeout errors).

The stack trace points to reader.Close(). I am calling
ExecuteReader(CommandBehavior.CloseConnection |
CommandBehavior.SingleResult) so the connection
is "automatically" supposed to close. I get this error on
InternalClose if I specify the command behavior or use the
default and manually close the connection.


Kevin
 
Kevin,

I think we would all be very interested to see the portion of code that you
are talking about here.
In your statement,
particular instance of command. Is what I am trying to do
is count the rows that would be returned. Read only the
required rows. Write a record to the database indicating
that this query took place. The failure always seems to

My question would be, how are you 'counting' the rows, then 'reading only
the required rows', then 'writing a record to the database'. With this in
mind, and without seeing the code, I would say that there is no way to
'count the rows', then go back to read the proper rows, and I would say to
make sure you have a reader.close() after your read loop, and check to see
if you are reusing the same connection to execute the database write that
your reader is using?
 
You asked for it:

Here is the stack trace for a typical error:

Type: System.Data.SqlClient.SqlException
Source: .Net SqlClient Data Provider
Target Site: System.Data.SqlClient.SqlDataReader
ExecuteReader(System.Data.CommandBehavior,
System.Data.SqlClient.RunBehavior, Boolean)
Description: General network error. Check your network
documentation.
Stack Trace: at
System.Data.SqlClient.SqlCommand.ExecuteReader
(CommandBehavior cmdBehavior, RunBehavior runBehavior,
Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteScalar()
at data.SearchRequest.Execute() in
DataAccessXml\Search.cs:line 1965

This points to the following code:

try
{
Debug.WriteLineIf(ts.TraceInfo,
LogMessages.FormatMessage("DATA0128I"),
ErrorCategories.Info);

if(startRow == 0)
{
int totalRecords = 0;

Debug.Indent();
Debug.WriteLineIf(ts.TraceInfo,
LogMessages.FormatMessage("DATA0129I"),
ErrorCategories.Info);

using(SqlConnection connection =
new SqlConnection(connectString))
{
connection.Open();
SqlCommand countCommand =
connection.CreateCommand();
countCommand.CommandType =
CommandType.Text;
countCommand.CommandText =
searchCriteria.CountQuery;
totalRecords = (int)
countCommand.ExecuteScalar();
Debug.WriteLineIf
(ts.TraceInfo, LogMessages.FormatMessage("DATA0130I",
totalRecords), ErrorCategories.Info);
reply.TotalRows =
Convert.ToString(totalRecords);
Debug.WriteLineIf
(ts.TraceInfo, LogMessages.FormatMessage("DATA0133I"),
ErrorCategories.Info);

searchCriteria.HistoryInitialization(ref countCommand);

countCommand.ExecuteNonQuery();

connection.Close();
}
Debug.Unindent();
}


using(SqlConnection
connection = new SqlConnection(connectString))
{
connection.Open();
SqlCommand
queryCommand = connection.CreateCommand();

queryCommand.CommandType = CommandType.Text;

queryCommand.CommandText = searchCriteria.Query;

using
(SqlDataReader reader = queryCommand.ExecuteReader())
{
// skip
over the rows until start
bool
moreRows = true;
for(int i
= 0; i < startRow && moreRows == true; i++)
{

moreRows = reader.Read();
}

int
rowCount = 0;
ArrayList
rows = new ArrayList();
while
(reader.Read())
{
//
Copy the results

Column[] results = new Column[reader.FieldCount];
for
(int i = 0; i < reader.FieldCount; i++)
{

results = new Column();

results.Id = reader.GetName(i);

results.ColumnValue = reader.GetValue(i);

if(Convert.IsDBNull(results.ColumnValue))

results.ColumnValue = null;
}

Row row = new Row();

row.Index = rows.Count;

row.Columns = results;

rows.Add(row);


rowCount++;
if
(rowCount >= maxRows)

break;
}

reply.SearchRows = (Row[])rows.ToArray(typeof
(Row));
}
}

Debug.WriteLineIf
(ts.TraceInfo, LogMessages.FormatMessage("DATA0134I"),
ErrorCategories.Info);

return reply;
}


Specificially the exception is thrown when I am "counting"
the rows with the ExecuteScalar call above.

I don't know if this helps or makes things more unclear.

Kevin
 
Ok, looking at your code, something that immediately stands out is...

connection.Open();
SqlCommand countCommand = connection.CreateCommand();
countCommand.CommandType = CommandType.Text;
countCommand.CommandText = searchCriteria.CountQuery;

--> totalRecords = (int)countCommand.ExecuteScalar();

Debug.WriteLineIf(ts.TraceInfo, LogMessages.FormatMessage("DATA0130I",
totalRecords), ErrorCategories.Info);
reply.TotalRows = Convert.ToString(totalRecords);
Debug.WriteLineIf(ts.TraceInfo, LogMessages.FormatMessage("DATA0133I"),
ErrorCategories.Info);

searchCriteria.HistoryInitialization(ref countCommand);

--> countCommand.ExecuteNonQuery();
connection.Close();

Not sure, but isn't some sort of error generated here because the recordset
is either returning a scalar or not?
Don't know if you modify the countCommand object in the
HistoryInitialization to change the string.
If the countCommand *doesnt* return any rows, then you would get an error I
assume.
From the documentation, at least 1 row, 1 column must be returned for the
ExecuteScalar to work, it does not go off the sql "return" statement.

Kevin Burton said:
You asked for it:

Here is the stack trace for a typical error:

Type: System.Data.SqlClient.SqlException
Source: .Net SqlClient Data Provider
Target Site: System.Data.SqlClient.SqlDataReader
ExecuteReader(System.Data.CommandBehavior,
System.Data.SqlClient.RunBehavior, Boolean)
Description: General network error. Check your network
documentation.
Stack Trace: at
System.Data.SqlClient.SqlCommand.ExecuteReader
(CommandBehavior cmdBehavior, RunBehavior runBehavior,
Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteScalar()
at data.SearchRequest.Execute() in
DataAccessXml\Search.cs:line 1965

This points to the following code:

try
{
Debug.WriteLineIf(ts.TraceInfo,
LogMessages.FormatMessage("DATA0128I"),
ErrorCategories.Info);

if(startRow == 0)
{
int totalRecords = 0;

Debug.Indent();
Debug.WriteLineIf(ts.TraceInfo,
LogMessages.FormatMessage("DATA0129I"),
ErrorCategories.Info);

using(SqlConnection connection =
new SqlConnection(connectString))
{
connection.Open();
SqlCommand countCommand =
connection.CreateCommand();
countCommand.CommandType =
CommandType.Text;
countCommand.CommandText =
searchCriteria.CountQuery;
totalRecords = (int)
countCommand.ExecuteScalar();
Debug.WriteLineIf
(ts.TraceInfo, LogMessages.FormatMessage("DATA0130I",
totalRecords), ErrorCategories.Info);
reply.TotalRows =
Convert.ToString(totalRecords);
Debug.WriteLineIf
(ts.TraceInfo, LogMessages.FormatMessage("DATA0133I"),
ErrorCategories.Info);

searchCriteria.HistoryInitialization(ref countCommand);

countCommand.ExecuteNonQuery();

connection.Close();
}
Debug.Unindent();
}


using(SqlConnection
connection = new SqlConnection(connectString))
{
connection.Open();
SqlCommand
queryCommand = connection.CreateCommand();

queryCommand.CommandType = CommandType.Text;

queryCommand.CommandText = searchCriteria.Query;

using
(SqlDataReader reader = queryCommand.ExecuteReader())
{
// skip
over the rows until start
bool
moreRows = true;
for(int i
= 0; i < startRow && moreRows == true; i++)
{

moreRows = reader.Read();
}

int
rowCount = 0;
ArrayList
rows = new ArrayList();
while
(reader.Read())
{
//
Copy the results

Column[] results = new Column[reader.FieldCount];
for
(int i = 0; i < reader.FieldCount; i++)
{

results = new Column();

results.Id = reader.GetName(i);

results.ColumnValue = reader.GetValue(i);

if(Convert.IsDBNull(results.ColumnValue))

results.ColumnValue = null;
}

Row row = new Row();

row.Index = rows.Count;

row.Columns = results;

rows.Add(row);


rowCount++;
if
(rowCount >= maxRows)

break;
}

reply.SearchRows = (Row[])rows.ToArray(typeof
(Row));
}
}

Debug.WriteLineIf
(ts.TraceInfo, LogMessages.FormatMessage("DATA0134I"),
ErrorCategories.Info);

return reply;
}


Specificially the exception is thrown when I am "counting"
the rows with the ExecuteScalar call above.

I don't know if this helps or makes things more unclear.

Kevin

-----Original Message-----
Kevin,

I think we would all be very interested to see the portion of code that you
are talking about here.
In your statement,


My question would be, how are you 'counting' the rows, then 'reading only
the required rows', then 'writing a record to the database'. With this in
mind, and without seeing the code, I would say that there is no way to
'count the rows', then go back to read the proper rows, and I would say to
make sure you have a reader.close() after your read loop, and check to see
if you are reusing the same connection to execute the database write that
your reader is using?




.
 
The "count query" is SELECT COUNT(*) . . . so one row will always be
returned even if that row only contains 0. Right?

Kevin

Richard Brown said:
Ok, looking at your code, something that immediately stands out is...

connection.Open();
SqlCommand countCommand = connection.CreateCommand();
countCommand.CommandType = CommandType.Text;
countCommand.CommandText = searchCriteria.CountQuery;

--> totalRecords = (int)countCommand.ExecuteScalar();

Debug.WriteLineIf(ts.TraceInfo, LogMessages.FormatMessage("DATA0130I",
totalRecords), ErrorCategories.Info);
reply.TotalRows = Convert.ToString(totalRecords);
Debug.WriteLineIf(ts.TraceInfo, LogMessages.FormatMessage("DATA0133I"),
ErrorCategories.Info);

searchCriteria.HistoryInitialization(ref countCommand);

--> countCommand.ExecuteNonQuery();
connection.Close();

Not sure, but isn't some sort of error generated here because the recordset
is either returning a scalar or not?
Don't know if you modify the countCommand object in the
HistoryInitialization to change the string.
If the countCommand *doesnt* return any rows, then you would get an error I
assume.
From the documentation, at least 1 row, 1 column must be returned for the
ExecuteScalar to work, it does not go off the sql "return" statement.

Kevin Burton said:
You asked for it:

Here is the stack trace for a typical error:

Type: System.Data.SqlClient.SqlException
Source: .Net SqlClient Data Provider
Target Site: System.Data.SqlClient.SqlDataReader
ExecuteReader(System.Data.CommandBehavior,
System.Data.SqlClient.RunBehavior, Boolean)
Description: General network error. Check your network
documentation.
Stack Trace: at
System.Data.SqlClient.SqlCommand.ExecuteReader
(CommandBehavior cmdBehavior, RunBehavior runBehavior,
Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteScalar()
at data.SearchRequest.Execute() in
DataAccessXml\Search.cs:line 1965

This points to the following code:

try
{
Debug.WriteLineIf(ts.TraceInfo,
LogMessages.FormatMessage("DATA0128I"),
ErrorCategories.Info);

if(startRow == 0)
{
int totalRecords = 0;

Debug.Indent();
Debug.WriteLineIf(ts.TraceInfo,
LogMessages.FormatMessage("DATA0129I"),
ErrorCategories.Info);

using(SqlConnection connection =
new SqlConnection(connectString))
{
connection.Open();
SqlCommand countCommand =
connection.CreateCommand();
countCommand.CommandType =
CommandType.Text;
countCommand.CommandText =
searchCriteria.CountQuery;
totalRecords = (int)
countCommand.ExecuteScalar();
Debug.WriteLineIf
(ts.TraceInfo, LogMessages.FormatMessage("DATA0130I",
totalRecords), ErrorCategories.Info);
reply.TotalRows =
Convert.ToString(totalRecords);
Debug.WriteLineIf
(ts.TraceInfo, LogMessages.FormatMessage("DATA0133I"),
ErrorCategories.Info);

searchCriteria.HistoryInitialization(ref countCommand);

countCommand.ExecuteNonQuery();

connection.Close();
}
Debug.Unindent();
}


using(SqlConnection
connection = new SqlConnection(connectString))
{
connection.Open();
SqlCommand
queryCommand = connection.CreateCommand();

queryCommand.CommandType = CommandType.Text;

queryCommand.CommandText = searchCriteria.Query;

using
(SqlDataReader reader = queryCommand.ExecuteReader())
{
// skip
over the rows until start
bool
moreRows = true;
for(int i
= 0; i < startRow && moreRows == true; i++)
{

moreRows = reader.Read();
}

int
rowCount = 0;
ArrayList
rows = new ArrayList();
while
(reader.Read())
{
//
Copy the results

Column[] results = new Column[reader.FieldCount];
for
(int i = 0; i < reader.FieldCount; i++)
{

results = new Column();

results.Id = reader.GetName(i);

results.ColumnValue = reader.GetValue(i);

if(Convert.IsDBNull(results.ColumnValue))

results.ColumnValue = null;
}

Row row = new Row();

row.Index = rows.Count;

row.Columns = results;

rows.Add(row);


rowCount++;
if
(rowCount >= maxRows)

break;
}

reply.SearchRows = (Row[])rows.ToArray(typeof
(Row));
}
}

Debug.WriteLineIf
(ts.TraceInfo, LogMessages.FormatMessage("DATA0134I"),
ErrorCategories.Info);

return reply;
}


Specificially the exception is thrown when I am "counting"
the rows with the ExecuteScalar call above.

I don't know if this helps or makes things more unclear.

Kevin

-----Original Message-----
Kevin,

I think we would all be very interested to see the portion of code that you
are talking about here.
In your statement,

particular instance of command. Is what I am trying to do
is count the rows that would be returned. Read only the
required rows. Write a record to the database indicating
that this query took place. The failure always seems to

My question would be, how are you 'counting' the rows, then 'reading only
the required rows', then 'writing a record to the database'. With this in
mind, and without seeing the code, I would say that there is no way to
'count the rows', then go back to read the proper rows, and I would say to
make sure you have a reader.close() after your read loop, and check to see
if you are reusing the same connection to execute the database write that
your reader is using?

Thank you for your input.

Although this does not specifically seem to address my
problem there are some similarities. Like the reference
below I have been unable to determine a "network" problem.
Also like the reference below I am using SqlCommand.
Unlike the reference below I am not using the "auto"
features. My program seems to consistently fail on one
particular instance of command. Is what I am trying to do
is count the rows that would be returned. Read only the
required rows. Write a record to the database indicating
that this query took place. The failure always seems to
happen on the final "write" command and only in one
particular instance where the "history" or "write" command
is preceeded by a rather lengthy query using DataReader.

Kevin


-----Original Message-----
see also the following thread for a possible cause for
that error:

http://groups.google.com/groups?hl=de&lr=&ie=UTF- 8&oe=UTF-
8&threadm=eMQElmlcDHA.616%
40TK2MSFTNGP11.phx.gbl&rnum=1&prev=/groups%3Fie%3DUTF-8%
26oe%3DUTF-8%26as_umsgid%3DeMQElmlcDHA.616%
2540TK2MSFTNGP11.phx.gbl%26lr%3D%26hl%3Dde

HTH, Martin

Kevin Burton wrote:
Does anyone here understand what a 'General network
error.' is? I have two machines one of them works
flawlessly, the other gives me errors intermittently
declaring a 'General network error.' in the
SqlException.
I have looked in MSDN and found nothing really helpful.
One page suggested using the latest patch (which we
already have) another suggested disabling OLE DB
pooling
(the connection string would not parse when we
added "OLE
DB Services=-2"). I am at a loss. Any ideas?

Thank you.

Kevin

.



.

 
Back
Top