This project is read-only.
1

Closed

Race condition in TcpSocketConnectionPool.GetSocket()

description

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 Sep 9, 2010 at 2:27 PM by chadfawcett
Duplicate issue.

comments

chadfawcett wrote Aug 25, 2010 at 8:23 PM

Sorry for the double issue submission.

chadfawcett wrote Aug 25, 2010 at 8:25 PM

Patch 6566 submitted to address this issue.

wrote Sep 9, 2010 at 2:27 PM

wrote Feb 14, 2013 at 7:55 PM

wrote May 16, 2013 at 10:09 AM