Skip to content

Applied attributes can cause apply mismatched. Needs load test coverage to replicate. #4040

@JohnMcLear

Description

@JohnMcLear

This initial comment seems irrelevant.

This is a bit of an edge case but it can happen. It only happens on very active pads (think 10s of edits a second).

To replicate.

  1. Enable loadTesting.
  2. Run loadTesting
  3. Copy / paste the padId into the browser.

What happens

Pad wont load

What should hapen

Pad should load.

More debug info

Pad will successfully load and can be edited once Load Testing is complete
If you are already on the pad no errors come and it works great.

Error is

Error: Failed assertion: mismatched apply: 10984 / 11740

Assumption

My assumption is that between the time of us delivering the pad object including the baseRev # there has been an additional change meaning that the next change fails causing mismatched apply.

Consider this scenario..

Rev # | 
1    | <-- we connect here
2    | <-- has been an edit here.
3    | <-- is the first commit we receive from the server

The logic is this:

exports.applyToText = function (cs, str) {
  var unpacked = exports.unpack(cs);
  exports.assert(str.length == unpacked.oldLen, "mismatched apply: ", str.length, " / ", unpacked.oldLen);

I think the solution is Etherpad can "request" previous revision upon receiving a revision that's "in the future" and apply that before the latest revision. Essentially upon receiving 3 and knowing it's at 1 it also requests [2] and applies [2] before 3 ?

I tried to create this same problem on the etherpad-cli-client with etherpad-load-test and can't. The messages always appear to load in order. Next step is to simulate a delay between CLIENT_VARS and NEW_CHANGES and see what happens.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions