- Home
- LLBLGen Pro
- LLBLGen Pro Runtime Framework
GetDbCount and timeout
Joined: 27-Jul-2005
Below is code where I am getting a command timeout even though I have set the command timeout to 300 seconds while executing a scalar query from the TypedView class using the GetDbCount method. It is timing out at the default 30 seconds. I set the command timeout when the application starts and as I step through the code, I verify that it is still set at 300 just before executing the GetDbCount method. The SQL executes in Management Studio in 93 seconds and results in a count of 2880.
RuntimeBuild=04112013 RuntimeVersion=4.0.0.0
DaoClasses.CommonDaoBase.CommandTimeOut = 300
Dim CountCheck As New TypedViewClasses.RI_Grid_SearchResultsSampleWithCustomDataTypedView Dim Count As Integer = CountCheck.GetDbCount(False, predFilter)
Error:
{"An exception was caught during the execution of a retrieval query: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception."}
{"Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."}
SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException was caught HResult=-2146232832 Message=An exception was caught during the execution of a retrieval query: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception. QueryExecuted= Query: SELECT COUNT(*) AS NumberOfRows FROM (SELECT DISTINCT [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SampleID], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SampleAlternateID], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SampleHostIdent], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SampleHostID], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SampleHostDescription], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SampleDescription], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SampleSourceID], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SampleSourceDescription], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[LabID], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[LabName], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[DiagnosisID], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[DiagnosisDescription], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[FacilityID], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[FacilityName], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SampleTypeID], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SampleTypeDescription], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[AnatomicRegionID], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[AnatomicRegionDescription], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SampleSourceAspectID], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SampleSourceAspectDescription], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[TumorSize], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SizeUOMID], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SizeUOMDescription], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SampleWeight], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[WeightUOMID], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[WeightUOMDescription], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[Media], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SampleNote], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[CollectedDate], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[TransferDate], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SubjectId], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SubjectAlternateID], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SubjectHostIdent], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SubjectHostID], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SubjectHostDescription], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[GenderDescription], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SpeciesID], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SpeciesDescription], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[GenderID], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[YearOfBirth], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[Consented], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[BirthDate], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[DeathDate], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[NecropsyNumber], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SubjectLineID], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SubjectLineDescription], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SubjectStrainID], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SubjectStrainDescription], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SubjectNotes], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[Quantity], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[QuantityUOMDescription], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[QuantityUOMID], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[CustomDataKey], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[CustomDataValue], [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[IsRestricted] FROM [dbo].[RI_Grid_SearchResultsSampleWithCustomData] (nolock) WHERE ( ( [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[SampleID] IN (SELECT [dbo].[MetadataSample].[SampleID] FROM [dbo].[MetadataSample] (nolock) WHERE ( [dbo].[MetadataSample].[KeyID] = @p1 AND [dbo].[MetadataSample].[DataValue] > @p2)) AND ( [dbo].[RI_Grid_SearchResultsSampleWithCustomData].[LabID] IN (@p3, @p4))))) TmpResult Parameter: @p1 : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 4. Parameter: @p2 : AnsiString. Length: 2000. Precision: 0. Scale: 0. Direction: Input. Value: "3". Parameter: @p3 : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 1. Parameter: @p4 : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 2.
RuntimeBuild=04112013
RuntimeVersion=4.0.0.0
Source=SD.LLBLGen.Pro.ORMSupportClasses
StackTrace:
at SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.ExecuteScalar() in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\Query\RetrievalQuery.cs:line 189
at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.ExecuteScalarQuery(IRetrievalQuery queryToExecute, ITransaction containingTransaction) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\SelfServicingSpecific\DaoBase.cs:line 1952
at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.GetDbCount(IEntityFields fields, ITransaction containingTransaction, IPredicate filter, IRelationCollection relations, IGroupByCollection groupByClause, Boolean allowDuplicates) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\SelfServicingSpecific\DaoBase.cs:line 1554
at Repository.TypedViewClasses.RI_Grid_SearchResultsSampleWithCustomDataTypedView.GetDbCount(Boolean allowDuplicates, IPredicateExpression Filter, GroupByCollection groupByClause) in C:\Development\VADR\VS2012\Data\Repository\TypedViewClasses\RI_Grid_SearchResultsSampleWithCustomDataTypedView.vb:line 238
at Repository.TypedViewClasses.RI_Grid_SearchResultsSampleWithCustomDataTypedView.GetDbCount(Boolean allowDuplicates, IPredicateExpression Filter) in C:\Development\VADR\VS2012\Data\Repository\TypedViewClasses\RI_Grid_SearchResultsSampleWithCustomDataTypedView.vb:line 227
at Search.SearchSamplesWithCustomData() in C:\Development\VADR\VS2012\GUI\ResearchInterface\Search.vb:line 5585
InnerException: System.Data.SqlClient.SqlException
Class=11
ErrorCode=-2146232060
HResult=-2146232060
LineNumber=0
Message=Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Number=-2
Procedure=""
Server=localhost
Source=.Net SqlClient Data Provider
State=0
StackTrace:
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
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, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteScalar()
at SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.ExecuteScalar() in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\Query\RetrievalQuery.cs:line 182
InnerException: System.ComponentModel.Win32Exception
ErrorCode=-2147467259
HResult=-2147467259
Message=The wait operation timed out
NativeErrorCode=258
InnerException:
Hi Barney,
I can't reproduce it. This is my code:
RTL 4.0.13.0722
Stored Procedure (the result of the SP is mapped to a TypedView)
CREATE PROCEDURE [dbo].[GetMeAllOrdersWithDealy]
AS
BEGIN
-- wait for 6 seconds
WAITFOR DELAY '00:00:06'
SELECT * FROM Orders
END
Test code
[TestMethod]
public void ForcingTimeout()
{
// force the timeout exception
NW.LLBL.MSSQL.SS.v40.DaoClasses.CommonDaoBase.CommandTimeOut = 5;
var tv = new AllOrdersWithDealyTypedView();
tv.Fill(null);
}
That code works for with different situations. For example, set the SP delay to 90 seconds and the CommandTimeOut to 95. Then the test should pass, etc.
So, with that code, I can't reproduce it. Please make sure you are using the latest Runtime Library version (RTL), I think you posted the Designer build. Read this: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7725 Then, please try to give us specific steps to reproduce your problem, if it persists.
Joined: 27-Jul-2005
The code you used does not replicate the issue exactly as you do not call the GetDbCount function, the timeout I specified worked in all cases except the GetDbCount function. The version I was using was from April 2013 and I updated it to the latest released (build July 18, 2013/Release July 29, 2013) and that fixed the issue. I should have tried that first – sorry to bother you!