Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Thomas 160 posts 335 karma points
    Aug 06, 2015 @ 08:36
    Thomas
    0

    DB Timeout Error on executing SP

    Hi,

    I am getting timeout from the database when i execute the following code

    using (var db = ApplicationContext.Current.DatabaseContext.Database)
            {
                db.CommandTimeout = 200;
    
                var hotelGenDataResults = db.Fetch<Hotel_GeneralData>(";EXEC [dbo].[GetBookingHotelGeneralData] @hotelId, @languageCode", new { hotelId = providerHotel.hotel_id, languageCode = locale.ToLower() });
                if (hotelGenDataResults != null && hotelGenDataResults.Any())
                {
                    providerHotel.Hotel_GeneralData = hotelGenDataResults.ToList().FirstOrDefault();
                }
    
                var hotelPhotosResult = db.Fetch<Hotel_Photos>(";EXEC [dbo].[GetBookingHotelAndRoomsPhotos] @hotelId", new { hotelId = providerHotel.hotel_id });
                if (hotelPhotosResult != null && hotelPhotosResult.Any())
                {
                    providerHotel.Hotel_Photos = hotelPhotosResult.ToList();
                }
    
                var hotelFacilitiesResult = db.Fetch<Hotel_Facilities>(";EXEC [dbo].[GetBookingHotelFacilities] @hotelId, @languageCode", new { hotelId = providerHotel.hotel_id, languageCode = locale.ToLower() });
                if (hotelFacilitiesResult != null && hotelFacilitiesResult.Any())
                {
                    providerHotel.Hotel_Facilities = hotelFacilitiesResult.ToList();
                }
            }
    

    I had run the sql profiler as well as the execution plan for missing indexes but everything it looks fine. The error i am getting is the following:

    2015-08-06 10:44:18,095 [10] INFO  Umbraco.Core.Persistence.UmbracoDatabase - [T44/D2]    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
    

    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 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, SqlDataReader ds) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 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.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteDbDataReader(CommandBehavior behavior) in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling\Data\ProfiledDbCommand.cs:line 248 at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader() at Umbraco.Core.Persistence.Database.

    Any help or suggestions please? This is a live environment.

    Regards

    Thomas

Please Sign in or register to post replies

Write your reply to:

Draft