Skip to content

Releasing a channel causes short-lived memory leak #919

Description

@AndyTWF

When the channel is removed from the channel map as part of release(), a call to detach is also made. This call does not necessarily complete before the call to release() returns. The channel will also not be detached before it is removed from the channel map.

As part of the detach call, a timer is setup to wait for DETACHED to arrive, which never happens. The 10s timer waiting for the channel to detach keeps the channel from being garbage collected, and thus any listeners on the channel (and things they contain, aka the PublisherService in ably/ably-asset-tracking-android#810) are leaked for a brief period of time.

This relates to the work in #914, but has probably always been a bug as even before those changes, the channel was removed from the map.

┆Issue is synchronized with this Jira Task by Unito

Activity

  1. added
    bugSomething isn't working. It's clear that this does need to be fixed.
    on Feb 14, 2023
  2. sync-by-unito commented on Feb 14, 2023

    @sync-by-unito

    ➤ Automation for Jira commented:

    The link to the corresponding Jira issue is https://ably.atlassian.net/browse/SDK-3343

  3. changed the title [-]Releasing a channel causes long-lived timer and memory leak[/-] [+]Releasing a channel causes short-lived memory leak[/+] on Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working. It's clear that this does need to be fixed.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions