This project is read-only.


Race Condition in TcpSocketConnectionPool.GetSocket()


A race condition can cause an unhandled exception in multi-threaded client applications. Between the checks to see if there are available sockets and the dequeue() call another thread may lock and grab the last socket connection. I have a patch to address this issue which I will upload as well.
Exception stack:
Unhandled Exception appears: Queue empty.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.Queue`1.Dequeue()
at SharedCache.WinServiceCommon.Sockets.TcpSocketConnectionPool.GetSocket() in C:\Solutions\SharedCache\SharedCache.WinServiceCommon\Sockets\TcpSocketConnectionPool.cs:line 213
at SharedCache.WinServiceCommon.Sockets.ManageTcpSocketConnectionPool.GetSocketFromPool(String host) in C:\Solutions\SharedCache\SharedCache.WinServiceCommon\Sockets\ManageTcpSocketConnectionPool.cs:line 291
at SharedCache.WinServiceCommon.Sockets.ManageClientTcpSocketConnectionPoolFactory.GetClient(String host) in C:\Solutions\SharedCache\SharedCache.WinServiceCommon\Sockets\ManageClientTcpSocketConnectionPoolFactory.cs:line 99
at SharedCache.WinServiceCommon.IndexusMessage.Send() in C:\Solutions\SharedCache\SharedCache.WinServiceCommon\IndexusMessage.cs:line 466
at SharedCache.WinServiceCommon.CacheUtil.HandleProtocol(IndexusMessage msg,String lastUsedServerNodeIp) in C:\Solutions\SharedCache\SharedCache.WinServiceCommon\CacheUtil.cs:line 141
Closed Oct 11, 2010 at 1:41 AM by chadfawcett


chadfawcett wrote Aug 25, 2010 at 8:25 PM

Patch 6566 submitted to address this issue.

wrote Sep 9, 2010 at 3:26 PM

wrote Sep 13, 2010 at 7:48 PM

chadfawcett wrote Sep 13, 2010 at 7:48 PM

Fixed in change set 60935.

** Closed by chadfawcett 9/13/2010 11:48 AM

chadfawcett wrote Sep 13, 2010 at 7:48 PM

Fixed in change set 60935.

wrote Oct 11, 2010 at 1:41 AM

wrote Feb 14, 2013 at 7:55 PM

wrote May 16, 2013 at 10:09 AM