Copied to clipboard

Flag this post as spam?

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


  • Bo Jacobsen 597 posts 2395 karma points
    May 02, 2022 @ 07:18
    Bo Jacobsen
    0

    Reconnection to database after lost connection do not work until a restart of the appool is made

    Hi all.

    We occasionally lose connection to the database, because the database is being maintained by the providers.

    System.Data.SqlClient.SqlException (0x80131904): A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The specified network name is no longer available.) ---> System.ComponentModel.Win32Exception (0x80004005): The specified network name is no longer available.
    

    We can see in the logs that Umbraco is trying to boot and etablish connection every now and then, but keep gettin this error:

    Umbraco.Core.Exceptions.BootFailedException: Boot failed. -> System.Data.SqlClient.SqlException: A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The specified network name is no longer available.))
    

    The connection works again after we restart the appool or bumb the web.config, which i guess is also a restart.

    We have an ongoing dialog with the providers about this, because i think its their responsibility. But they say its an faul in Umbraco CMS and that's Umbraco CMS that should handle it.

    My question is if its the Umbraco Application Task to make sure to reetablish the connection, by what ever means or is it the providers Task?

  • Bo Jacobsen 597 posts 2395 karma points
    May 02, 2022 @ 07:21
    Bo Jacobsen
    0

    What i could google was that the connection to the database remains valid in the connection pool of one's application and the only way to refresh it is to restart the app pool.

  • Bo Jacobsen 597 posts 2395 karma points
    May 11, 2023 @ 11:29
    Bo Jacobsen
    0

    Almost a year after, we got another connection issue after the database was being restartet.

    The database was restartet about 5 am. Then the webapplication threw this error every 2nd second, until we bumb the web config at about 11 am.

    System.Data.SqlClient.SqlException (0x80131904): SHUTDOWN is in progress.
    Login failed for user 'xxx'.
    Cannot continue the execution because the session is in the kill state.
    A severe error occurred on the current command.  The results, if any, should be discarded.
       at System.Data.SqlClient.SqlConnection.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.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj, Boolean isDelegateControlRequest)
       at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest, String transactionName, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)
       at System.Data.SqlClient.SqlInternalConnection.BeginSqlTransaction(IsolationLevel iso, String transactionName, Boolean shouldReconnect)
       at System.Data.SqlClient.SqlConnection.BeginTransaction(IsolationLevel iso, String transactionName)
       at System.Data.SqlClient.SqlConnection.BeginDbTransaction(IsolationLevel isolationLevel)
       at StackExchange.Profiling.Data.ProfiledDbConnection.BeginDbTransaction(IsolationLevel isolationLevel) in C:\projects\dotnet\src\MiniProfiler.Shared\Data\ProfiledDbConnection.cs:line 151
       at NPoco.Database.BeginTransaction(IsolationLevel isolationLevel)
       at Umbraco.Core.Scoping.Scope.get_Database() in D:\a\1\s\src\Umbraco.Core\Scoping\Scope.cs:line 253
       at Umbraco.Core.Sync.DatabaseServerMessenger.BootInternal() in D:\a\1\s\src\Umbraco.Core\Sync\DatabaseServerMessenger.cs:line 161
       at System.Lazy`1.CreateValue()
       at System.Lazy`1.LazyInitValue()
       at Umbraco.Web.BatchedDatabaseServerMessenger.<.ctor>b__3_0() in D:\a\1\s\src\Umbraco.Web\BatchedDatabaseServerMessenger.cs:line 48
       at System.Lazy`1.CreateValue()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Lazy`1.get_Value()
       at Umbraco.Web.PublishedCache.NuCache.PublishedSnapshotService.<EnsureCaches>b__36_0() in D:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\PublishedSnapshotService.cs:line 245
       at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory)
       at Umbraco.Web.PublishedCache.NuCache.PublishedSnapshotService.EnsureCaches() in D:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\PublishedSnapshotService.cs:line 210
       at Umbraco.Web.PublishedCache.NuCache.PublishedSnapshotService.CreatePublishedSnapshot(String previewToken) in D:\a\1\s\src\Umbraco.Web\PublishedCache\NuCache\PublishedSnapshotService.cs:line 1109
       at System.Lazy`1.CreateValue()
       at System.Lazy`1.LazyInitValue()
       at Umbraco.Web.UmbracoInjectedModule.EnsureHasContent(UmbracoContext context, HttpContextBase httpContext) in D:\a\1\s\src\Umbraco.Web\UmbracoInjectedModule.cs:line 234
       at Umbraco.Web.UmbracoInjectedModule.EnsureUmbracoRoutablePage(UmbracoContext context, HttpContextBase httpContext) in D:\a\1\s\src\Umbraco.Web\UmbracoInjectedModule.cs:line 172
       at Umbraco.Web.UmbracoInjectedModule.ProcessRequest(HttpContextBase httpContext) in D:\a\1\s\src\Umbraco.Web\UmbracoInjectedModule.cs:line 111
       at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    ClientConnectionId:a3db2f73-c2ae-4367-b937-b27521de344b
    Error Number:6005,State:1,Class:14
    

    Do anyone have any ideer if this is a database issue or if there is something we can do to force an application restart when this error occours?

Please Sign in or register to post replies

Write your reply to:

Draft