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

Add closed flag to prevent latent socket emission #3787

Merged
merged 2 commits into from
Oct 1, 2020

Conversation

ChumpChief
Copy link
Contributor

In #3627, we observe messages are being sent with old clientId. The default implementation of DocumentDeltaManager.disconnect() generally protects against this by disconnecting the socket on disconnect(). However, there's nothing actually stopping the BatchManager from attempting to emit on the old socket if it still has messages in the queue -- it will just fail because the socket is disconnected.

This is a speculative fix -- we suspect that since OdspDocumentDeltaManager overrides disconnect() to allow for socket reuse, these still-open sockets are emitting leftover messages. This change introduces a flag to more explicitly indicate/check whether emitting on the socket should be allowed.

With Helio's #3704, we should have the correct telemetry in place to determine whether this is effective in eliminating the issue.

// We set the closed flag as a part of the contract for overriding the disconnect method. This is used by
// DocumentDeltaConnection to determine if emitting on the socket is allowed, which is important since
// OdspDocumentDeltaConnection reuses the socket rather than truly disconnecting it.
this.closed = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't love this. i'm alway wary of flag as they make the state machine harder to understand. I also don't like having to reach into the shared implementation. Howerver, if we think this will get better soon-ish with refactoring i think it's ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My hope is this all gets simpler with refactoring or BatchManager removal per #3788. Agreed on wanting to minimize state management.

Copy link
Contributor

@heliocliu heliocliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this will get cleaned up a bit with the batchmanager removal, looks good to me if you don't think adding telemetry provides any actionable signals

@ChumpChief ChumpChief merged commit 191299d into microsoft:main Oct 1, 2020
@ChumpChief ChumpChief deleted the SocketNeutralize branch October 1, 2020 21:47
ChumpChief added a commit to ChumpChief/FluidFramework that referenced this pull request Oct 1, 2020
Speculative fix to prevent OdspDocumentDeltaConnection from emitting on reused sockets after disconnect.
ChumpChief added a commit to ChumpChief/FluidFramework that referenced this pull request Oct 1, 2020
Speculative fix to prevent OdspDocumentDeltaConnection from emitting on reused sockets after disconnect.
ChumpChief added a commit that referenced this pull request Oct 1, 2020
Speculative fix to prevent OdspDocumentDeltaConnection from emitting on reused sockets after disconnect.
ChumpChief added a commit that referenced this pull request Oct 1, 2020
Speculative fix to prevent OdspDocumentDeltaConnection from emitting on reused sockets after disconnect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants