etherpad-lite icon indicating copy to clipboard operation
etherpad-lite copied to clipboard

Uncaught Error: Failed assertion: Invalid changeset (checkRep failed)

Open SkoricIT opened this issue 12 years ago • 95 comments

Hey guys. We are using stable and have the problem that some pads randomly stop working and throw an uncaught error in the console.

Uncaught Error: Failed assertion: Invalid changeset (checkRep failed) 

Example:

https://etherpad.tugraz.at/p/l3tsbet

When this happens, the "loading" overlay blocks any action. It's unlikely to be a copy&paste issue because it sometimes happens to entirely handwritten pads.

An interesting thing is, that the timeslider (opened by appending /timeslider to the url) always works without problems.

https://etherpad.tugraz.at/p/l3tsbet/timeslider

Right now we are manually fixing the pads by exporting+importing with HTML (losing all changesets). Any idea whats wrong?

SkoricIT avatar Mar 14 '14 11:03 SkoricIT

Try the latest Develop branch and let us know if it still occurs

JohnMcLear avatar Mar 14 '14 13:03 JohnMcLear

This is not trivial as it occurs by chance on the prod server with many users and I cannot reproduce it. I can only test if broken pads stay broken on develop, if that helps.

SkoricIT avatar Mar 14 '14 14:03 SkoricIT

yes please

JohnMcLear avatar Mar 14 '14 17:03 JohnMcLear

I will get the db copied to dev next week. Will report as soon as possible. Thank you for the fast response.

SkoricIT avatar Mar 15 '14 14:03 SkoricIT

Unfortunately moving to develop has not repaired the damaged pads. Interestingly, moving servers (simple sql export/import) has "repaired" one of the pads. It works on the new server (even on 1.3.0) but other damages pads don't. Still the same error.

This is a really strange bug and pads seem to sometimes just "self-repair" even on PROD and with no change whatsoever from us.

SkoricIT avatar Mar 17 '14 21:03 SkoricIT

In theory this problem shouldn't occur at all as the bad data should never find it's way in now..

JohnMcLear avatar Mar 17 '14 21:03 JohnMcLear

I can leave this open and if it occurs on fresh data we can try to resolve it..

JohnMcLear avatar Mar 17 '14 21:03 JohnMcLear

What do you mean with "fresh data" ? Do I need to put PROD on develop and try to get new broken pads?

SkoricIT avatar Mar 17 '14 21:03 SkoricIT

Hrm, that'd be painful potentially.. Maybe wait for 1.4 which should be out in a few weeks max.

JohnMcLear avatar Mar 17 '14 22:03 JohnMcLear

We might do that. Thanks a lot.

SkoricIT avatar Mar 17 '14 23:03 SkoricIT

I also have that problem, with the same strange randomness. I updated to etherpad-lite 1.4 and it is still there. URL for one of the pads http://etherpad.usabilidoido.com.br:8080/p/07318a9b2b5666637d870fc50656323620af4df4

usabilidoido avatar Apr 18 '14 14:04 usabilidoido

I am right now in the process of upgrading to 1.4 and hopefully going live with the new version, so I can check if new defects come up in fresh pads after running on the new version.

@usabilidoido you can tell your users to export-import the pad. You can access controls by adding /timeslider to the url like this: http://etherpad.usabilidoido.com.br:8080/p/07318a9b2b5666637d870fc50656323620af4df4/timeslider

Export as html and then import into a new pad.

SkoricIT avatar Apr 18 '14 15:04 SkoricIT

I am experiencing this issue in 1.4. On broken pads, command line shows [WARN] client - Uncaught TypeError: Cannot read property 'length' of undefined when browser shows the Failed assertion error.

Hat tip to @Ra1d3n for the /timeslider workaround. Glad to see pad content is still accessible there.

ericpedia avatar Apr 24 '14 22:04 ericpedia

This is just a hunch, but if you like, try with the experimental try/client-init-remove-checkRep branch I just created. (This is generally a dangerous thing to do, but it's worth a try, I think.)

marcelklehr avatar Apr 25 '14 21:04 marcelklehr

I have upgraded everything to 1.4. and yesterday we had a broken pad again. Might still be one that broke before update, but I am not sure. I will keep on looking.

@marcelklehr Unfortunately, I can't move production server to a dangerous version. And I can't mirror requests to a secondary server because I don't have the resources. :-/

SkoricIT avatar May 09 '14 14:05 SkoricIT

Sorry, I wasn't clear: Don't run try/client-init-remove-checkRep in production, but try to access the broken pads with etherpad running on that branch.

I removed checkRep in that branch, because I suspect that normalization may not work correctly in some cases. So, when a broken pad works on that branch without any problems at all, we've got to revisit this method.

marcelklehr avatar May 09 '14 14:05 marcelklehr

@marcelklehr I just did, and unfortunately it did not help.

Process:

git fetch
git checkout try/client-init-remove-checkRep
git status
On branch try/client-init-remove-checkRep
Your branch is up-to-date with 'origin/try/client-init-remove-checkRep'.

I confirmed the change is actually in the file system. (comment and new line are there) Error is still the same.

asd

I did get the error that @ericpedia mentioned, and it did not occur on pads other than the corrupted one.

console on server:

[2014-05-09 16:55:39.152] [WARN] client - Uncaught TypeError: Cannot read property 'length' of undefined -- { errorId: 'dTtndCRA5gonLZyvMlqw',
  msg: 'Uncaught TypeError: Cannot read property \'length\' of undefined',
  url: 'http://localhost:9001/p/OkTJWMYVNs',
  linenumber: 15,
  userAgent: 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36' }

When I kill the server the message is displayed in the client, also:

asd

I might be able to give you an SQL import of the broken pad, but you would need to tell me what exactly you need extracted from the database first. :-)

SkoricIT avatar May 09 '14 15:05 SkoricIT

The actual pad content would be very helpful, so that'd be db key pad:<PADID> (http://etherpad.org/doc/v1.4.0/#index_pad_padid) and perhaps a few of the last revisions.

marcelklehr avatar May 09 '14 19:05 marcelklehr

I think I'm getting closer:

checkPad says:

$ bin/checkPad <padID>
[WARN] console - DirtyDB is used. This is fine for testing but not recommended for production.
[ERROR] console - Bad changeset at revision 4901 - Failed assertion: mismatched apply: 11636 / 11635
[ERROR] console - Bad changeset at revision 11401 - Failed assertion: mismatched apply: 42094 / 42093
[ERROR] console - Bad changeset at revision 12301 - Failed assertion: mismatched apply: 48875 / 48874
[ERROR] console - Bad changeset at revision 13601 - Failed assertion: mismatched apply: 60227 / 60226
[INFO] console - finished

Mismatched apply in all cases means that the changeset in question expected one character less than actually present (so, one unexpected character). After examining the db dump, I found out that all of these changesets follow a revision with an atext attached to it (not all revisions include the full pad contents, but instead just the delta, however, every so often for performance reasons the full contents are attached).

Presumably, something went awry with this meta property either upon storing the revision or upon creating the current atext for a new pad client.

marcelklehr avatar May 13 '14 14:05 marcelklehr

I just rewrote checkPad to use the computed atext instead of the cached one and the pad passes. Even the cached atexts are correct! This makes me think there's a bug in some algorithm that computes the full atext for the client_vars!

marcelklehr avatar May 13 '14 14:05 marcelklehr