Copied to clipboard

Flag this post as spam?

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


  • Ambert van Unen 175 posts 819 karma points c-trib
    Feb 11, 2022 @ 12:07
    Ambert van Unen
    0

    Database timeout error

    I'm trying to upgrade my website from 8.17 to v9. Everything is going rather smoothly (got 95% up and running), except for an annoying issue.

    I have my local enviroment running in IIS and connected to the database server on Azure, this is the same database server as my live enviroment. (I know, not ideal, but for now its ok ;-))

    But every ~ 3,5-4 minutes, i'm getting an error whilst developing that the connection is lost resulting in the below error.

    Added clarification: The entire application stops working, and the JIT debugger from visualstudio triggers returning this error. The entire application stops and I need to restart it..

    I'm currently a bit out of options as to what this issue is..

    System.Data.SqlClient.SqlException HResult=0x80131904 Message=Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated. Source=Core .Net SqlClient Data Provider StackTrace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 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.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.InternalExecuteNonQuery(TaskCompletionSource 1 completion, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite, String methodName) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteNonQuery() in C:\projects\dotnet\src\MiniProfiler.Shared\Data\ProfiledDbCommand.cs:line 300 at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.FaultHandlingDbCommand.

    Inner Exception 1: Win32Exception: The wait operation timed out.

  • Brendan Rice 538 posts 1102 karma points
    Feb 11, 2022 @ 12:58
    Brendan Rice
    1

    You could try increase the timeout on the connection string:

    <add name="umbracoDbDSN" connectionString="server=Server;database=DbName;user id=UserId;password='Password'; Connection Timeout=120" providerName="System.Data.SqlClient" />
    

    Hope this helps

  • Ambert van Unen 175 posts 819 karma points c-trib
    Feb 11, 2022 @ 13:08
    Ambert van Unen
    0

    I dont think that would resolve the issue. That would indicate a certain query is running so long it would reach the timeout, and also trigger an entire application shutdown?

    When I check the Azure logs, there are no long-running queries, or any reason this should happen, i'll add this to the main post.

  • Brendan Rice 538 posts 1102 karma points
    Feb 11, 2022 @ 13:38
    Brendan Rice
    0

    Maybe try and use profiler to see what's going on:

    https://our.umbraco.com/Documentation/Fundamentals/Code/Debugging/

    To be honest it seems like the profiler is generating the error:

    System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource 1 completion, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite, String methodName) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteNonQuery() in C:\projects\dotnet\src\MiniProfiler.Shared\Data\ProfiledDbCommand.cs:line 300 at
    Umbraco.Cms.Infrastructure.Persistence.FaultHandling.FaultHandlingDbCommand.
    

    I could be wrong but it seems like a long running query is exceeding the database timeout period.

  • Ambert van Unen 175 posts 819 karma points c-trib
    Feb 12, 2022 @ 16:09
    Ambert van Unen
    0

    Well I checked using profiler, and only on the startup there's an initial load of about 40seconds (which is normal as it builds the project and stuff.. every other page is around 50ms only.

    Checked Azure for long queries, the longest was 0.8 second long.. So that wouldn't be it either..

  • Brendan Rice 538 posts 1102 karma points
    Feb 13, 2022 @ 19:47
  • Ambert van Unen 175 posts 819 karma points c-trib
    Feb 21, 2022 @ 08:42
    Ambert van Unen
    102

    Couldnt find a solution, so in the end I used Usync content edition to migrate all my content from the V8 to a clean V9 database, and it worked like a charm!

    Glad it's done :-)

Please Sign in or register to post replies

Write your reply to:

Draft