Occasional Timeout exception w/ Entity Framework
Posted: Tue 28 Jun 2011 14:21
Hi,
We have a couple of new web services that utilize Entity Framework with the Devart dotConnect for Oracle provider. While testing, we recently experienced a series of exceptions like this:
One of the things we think we did wrong was that we kept a member variable in our data access class to hold the DataContext, which was then used from our methods. We already changed this to:
But we're not confident that this is the solution to our problem. Does anyone have any other hints on what to check for to see if this solves the error or what else could cause this behavior?
Thanks!
We have a couple of new web services that utilize Entity Framework with the Devart dotConnect for Oracle provider. While testing, we recently experienced a series of exceptions like this:
Now the problem is that this error happens only occasionally, and usually early in the morning, when the service is called for the first time that day.System.Data.EntityException: The underlying provider failed on Open. ---> Devart.Data.Oracle.OracleException: Server did not respond within the specified timeout interval
at Devart.Data.Oracle.a5.a(ae A_0, a8 A_1)
at Devart.Data.Oracle.OracleInternalConnection..ctor(ae connectionOptions, OracleInternalConnection proxyConnection)
at Devart.Data.Oracle.cr.a(j A_0, Object A_1, DbConnectionBase A_2)
at Devart.Common.DbConnectionFactory.a(DbConnectionPool A_0, j A_1, DbConnectionBase A_2)
at Devart.Common.DbConnectionPool.a(DbConnectionBase A_0)
at Devart.Common.DbConnectionPool.GetObject(DbConnectionBase owningConnection)
at Devart.Common.DbConnectionFactory.a(DbConnectionBase A_0)
at Devart.Common.DbConnectionClosed.Open(DbConnectionBase outerConnection)
at Devart.Common.DbConnectionBase.Open()
at Devart.Data.Oracle.OracleConnection.Open()
at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure)
--- End of inner exception stack trace ---
at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure)
at System.Data.EntityClient.EntityConnection.Open()
at System.Data.Objects.ObjectContext.EnsureConnection()
at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable.GetEnumerator()
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source)
at System.Data.Objects.ELinq.ObjectQueryProvider.b__2[TResult](IEnumerable`1 sequence)
at System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)
at System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[S](Expression expression)
at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source)
One of the things we think we did wrong was that we kept a member variable in our data access class to hold the DataContext, which was then used from our methods. We already changed this to:
Code: Select all
public void SomeMethod()
{
using (var ctx = new DataContext())
{
// do operations
}
}
Thanks!