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

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.

Activity

Show:

CB robot October 5, 2021 at 10:51 PM

Build sync_gateway-2.8.3-7 contains sync_gateway commit 65b9d2b with commit message:
Backport - Notify termination for waiting ChangeWaiter triggered by Admins/Guest (#4818) (#5282)

CB robot October 21, 2020 at 9:11 PM

Build sync_gateway-3.0.0-29 contains sync_gateway commit a70d9fa with commit message:
- Notify termination for waiting ChangeWaiter triggered by Admins/Guest (#4818)

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Labels

Story Points

Components

Sprint

Fix versions

Affects versions

Priority

Instabug

Open Instabug

PagerDuty

Sentry

Zendesk Support

Created October 1, 2020 at 12:55 PM
Updated August 31, 2024 at 11:01 AM
Resolved October 21, 2020 at 9:36 PM
Instabug