enyim/EnyimMemcached — Issue #88: System.ObjectDisposedException crashing IIS worker process
Author: LukeTillman
Created: 2011-11-18 18:04:49+00:00
State: open

While load testing under 2.11, we seem to get errors like this intermittently:

An unhandled exception occurred and the process was terminated.

Exception: System.ObjectDisposedException

Message: Safe handle has been closed

StackTrace: at System.StubHelpers.StubHelpers.SafeHandleC2NHelper(Object pThis, IntPtr pCleanupWorkList)
at Microsoft.Win32.Win32Native.SetEvent(SafeWaitHandle handle)
at System.Threading.EventWaitHandle.Set()
at Enyim.Caching.CountdownEvent.Signal()
at Enyim.Caching.MemcachedClient.<>c__DisplayClass1c`1.b__15(Boolean success)
at Enyim.Caching.Memcached.MemcachedNode.<>c__DisplayClass2.b__0(Boolean readSuccess)
at Enyim.Caching.Memcached.Protocol.Binary.MultiGetOperation.DoReadAsync()
at Enyim.Caching.Memcached.Protocol.Binary.MultiGetOperation.EndReadAsync(Boolean readSuccess)
at Enyim.Caching.Memcached.Protocol.Binary.BinaryResponse.DoDecodeBody(AsyncIOArgs asyncEvent)
at Enyim.Caching.Memcached.Protocol.Binary.BinaryResponse.DoDecodeHeader(AsyncIOArgs asyncEvent, Boolean& pendingIO)
at Enyim.Caching.Memcached.Protocol.Binary.BinaryResponse.DoDecodeHeaderAsync(AsyncIOArgs asyncEvent)
at Enyim.Caching.Memcached.PooledSocket.AsyncSocketHelper.PublishResult(Boolean isAsync)
at Enyim.Caching.Memcached.PooledSocket.AsyncSocketHelper.EndReceive()
at Enyim.Caching.Memcached.PooledSocket.AsyncSocketHelper.AsyncReadCompleted(Object sender, SocketAsyncEventArgs e)
at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(SocketAsyncEventArgs e)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags)
at System.Net.Sockets.SocketAsyncEventArgs.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

When this happens it crashes the IIS worker process (w3wp) essentially causing a "recycle" of the app pool. I haven't really dug into the Enyim client code, but I wonder if this is related to what @scarnie was talking about in https://github.com/enyim/EnyimMemcached/issues/84