Note that there are some explanatory texts on larger screens.

plurals
  1. POEntity Framework timeout instantly
    text
    copied!<p>I have a very simple query on a 400 records database, however, if I do that query in a multi-threaded environment, it times out instantly, if I query it one by one, it works fine.</p> <p>I did not do anything special to connection string, SQL server is running locally.</p> <p>Each thread creates its own context and do the query within a <code>using</code> block.</p> <p>The first timeout takes about 15 seconds and then following queries timeout instantly.</p> <p>I tried to change timeout on CommandTimeout but did not work, and instant timeout looks suspicious, I think mgiht be good to dig it down further.</p> <p>The query is simply match by entity.Id. It seems it is nothing to do with the query itself as I changed the query multiple times to do different things.</p> <p>The exception says</p> <blockquote> <p>10/10/2011 3:52:16 p.m. T026 D Exception - The underlying provider failed on Open.</p> <p>10/10/2011 3:52:16 p.m. T026 D Inner Exception Message - Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.</p> <p>10/10/2011 3:52:16 p.m. T026 D at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean&amp; closeStoreConnectionOnFailure) at System.Data.EntityClient.EntityConnection.Open() at System.Data.Objects.ObjectContext.EnsureConnection() at System.Data.Objects.ObjectQuery<code>1.GetResults(Nullable</code>1 forMergeOption) at System.Data.Objects.ObjectQuery<code>1.System.Collections.Generic.IEnumerable&lt;T&gt;.GetEnumerator() at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable</code>1 source) at System.Data.Objects.ELinq.ObjectQueryProvider.b__2[TResult](IEnumerable<code>1 sequence) at System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable</code>1 query, Expression queryRoot) at System.Data.Objects.CompiledQuery.ExecuteQuery[TResult](ObjectContext context, Object[] parameterValues) at System.Data.Objects.CompiledQuery.Invoke[TArg0,TArg1,TResult](TArg0 arg0, TArg1 arg1)</p> </blockquote> <p>Has any body experienced the same or know the answer why is the instant timeout?</p> <p>Thanks in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload