Skip to content


Subversion checkout URL

You can clone with
Download ZIP


An asynchronous socket operation is already in progress using this SocketAsyncEventArgs instance. #98

billrob opened this Issue · 2 comments

1 participant


When using the multi-get call we are occasionally receiving this error. It usually happens a few times in a row and then recovers.

Things of note:

We understand the memclient to be thread safe so we have set up our memcached client as a singleton.
We run about 30 memcached queries per second.
We are using version (from nuget)

I found this issue, #94 but it really doesn't seem to apply to us. Any assistance would be helpful.

We might change to instance based, but the pool management might be handled as a singleton anyway under the covers.

System.InvalidOperationException: "An asynchronous socket operation is already in progress using this SocketAsyncEventArgs instance.";
at System.Net.Sockets.SocketAsyncEventArgs.StartOperationCommon(Socket socket)
at System.Net.Sockets.Socket.ReceiveAsync(SocketAsyncEventArgs e)
at Enyim.Caching.Memcached.PooledSocket.AsyncSocketHelper.BeginReceive() in d:\d\repo\EnyimMemcached\Enyim.Caching\Memcached\AsyncSocketHelper.cs:line 96
at Enyim.Caching.Memcached.PooledSocket.AsyncSocketHelper.Read(AsyncIOArgs p) in d:\d\repo\EnyimMemcached\Enyim.Caching\Memcached\AsyncSocketHelper.cs:line 81
at Enyim.Caching.Memcached.Protocol.Binary.BinaryResponse.ReadAsync(PooledSocket socket, Action1 next, Boolean& ioPending) in d:\d\repo\EnyimMemcached\Enyim.Caching\Memcached\Protocol\Binary\BinaryResponse.cs:line 99
at Enyim.Caching.Memcached.Protocol.Binary.MultiGetOperation.DoReadAsync() in d:\d\repo\EnyimMemcached\Enyim.Caching\Memcached\Protocol\Binary\MultiGetOperation.cs:line 96
at Enyim.Caching.Memcached.MemcachedNode.ExecuteOperationAsync(IOperation op, Action
1 next) in d:\d\repo\EnyimMemcached\Enyim.Caching\Memcached\MemcachedNode.cs:line 502
at Enyim.Caching.MemcachedClient.PerformMultiGetT in d:\d\repo\EnyimMemcached\Enyim.Caching\MemcachedClient.cs:line 911


This is running on version 2.11.

I'm going to download Memcached 2.12 Beta 3 and see if that helps.


It has helped somewhat, now we are getting the "Expected Magic Value" exception that @vchekan has been working on.

We are going to wrap the client is another class that will recreate the client. We are currently using Singleton behavior and will recreate the underlying MemcachedClient inside the our Singleton wrapper.

I'm curious as to whether the underlying socket poll is one per client or one per App Domain?


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.