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

Change the internal data structure for connections from a stack to a queue


    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.6
    • Fix Version/s: 1.3.0
    • Component/s: library
    • Labels:


      We have been having issues with stale connections to our Couchbase cluster, causing all of the following errors:
      • Unable to locate node
      • Receive timeout
      • Connection reset
      • Reading zero (0) bytes

      Upon investigation, we found that the .NET client library, we found that a stack is used internally.
      private InterlockedStack<PooledSocket> freeItems;

      If all connections are not being used, and given the different pool options of 10-20 connections, it is quite possible that some connections will never be used (if the load is low or moderate). The reason that some sockets then become stale, is because there is no keep-alive set (it's off by default).

      socket.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true);

      I would like to propose that the keep-alive option is available as a configuration option (this is related to NCBC-125) and that the stack is swapped for a queue.

      This would likely mitigate the need for working around idle connection timeouts as recommended in the documentation: http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-bestpractice-deployment.html

      Of course, one needs to ensure that all network systems (switches, routers, etc.) are correctly configured too.

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


        parautenbach Pieter Rautenbach added a comment -

        I cannot edit the issue, but I accidentally mentioned NCBC-125, which should actually be NCBC-126.

        parautenbach Pieter Rautenbach added a comment - I cannot edit the issue, but I accidentally mentioned NCBC-125 , which should actually be NCBC-126 .
        jmorris Jeff Morris added a comment - https://www.couchbase.com/issues/browse/NCBC-310


          • Assignee:
            jmorris Jeff Morris
            parautenbach Pieter Rautenbach
          • Votes:
            0 Vote for this issue
            2 Start watching this issue


            • Created:

              Gerrit Reviews

              There are no open Gerrit changes