Skip to content

Stream Callbacks: Cleanup observers #18551

Closed

Description

@KBaichoo

Issue description:
Streams Callbacks: Clean up observers, avoid having dangling observers.

Description:
The Subject-Observer pattern is used for StreamCallbacks. The codec stream object is the subject in this case, and the observers can include the Envoy's ActiveStream level object. Currently, the ActiveStream observer doesn't remove itself from observing codec level stream. Moreover, there are cases e.g. local reply where the subject itself might be destroyed before the ActiveStream object, leaving it with a dangling reference to the codec level stream.

We should clean this up such that when the StreamCallbackHelper is destroyed, it should have no observers. I think it's only a matter of time before this bites us.

This has cropped up in prior changes before e.g. https://github.com/envoyproxy/envoy/pull/7212/files#r292216995

cc @envoyproxy/envoy-mobile-maintainers @alyssawilk said you might be interested in this one

Activity

  1. added
    enhancement
    triage
    on Oct 11, 2021
  2. added
    help wanted
    and removed
    enhancement
    triage
    on Oct 18, 2021
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions