Infinite text looping
Version info
Firebase:
2.3.2
Firepad:
1.3.0
Ace:
1.2.6
Steps to reproduce
I'm not sure how to exactly reproduce this reliably, but it is correlated with calling firepad.dispose() then creating a new firepad with firepad.create()
Actual behavior
The current text in the editor repeats itself multiple times over without terminating.
I get the following error in the web console:
firebase.js:43 Uncaught Error: Both operations have to have the same base length at firepad.TextOperation.TextOperation.transform (firepad.js:757) at Function.firepad.WrappedOperation.WrappedOperation.transform (firepad.js:1935) at transformStack (firepad.js:1993) at UndoManager.firepad.UndoManager.UndoManager.transform (firepad.js:2004) at EditorClient.firepad.EditorClient.EditorClient.applyOperation (firepad.js:2403) at Synchronized.firepad.Client.Synchronized.applyServer (firepad.js:2107) at EditorClient.firepad.Client.Client.applyServer (firepad.js:2070) at operation (firepad.js:2307) at FirebaseAdapter.clazz.trigger (firepad.js:48) at FirebaseAdapter.firepad.FirebaseAdapter.FirebaseAdapter.handlePendingReceivedRevisions_ (firepad.js:1618) firepad.TextOperation.TextOperation.transform @ firepad.js:757 firepad.WrappedOperation.WrappedOperation.transform @ firepad.js:1935 transformStack @ firepad.js:1993 firepad.UndoManager.UndoManager.transform @ firepad.js:2004 firepad.EditorClient.EditorClient.applyOperation @ firepad.js:2403 firepad.Client.Synchronized.applyServer @ firepad.js:2107 firepad.Client.Client.applyServer @ firepad.js:2070 operation @ firepad.js:2307 clazz.trigger @ firepad.js:48 firepad.FirebaseAdapter.FirebaseAdapter.handlePendingReceivedRevisions_ @ firepad.js:1618 (anonymous) @ firepad.js:1551 (anonymous) @ firebase.js:48 Db @ firebase.js:43 zb @ firebase.js:22 Ab @ firebase.js:21 g.Gb @ firebase.js:207 g.Id @ firebase.js:195 yh.Id @ firebase.js:185 (anonymous) @ firebase.js:183 th @ firebase.js:177 ua.onmessage @ firebase.js:176
I also sometimes get this error:
firepad.js:1686 Uncaught Error: sendOperation() called with invalid operation. at assert (firepad.js:1686) at FirebaseAdapter.firepad.FirebaseAdapter.FirebaseAdapter.sendOperation (firepad.js:1443) at EditorClient.firepad.EditorClient.EditorClient.sendOperation (firepad.js:2396) at Synchronized.firepad.Client.Synchronized.applyClient (firepad.js:2100) at EditorClient.firepad.Client.Client.applyClient (firepad.js:2065) at EditorClient.firepad.EditorClient.EditorClient.onChange (firepad.js:2365) at ACEAdapter.change (firepad.js:2288) at ACEAdapter.firepad.ACEAdapter.ACEAdapter.trigger (firepad.js:2682) at ACEAdapter.firepad.ACEAdapter.ACEAdapter.onChange (firepad.js:2475) at Array.<anonymous> (firepad.js:2429)
Have had problems with this as well. Unable to reproduce it reliably.
@Jvlythical Did you find anyway to catch the error and prevent it from causing a mess?
@jwngr @mikelehen Do you guys know anything about this bug?
So that error is an internal consistency check that prevents firepad from writing "corrupt" operations into the document history. It's unfortunately not really possible to diagnose without a way to reproduce. Sometimes I've seen it happen after a previous operation has failed (i.e. there's a prior exception that's the real cause), but I assume that's not the case here.
Sorry I can't be more helpful. If you track down repro steps, let me know.
@mikelehen Is there anyway I can catch the error? To prevent it from looping out of control. Like I can have a catch block for the specific error or error group that's thrown and reload the page or something.
Well, I don't understand why it would loop infinitely on its own. I could imagine you'd see it on every key press, but it shouldn't happen uncontrollably AFAIK... So you'd need to debug and figure out why that's happening (sorry).