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

CouchbaseClient has no destructor so SocketPool and sockets are often not cleaned/closed

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.4
    • Fix Version/s: 1.3.5
    • Component/s: library
    • Labels:
    • Environment:
      .NET 4 used in testing

      Description

      Investigating a client issue I spotted that the CB server node sometimes still had 11210 connections open even though a .NET test application had cleanly terminated.

      Instrumentation of SocketPool.cs showed that there was unreliable clean-up of the sockets and this was tracked down to the lack of a destructor/dispose path from CouchbaseClient.

      The instrumentation added "print" statements to the socket creation and socket deletion paths. Even with explicit GC.collect calls the deletion prints were very unreliable. I.e. 30 socket created, but variable amounts get closed, sometimes even none.

      A simple patch is soon to be uploaded which made a significant difference to the deletion print statements and has been tested using a simple test program. With the patch I saw reliable socket closure. E.g. 30 created, 30 deleted/closed.

      Attached to this are.

      1) Test program (Program2.cs) which creates CouchbaseClient, allows objects to become out-of-scope and exits cleanly.
      2) A patch against CouchbaseClient.cs which drives the destruction path to Dispose the Pool (to be committed).

      Without my CouchbaseClient fix I would see the number of sockets created frequently be more than the count of items disposed.

      (need to figure out how to push code to gerrit??)

      1. CouchbaseClient.cs.patch
        0.8 kB
        Jim Walker
      2. Program2.cs
        0.8 kB
        Jim Walker
      No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

        Hide
        jmorris Jeff Morris added a comment -
        Show
        jmorris Jeff Morris added a comment - Change set is here: http://review.couchbase.org/#/c/36407/2
        Hide
        jmorris Jeff Morris added a comment -

        Released in 1.3.5.

        Show
        jmorris Jeff Morris added a comment - Released in 1.3.5.

          People

          • Assignee:
            jmorris Jeff Morris
            Reporter:
            jwalker Jim Walker
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Gerrit Reviews

              There are no open Gerrit changes