Uploaded image for project: 'Couchbase Gateway'
  1. Couchbase Gateway
  2. CBG-1113

CBL1.x/Websocket based changes feeds leak goroutine on disconnect

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.0.0
    • 3.0
    • SyncGateway
    • Security Level: Public
    • CBG Sprint 59, CBG Sprint 60
    • 5

    Description

      Issuing a websocket-based changes feed and disconnecting causes the "SimpleMultiChangesFeed" goroutine to leak, even after the websocket request has timed out due to the 5 minute heartbeat.

      With enough clients over a long enough period, this can result in a leak of a significant amount of memory and can cause OOMs.

      This seems to have been the case since at least CBL 1.5.3, and is mostly caused by CBL 1.x clients, which use the websocket changes API. CBL 2.x uses a different API, and so does not cause this issue.

       

      Next steps before fix:

      • Evaluate whether a "clean" disconnect still causes this.
        • Repro'd with websocket command line tool and ^C to close the request, which is an "unclean" disconnect, which relies on the 5 minute heartbeat to actually timeout the request.
          • $ echo "{}" | wsd -url='ws://127.0.0.1:4985/db1/_changes?since=0&feed=websocket&continuous=true&filter=sync_gateway/bychannel&channels=abc,def'
            connecting to ws://127.0.0.1:4985/db1/_changes?since=0&feed=websocket&continuous=true&filter=sync_gateway/bychannel&channels=abc,def from http://localhost/...
            successfully connected to ws://127.0.0.1:4985/db1/_changes?since=0&feed=websocket&continuous=true&filter=sync_gateway/bychannel&channels=abc,def
            < []
            > ^C

      Attachments

        Issue Links

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

          Activity

            No work has yet been logged on this issue.

            People

              ben.brooks Ben Brooks
              ben.brooks Ben Brooks
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty