Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-311

Uncaught Null Reference Exception causes host process to terminate

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 1.3.0
    • 1.2.8
    • library

    Description

      From the Enyim github repo:

      I found a potential race condition inside Enyim.Caching causing a null reference exception which propagates up through CouchbaseClient and crashes the IIS process.

      I've filed an issue on Github with the details but also want to see if Couchbase team can do anything about it. I'm not sure if or how Couchbase team is related to the Enyim.Caching project.

      https://github.com/enyim/EnyimMemcached/issues/131:

      I got this in my Windows event log:

      An unhandled exception occurred and the process was terminated.

      Application ID: /LM/W3SVC/1/ROOT/oa3

      Process ID: 3432

      Exception: System.NullReferenceException

      Message: Object reference not set to an instance of an object.

      StackTrace: at Enyim.Caching.CountdownEvent.Signal()
      at Couchbase.CouchbaseClient.<>c_DisplayClass16.b_f(Boolean success)
      at Couchbase.SyncOperation.<>c_DisplayClass2.b_1(Boolean readSuccess)
      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.EndReceive()
      at Enyim.Caching.Memcached.PooledSocket.AsyncSocketHelper.AsyncReadCompleted(Object sender, 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, Boolean ignoreSyncCtx)
      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)

      It caused IIS / AppPool to crash. Looking at the source code I suspect it's a potential race condition where Enyim.Caching.CountdownEvent.mre was set to null by the Dispose() method while CouchbaseClient.PerformMultiSync() is calling .Signal() in an async operation (which calls this.mre.Set() triggering the NRE). Maybe there should be a null check before calling mre.Set()?

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jmorris Jeff Morris
            jmorris Jeff Morris
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty