Skip to content
This repository was archived by the owner on Nov 1, 2022. It is now read-only.
This repository was archived by the owner on Nov 1, 2022. It is now read-only.

Modifying sessionManager from an observer may cause observers seeing events in different order and other "in-between states" #400

Description

@pocmo

For #379 I added code in the sample browser that will add a new tab if all tabs get closed. However this code is indirectly called from a session manager observer. If there are more observers then the following ones would get called with the session manager state already changed - or other calls in between.

Let's say there are two observers (A / B) registered on the session manager. And the session manager has one session X.

  • session manager (X)
  • X is removed from session manager.
  • A.onSessionRemoved(X) gets called: A adds a new session Y to session manager and this will notify observers:
    • A.onSessionAdded(Y) gets called
    • B.onSessionAdded(Y) gets called
  • B.onSessionRemoved(X) gets called.

In the end A and B have observed the same events. But in different order. B never saw an empty session manager:

  • For A: (X) -> () -> (Y)
  • For B: (X) -> (X,Y) -> (X)

┆Issue is synchronized with this Jira Task

Activity

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

    <session>Component: browser-session🐞 bugSomething isn't working🔬 ResearchProblems without a solution that need research.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions