Skip to content

clientTracking.updatePosition waits for an acknowledgement: 5s timeouts and unhandled rejections on every cursor move #404

Description

@RobertoReale

Describe the bug

Every cursor movement produces an unacknowledged promise that can only fail, and each failure is logged twice: once as a 5 s timeout and once as an unhandled rejection.

SocketIOAPI.updatePosition emits clientTracking.updatePosition through the promisified emit, i.e. with an acknowledgement callback:

// src/api/socketio.ts
async updatePosition(doc_id:string, row:number, column:number) {
    return this.emit('clientTracking.updatePosition', {row, column, doc_id})
        .then(() => { return; });
}

Two problems with that:

  • the official web frontend emits this event without an acknowledgement callback — it is a fire-and-forget notification, the server broadcasts clientTracking.clientUpdated to the other clients and there is nothing to wait for;
  • the only caller, ClientManager (src/collaboration/clientManager.ts), does not attach a .catch, so whenever the promise rejects VS Code logs rejected promise not handled within 1 second.

While typing, this runs several times per second, so a single editing session fills the log with entries that correspond to no real failure.

Expected behavior

Moving the cursor sends the position update and nothing else: no pending promise, no timeout, no unhandled rejection.

How To Reproduce

  1. Open a project from overleaf.com and open a .tex file.
  2. Move the cursor / type for a few seconds.
  3. Help > Toggle Developer Tools > Console: clientTracking.updatePosition errors and rejected promise not handled within 1 second entries appear.

Environment

  • Overleaf Workshop Extension version: 0.15.10
  • VS Code version: 1.133.0
  • Overleaf Edition: Official

Fix

Emit the event without an acknowledgement callback, as the web frontend does, keeping the current path for the Alt (HTTP) scheme where the emit is implemented as a request/response. Submitted as a pull request from fix/update-position-fire-and-forget.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions