General Network Error

.Net SqlClient sometimes throws a General Network Error during a DataAdapter.Fill or DataReader.Read. This is starting to become extremely annoying. Several other people are having troubles with it so I know it’s not just me (post #1, post #2, post #3). The question remains wtf is going on.

I’ve checked the code inside of the SqlClient classes using Remotesoft’s .NET Explorer and it seems the the Fill method dies during a ReadString call in the ProcessMetaData method. ReadString is used to read a column value from the Connection. So it looks like the data is not avalible. btw: ReadString calls ReadByteArray, which in turns calls ReadBuffer. Now ReadBuffer starts to looks dangerous, not only is there code to handle buffer wrap around, but it calls the ReadNetlib. I’m not sure which inBytesPacket it ends up jumping into, but ReadNetlib either expects 1 or 8 bytes. ReadNetlib calls the dbnetlib call which is obviously the jump out to unmanaged space.

I’ve even seen this General Network Error problem coming up [in google] even for raw dbnetlib code.

I can only think to catch this exception better and try and pull some of the more specific SQLException details to display them.

3 comments on “General Network Error

  1. OK, I am also one of the not so few who as this annoying problem. Probably due to my messy home network where my Sql Server resides. Everything was fine for a few days and then General Network Error on some of my ASP.NET pages. I tried all the fixes, pool size, timeouts, etc. The answer is this: You have to use OleDb instead of SqlClient.

    –snip–

    Oh now I’m really mad. That didn’t work either, I get a new error: [DBNETLIB][ConnectionWrite (send()).]General network error. Check your network documentation.

    –snip–

    My workaround for now: I turned my query into a stored procedure, changing the commandtype, of course too and now Ole and Sql do not choke with all these dumb errors. I tested both using Ole and using Sql and sure enough in both ASP.NET pages where I had this problem I was using just slightly complex queries, nothing too fancy, but more than the usual and converting them to stored procedures was enough of a fix that things run smoothly now. Kind of like just giving the car a little tune up to get it running again. This is definitely a Microsoft issue and I’m surprised that they are not ‘fessing up to it.

  2. Heh, wait till you get to .Net 2.0 and SQL 2005. MS have removed the General Network Error, and replaced it with the fact that sometimes (I’m guessing whenever the General Network Error used to occur), you just get no data back from a SQL call.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>