Symptoms
Unable to access K2 smartforms in test environment. After long delay the following error message is being displayed:
"A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 0 - The wait operation timed out.)
The wait operation timed out
Diagnoses
In addition to the error message mentioned above K2HostServer.exe seems to be using all CPU resources on the server.
The log file has entries as below, but using SQL Profiler it is possible to confirm that K2 service user is connecting to K2 database successfully and running its queries successfully.
"Error","General","1","GeneralErrorMessage","K2Sql.OpenConnection","1 Connection Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to respond back in time. The duration spent while attempting to connect to this server was - sPre-Login] initialization=15238 handshake=716
InnerException: The wait operation timed out"
"Error","General","1","GeneralErrorMessage","K2DestQueue.GetNext","1 24129 A database error occurred : Connection Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to respond back in time. The duration spent while attempting to connect to this server was - iPre-Login] initialization=15238 handshake=716 "
"Error","EventBus","7498","General","ServerDAL.RefreshService","7498 An error has occurred: System.InvalidOperationException: 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.
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternaland connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at SourceCode.Data.ConnectionScope.GetConnection(String connectionString, ImpersonateOption impersonateOption)
at SourceCode.EventBus.Server.ServerDAL.RefreshService()","anonymous","0.0.0.0"
Resolution
Problem caused by a couple of looping instances locking up K2 server resources . Removal of these instances will resolve this. It is usually necessary to review the logic of the workflow involved to ensure that there are no issues or loops which cause thread locking.