Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Improvements to client join process #155

Merged
merged 6 commits into from
Jan 31, 2019
Merged

Improvements to client join process #155

merged 6 commits into from
Jan 31, 2019

Conversation

eanders-ms
Copy link
Contributor

This changeset started out as an update to the user join process to add protections against zombie sessions. Along the way I encountered and fixed a few other issues (list below).

Glossary
Zombie session: A session where the authoritative peer has become unresponsive but not disconnected.

Zombie session mitigations:

  • Handshake new connections before adding to session: When a new WebSocket connection is made we no longer spawn an app session right away. We now run through the handshake process first. Once handshake completes we pass the connection to a session where join-in-progress is initiated. This should filter out the unresponsive new connections reported by @willneedit.

  • Kick unresponsive peers: Messages sent to the client that expect replies now have timeouts on them. Default value is 30 seconds. This can be disabled by setting ConnectionTimeoutSeconds to zero (helpful when sitting on a breakpoint). When a message timeout triggers, the connection is forcibly closed.

Fixes #104

Other changes:

  • Only forward assets-loaded messages to the app if sent from the authoritative peer.
  • When a connection closes unexpectedly, reject outstanding promises against sent messages that are awaiting a reply.
  • When enabling rigid body, don't automatically subscribe to rigid body changes.
  • Removed position and rotation from RigidBody class.
  • When enabling a rigid body, text, or light component, don't send default values for fields not specified by the user. For example, if the user didn't specify an angular velocity, don't pass [0,0,0]. Omit the field instead.
    • Default values for all fields will come back in the next actor-update.
  • Programmatically sort the functional test menu.
  • Companion fix in Unity for broken animation synchronization.
  • Better error handling throughout.

@@ -116,44 +116,42 @@ export default class App {
private async displayFunctionalTestChoices(rootActor: MRESDK.ActorLike): Promise<string> {
return new Promise<string>((resolve) => {
let y = 0;
for (const key in this.testFactories) {
if (this.testFactories.hasOwnProperty(key)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this.testFactories.hasOwnProperty(key) [](start = 20, length = 38)

I thought this was required, TS-lint complaining if missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's required with for..in, but not for..of.

@eanders-ms eanders-ms changed the base branch from awaiting to red January 31, 2019 19:58
Copy link
Contributor

@sorenhan sorenhan left a comment

Choose a reason for hiding this comment

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

:shipit:

this._conn.off('error', this.disconnect);
this._conn.close();
this.emit('close');
} catch { }
Copy link
Contributor

Choose a reason for hiding this comment

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

catch { } [](start = 10, length = 9)

should you log error here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm intentionally not logging errors here because we're in the process of tearing down the session. Various errors can happen depending on how "started up" the session was in the first place. I just want to make sure exceptions don't interrupt the shutdown process from completing.


In reply to: 252832190 [](ancestors = 252832190)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stale connections pinging the MRE, causing a deadlock
2 participants