「Timeout expired」エラーにより、Publishing Service で SqlConnections のリークが発生することがある


解説

ネットワーク インフラストラクチャが不安定であるか、SQLデータベースのパフォーマンスが不十分な場合、パブリッシャー操作をSQLデータベースに追加するプロセスが、次のタイムアウトの例外で失敗する場合があります:

[Error] There was an error adding 1 publisher operations. - Error : "Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."
System.Data.SqlClient.SqlException (0x80131904): Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
 ---> System.ComponentModel.Win32Exception (258): The wait operation timed out.
   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.SqlCommand.EndExecuteNonQueryInternal(IAsyncResult asyncResult)
   at System.Data.SqlClient.SqlCommand.EndExecuteNonQuery(IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
   at Dapper.SqlMapper.ExecuteMultiImplAsync(IDbConnection cnn, CommandDefinition command, IEnumerable multiExec) in /_/Dapper/SqlMapper.Async.cs:line 654
   at Sitecore.Framework.Publishing.Service.Sql.PublisherOperations.PublisherOperationProvider.<>c__DisplayClass2_0.<b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Sitecore.Framework.TransientFaultHandling.Sql.SqlRetryHelper.<>c__DisplayClass8_0`1.<b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Sitecore.Framework.TransientFaultHandling.Sql.SqlRetryHelper.ExecuteAsync[T](DbConnection connection, Func`1 sqlWork, Func`3 commandRetryPolicy, CancellationToken cancellationToken)
   at Sitecore.Framework.Publishing.Data.AdoNet.DatabaseConnection`1.ExecuteAsync[T](Func`2 dbWork)
   at Sitecore.Framework.Publishing.Service.Sql.PublisherOperations.PublisherOperationProvider.Add(IDatabaseConnection connection, IReadOnlyCollection`1 operations)
   at Sitecore.Framework.Publishing.PublisherOperations.PublisherOperationRepository.AddOperations(IReadOnlyCollection`1 operations)
   at Sitecore.Framework.Publishing.PublisherOperations.PublisherOperationService.AddPublisherOperations(IReadOnlyCollection`1 operations)

Masterデータベースへの既存のすべてのSqlConnectionsがブロックされる可能性があります。 したがって、これによりデータベースとインタラクトできなくなり、次のエラーが発生します:

[Error] There was an error testing the connection "Service" - Error: "One or more errors occurred. (Timeout expired.  The timeout period elapsed prior to obtaining a connection from the pool.  This may have occurred because all pooled connections were in use and max pool size was reached.)"
System.AggregateException: One or more errors occurred. (Timeout expired.  The timeout period elapsed prior to obtaining a connection from the pool.  This may have occurred because all pooled connections were in use and max pool size was reached.)

解決策

この問題を解決するには、Publishing Service 6.0のHotfixをダウンロードしてインストールします:SC Hotfix 552114-1.zip

Hotfixは特定のPublishing Serviceバージョン用に作成されたものであり、(互換性が確認できるまでは)他のパブリッシング サービス バージョンにインストールしたり、他のHotfixと組み合わせてインストールしたりしないでください。 特定のパブリッシング サービス インスタンスに他のHotfixが既にインストールされている場合は、互換性チェックのリクエストをSitecoreサポートに送信してください。

インストール手順と関連ファイルを見つけるには、ZIPファイルの内容を抽出する必要があります。 HotfixはCMインスタンスにインストールしてから、貴社の標準の開発手法を使用して他のインスタンスと同期する必要があります。