Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

view-only mode should issue "connected" event on current clientID being in audience #1733

Closed
Tracked by #7995
vladsud opened this issue Apr 7, 2020 · 6 comments
Closed
Tracked by #7995
Assignees
Labels
api design-required This issue requires design thought
Milestone

Comments

@vladsud
Copy link
Contributor

vladsud commented Apr 7, 2020

We should also double-check that "write" mode also follows same requirements.
Once done, we should follow up and remove code on Bohemia side working around this issue.

More background:

From: Tony Murphy Anthony.Murphy@microsoft.com
Sent: Tuesday, April 7, 2020 10:09 AM
To: Vlad Sudzilouski vladsud@exchange.microsoft.com; Tanvir Aumi mdaumi@microsoft.com
Subject: RE: Readonly and Audience

The change made to work around is pretty complicated for something I think should be trivial. I really don’t want all our partners to build similar logic just to find the current user:
https://office.visualstudio.com/OC/_git/74031860-e0cd-45a1-913f-10bbf3f82555/pullrequest/446248?_a=overview

From: Tony Murphy
Sent: Tuesday, April 7, 2020 10:03 AM
To: Vlad Sudzilouski vladsud@exchange.microsoft.com; Tanvir Aumi mdaumi@microsoft.com
Subject: RE: Readonly and Audience

That would be great too. I’m not really proposing a specific solution, just that I think we need on here. Another idea I have was a “connected”-like event on the audience that fires when your client show up in the audience.

-Tony

From: Vlad Sudzilouski vladsud@exchange.microsoft.com
Sent: Tuesday, April 7, 2020 9:26 AM
To: Tony Murphy Anthony.Murphy@microsoft.com; Tanvir Aumi mdaumi@microsoft.com
Subject: RE: Readonly and Audience

We can. But I think it’s even better if it’s handled as first class by server (see attached)

From: Tony Murphy Anthony.Murphy@microsoft.com
Sent: Tuesday, April 7, 2020 9:11 AM
To: Vlad Sudzilouski vladsud@exchange.microsoft.com; Tanvir Aumi mdaumi@microsoft.com
Subject: Readonly and Audience

Hey Guys,

I was thinking about this, and I really don’t like the proposed solution for getting the current user for the audience. I think it requires some pretty nasty code to handle all cases. What is the worry about delaying connected until the user is in it’s own audience?

-Tony

@vladsud vladsud added the bug Something isn't working label Apr 7, 2020
@vladsud vladsud added this to the April 2020 milestone Apr 7, 2020
@ghost ghost added the triage label Apr 7, 2020
@curtisman
Copy link
Member

I am wondering whether there should be two separate event for actual websocket connection versus quorum/audience connection.

@vladsud
Copy link
Contributor Author

vladsud commented Apr 8, 2020

@tanviraumi has similar point in email (regarding latency of being connected). Adding to his point - "connected" is used to start sending ops (in "write" mode), so delaying it is not ideal.

If I understand correctly, they are doing that get trusted user metadata such as PUID. The Framework or runtime can hide this easily and add a method like getUserInfo(). Or even better if we add a User class. The User class will use Quorum and Audience to get info. It can also deduplicate quorum and audience ops and emits one "add/removeMember" op to the App.

@curtisman curtisman modified the milestones: April 2020, May 2020 Apr 28, 2020
@curtisman curtisman modified the milestones: May 2020, June 2020 Jun 1, 2020
@vladsud
Copy link
Contributor Author

vladsud commented Jun 4, 2020

Summarizing, based on a bunch of earlier discussions and re-reading threads:

  1. It would be great to raise connected only when own clientId is in
    • audience (for ALL types of connections)
    • AND in quorum for r/w connection only.

Note that side-effect of this may be slower time to raise "connected" event which might delay sending of local ops. We might want to measure that delay to make sure we are not regressing it badly.

Maybe better solution for Audience would be to synthetize self in audience on connection, as I believe we have all the data to do so, and ignore addMember that will happen next. Worth testing before making it more complex that indeed self shows up in audience later, i.e. this code (on "connected") does not bring self:

        // Back-compat for new client and old server.
        this._audience.clear();

        for (const priorClient of details.initialClients ?? []) {
            this._audience.addMember(priorClient.clientId, priorClient.client);
        }
  1. getUserInfo() might be useful API to add that exposes user info, and caches old data while disconnected (to mimic other places where we do like that).

  2. I do not like the fact that quorum & audience are not synchronized in any way. For example, we do not drop users from either on disconnect (which might be fine). But as we process messages (which can be coming from storage), we will update quorum based on those messages (users joing & leaving, including self), but Audience would stay stagnant. I believe we need to fix it:

    • all quorum members should be "added" to audience at all times.
    • all "write" members in audience that are not in quorum should be removed from there.
      Basically we need some kind of synthetic on top of those two data structures, not expose raw audience.

Might be worth splitting it into many issues.

@curtisman curtisman modified the milestones: June 2020, Next 2020, July 2020 Jun 10, 2020
@ghost ghost added the triage label Jun 10, 2020
@curtisman curtisman modified the milestones: July 2020, August 2020 Aug 3, 2020
@danielroney danielroney added api design-required This issue requires design thought and removed bug Something isn't working triage labels Sep 3, 2020
@danielroney danielroney modified the milestones: August 2020, Next Sep 3, 2020
@vladsud
Copy link
Contributor Author

vladsud commented May 28, 2021

Related: #5251, #1839

@ghost
Copy link

ghost commented Nov 25, 2021

This issue has been automatically marked as stale because it has had no activity for 180 days. It will be closed if no further activity occurs within 8 days of this comment. Thank you for your contributions to Fluid Framework!

@markfields
Copy link
Member

I'm closing this one as a dupe of "fresher" issue #7275. But this is super helpful context/back-story to refer to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api design-required This issue requires design thought
Projects
None yet
Development

No branches or pull requests

4 participants