Skip to content

improvement(driver): Differentiate clean vs. abnormal disconnects and emit abnormal disconnects to FRS #24528

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

Merged
merged 63 commits into from
Jul 14, 2025

Conversation

RishhiB
Copy link
Contributor

@RishhiB RishhiB commented May 6, 2025

Today the Routerlicious service receives no signal that a Fluid client disconnected because of an error.

Changes

  1. Client side

    • The dispose method in DocumentDeltaConnection is updated to accept an optional error argument. If an error is provided, it indicates an abnormal disconnect.
    • In R11sDocumentDeltaConnection we override disconnectCore.
    • When the client is disconnecting due to an error and the socket is still healthy we emit
      socket.emit("client_disconnect", clientId, documentId, err.errorType);
    • No payload is sent for clean disconnects.
  2. Service side

    • server/routerlicious/packages/lambdas/src/nexus/index.ts now listens for the event:
      socket.on("client_disconnect", (clientId, documentId, errorType) => {
          Lumberjack.error(
              "Client disconnected due to error",
              { clientId, documentId, errorType },
              new Error(errorType),
          );
      });

AB#13598
AB#32066

@github-actions github-actions bot added area: dds Issues related to distributed data structures area: dds: tree area: driver Driver related issues area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct public api change Changes to a public API base: main PRs targeted against main branch labels May 6, 2025
@github-actions github-actions bot removed area: dds Issues related to distributed data structures area: dds: tree public api change Changes to a public API area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct labels May 21, 2025
@RishhiB RishhiB changed the title RishhiB test make disconnects emit optional errors fix(driver): Make error emission on disconnect optional May 22, 2025
@RishhiB RishhiB changed the title fix(driver): Make error emission on disconnect optional improvement(driver): Make error emission on disconnect optional May 22, 2025
@RishhiB RishhiB marked this pull request as ready for review May 22, 2025 16:42
@Copilot Copilot AI review requested due to automatic review settings May 22, 2025 16:42
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR makes error emission on disconnects optional by introducing an optional error parameter to dispose, disconnect, and disconnectCore, allowing for clean disconnects when no error is provided.

  • Added error?: Error to dispose and only pass an IAnyDriverError to disconnect if provided.
  • Changed disconnect and disconnectCore signatures to accept an optional err?: IAnyDriverError.
  • Updated dispose logic to create and forward an error object only when needed.
Comments suppressed due to low confidence (2)

packages/drivers/driver-base/src/documentDeltaConnection.ts:453

  • The @param annotation for disconnectCore is out of sync: it references 'reason' while the parameter is now 'err?: IAnyDriverError'. Please update the JSDoc to reflect the optional parameter name and its purpose.
* @param reason - reason for disconnect

packages/drivers/driver-base/src/documentDeltaConnection.ts:412

  • Add unit tests for both clean disconnect (no error) and error-triggered disconnect to verify the optional error logic in dispose and disconnect behaves as intended.
const disconnectError = error

@jason-ha
Copy link
Contributor

}

Looks like a breaking change to IDocumentDeltaConnectionEvents disconnect event


Refers to: packages/drivers/driver-base/src/documentDeltaConnection.ts:451 in dbdc5b1. [](commit_id = dbdc5b1, deletion_comment = False)

@github-actions github-actions bot removed the public api change Changes to a public API label Jul 8, 2025
@github-actions github-actions bot removed the area: loader Loader related issues label Jul 8, 2025
@github-actions github-actions bot added the area: server Server related issues (routerlicious) label Jul 8, 2025
@RishhiB RishhiB changed the title improvement(driver): Support clean disconnections in disconnect emissions improvement(driver): Differentiate Clean vs. Abnormal Client Disconnects for FRS Jul 8, 2025
@RishhiB RishhiB changed the title improvement(driver): Differentiate Clean vs. Abnormal Client Disconnects for FRS improvement(driver): Differentiate Clean vs. Abnormal Client Disconnects and emit it to FRS Jul 8, 2025
@RishhiB RishhiB changed the title improvement(driver): Differentiate Clean vs. Abnormal Client Disconnects and emit it to FRS improvement(driver): Differentiate clean vs. abnormal disconnects and emit abnormal disconnects to FRS Jul 8, 2025
@RishhiB RishhiB requested review from jatgarg and znewton July 14, 2025 18:07
@RishhiB RishhiB merged commit 83bbdeb into microsoft:main Jul 14, 2025
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: driver Driver related issues area: server Server related issues (routerlicious) base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants