'Cannot find column' errors

Topics: Data Access Application Block
Feb 10, 2009 at 2:38 PM

I have a project that has been in production for a couple years now. It's a v3.5 ASP.NET web site hitting a SQL server 2008 database with ENTLIB 4.1. The last couple weeks, the website has been erroring out on various pages for about 1-2 hours at a time 3-4 times a week. The errors started after moving our site from a Windows 2003, SQL Server 2005. While the error messages are occurring, I cannot reproduce the errors.

Here are some of the error messages I recieve:

  • Cannot find column [ColumnName]
  • [ColumnName] is neither a DataColumn nor a DataRelation for table RESULT.
  • [ColumnName] (This is a wierd one. The error message returned is just a column name)
  • No record found
  • Column '[ColumnName]' does not belong to table RESULT.

I come to a dead end when I follow the Stack Trace to find a programmatic error.  I'm able to hit the same page with all the same form fields at the error occured on and I cannot reproduce.

The only consistentcy in these errors is that they come all at once and they are database related.

 Anyone have an issue like this before?
Feb 10, 2009 at 3:32 PM
Forgot to mention.

The only way to solve this, is to restart SQL server service.

We are running on 4 quadcore processors and 32 gb ram.
Feb 10, 2009 at 4:31 PM
Could we be facing these problems because we are using the standard prebuilt ent. lib., which is probably built for 32bit on a 64 bit windows 2008 server ?
Feb 11, 2009 at 6:17 AM
Hi,

Are you using stored procedure? when does this happen? can you provide more context or the error?

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com
Feb 13, 2009 at 5:25 PM
Hi Valiant,

Thank you for getting back to me on this.

One hour ago the error, just happend again.. I pulling my hair our here :(

We are using stored procedures all over, and the error starts with a:

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Stack Trace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at Microsoft.Practices.EnterpriseLibrary.Data.Database.DoExecuteReader(DbCommand command, CommandBehavior cmdBehavior) at Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteReader(DbCommand command) at .......

And then the errors written in my first post. The errors happens at multiple stored procedures and in all of my objects that use ent lib.

First i was under the impression that this could only be solved by restarting Sql Server, but i was wrong. This can be solved by restarting SQL server OR IIS. I just restarted IIS, and then everything went to normal.

This i really really wired. Everything was running fine on our old (slower) server, but after we transfered to this new and much faster 64bit server, we have experienced this.

I really hope that someone can help us with this, or we might have to rewrite all of our code to do database actions directly and not running through ent lib, as i think this is where the problem is.

Thanks for any input on this.
Feb 13, 2009 at 5:30 PM
Forgot to mention, that we only experience the 'Timeout expired. The timeout period elapsed prior...' error once, while the error occurs. After that, i get tons of column missing, column not belong to this table etc... We have also heard from customers today, that some of them are seeing other peoples data, so somehow is seems that objects in memory or something like that, are transfered between users. Again, everything disappears when resetting IIS.
Feb 13, 2009 at 5:34 PM
More info. We have both tried using the classic and integrated mode in the managed pipeline mode. Both modes produces this error from time to time.

When this error happens, we only see this error in this specific application. Other windows services or web applications, also using ent lib 4.1, does not produce these errors, so i seem to have come to the conclusion, that this is not something with sql server.
Feb 16, 2009 at 5:25 AM
Hi,

I'm just wondering, what could be the cause of the Timeout expired. Is it a long running stored procedure? On what database call do you encounter the timeout? try to run your sql on sql query analyzer and see how long it takes to run a certain stored procedure. Anyway, I read some post over the net, and some says that it can be caused by wrong connection string. see this: http://www.windows-tech.info/15/009510e9fe04c905.php ,. The connection timeout might have caused the other errors.

Also, you can try to isolate the issue, you can create a simple application that does database access using the DAAB and see if the error persist.

Last thing, Is the Database Server and the Web Server on the same machine? are you accessing your database remotely?


Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com
Feb 16, 2009 at 8:41 AM
Hi Valiant,

The stored procedure timing out is a stored procedure which takes 0 sec to run, and this SP is run 2-3000 times a day. This is a very simple select statement, and i can run this fine using the management studio fine, also when the errors is happening.

The database server and the web server is on the same machine.

One thing that is different from the old server and the new server is that, by a mistake i installed the new sql server 2008 as a named instance, so i had to change the way i connect to my sql server, using the connectionstring. Previously i used the IP address of the server, and now i use Servername\SqlServerName

Thanks for any input.
Feb 16, 2009 at 10:08 AM
This is wierd... have you tried my other suggestion? to create a simple project and deploy it to your server just to ensure that you are not having connectivity issue with the server. Anyway, i found this link, common resolution for Timeout Expired: http://www.tipsstation.com/article/Timeout-expired-server-is-not-responding-Asp-Dot-Net.aspx



Feb 16, 2009 at 10:23 AM
Yes, i have tried deploying a simple project to the server, and everything runs fine, so there is no connection problems as to what i can see. The thing is, that it can run for 24-48 hours, and then the errors starts, so i think this is something that 'builds up', and then the errors starts. i can then either restart sql server or IIS and then everything works for x number of hours again.
Feb 16, 2009 at 10:40 AM
So the app will run fine for the first 24-48 hours then you will encounter the first Timeout expired? i also think that something is build up. in your code, do you close your connection object after using it?
Feb 16, 2009 at 11:07 AM
The app runs fine for x number of hours. Sometimes it is 24 hours, sometimes 48 hours, sometimes 12 hours. I never know when this happens.

I was under the impression, that closing my sql server connections was not necessary when using ent lib, and having a using(myReader) ....end using around my reader reading. Then the reader would be disposed and closed, and my sql server connection put back in the pool after that. So no, im not explicitly closing my sql server connection after using it.

When returning a dataset i explicitly close and dispose that after usage.
Feb 17, 2009 at 4:04 AM
It is not necessary to close the connection when returning a dataset, only when returning a reader.  Just a thought also,  AFAIK,  Entlib will work whether in 32 or 64bit mode. I believed it is built to run on Any Platform, not specific to 32-bit.   However, there is a performance comparison documentation about this, I haven't checked it out yet, but see if you can find something - http://www.microsoft.com/downloads/details.aspx?familyid=35e2738a-79a3-4fa0-a9bf-06c52077592d&displaylang=en.   

It's hard to guess what's causing the error, try also to check your connection string.  What is the maximum number of connections in your pool? connection lifetime?


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com
Mar 2, 2009 at 8:20 PM
Just like to do a follow up on this thread.

A more detailed discussion about this problem can be found here: http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/74a5db87-c63f-4386-b317-e848dedb2cd9. The problems discussed here, is excatly the problems that we are facing. Unfortunatly, there have not been any solution to the problem. The only workaround have been to disable connection pooling, which i know is very bad for performance, but to see if this is the case, we are trying that for the moment. If this is the case, i think there is a bug in either ado.net or connection pooling mechanism somewhere.
Mar 3, 2009 at 4:36 AM
Hi,

Still in the original assumption that something builds up on the server. You can try setting higher MaxPoolSize. connection in the pool may have run out before the ASP.NET GC start reclaiming unused resource.

I also found some articles about the timeout exception:
http://msdn.microsoft.com/en-us/library/ms190181.aspx
http://www.mail-archive.com/aspnetanyquestionisok@yahoogroups.com/msg07010.html

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com