-
Notifications
You must be signed in to change notification settings - Fork 46
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
saving/sync broken #85
Comments
More important than fixing this particular sync problem would be (A) testing and/or (B) indication whenever edits don't get saved (for whatever reason) — #56 |
Let's see the stack trace on the later error: firepad.js:1673 Uncaught Error: sendOperation() called with invalid operation. This sounds somewhat like |
This is horrific. It's likely that silent edit loss has been going on for users for don't know how long :-(
|
pushing prominent warning on top linking to this bug... |
progress: Tip to future self: firebase-debug.js is really useful in that it dumps stack on "Uncaught" exceptions it catches. |
Triggered on any change when line 0 contains a CM bookmark. I wrote the lazy `found.line ?` without cosidering what if line == 0. Very embarrasing. I should be fired :-( In Mathdown this caused cben/mathdown#85 because Firepad renders other users' cursors with a CM bookmark => editing the first line immediately broke other windows editing same line. Bug originated in 475901c on 2014-10-21
Don't remove foreign marked ranges (fixes #19).
…reak other code handling CM events, such as Firepad as happened in cben/mathdown#85.
> Fix `TypeError: Cannot read property 'line' of undefined` exception. Triggered on any change when line 0 contains a CM bookmark. > Catch all errors in our CM event handlers so (I hope) we can't ever break other code handling CM events, such as Firepad as happened in #85. and another dumb bug from same commit: > Fix #19 correctly: clear only our markers, not only foreign ones!
OK, conclusions:This has been broken for half a yearcaused cben/CodeMirror-MathJax@475901c where I made 2 drunk-idiot-level bugs
|
I've pushed a fix but I'm leaving this bug open (and the warning on top leading here) until I implement #56 to reliably warn any user whose specific saving doesn't work. |
Also initial "loading..." indication. Not sure it's water-tight wrt bugs like #85.
restore generic "Alpha quality" warning. While #56 is not water-tight yet, the specific bug has been fixed.
Good news: reproducing the problem (for #56) proved quite hard. Firepad is much more stubborn than I expected in sending and receiving changes even when there are exceptions :-)
|
Periodically creates new Firepad.Headless, loads the text and compares to current editor content. Also checks Firebase's online status for better messages. After a couple days of torturing, this seems to reliably detect #85 borked firepad state and warn "Online but unsaved — BUG?". Problems: - False positives during typing (saw this) or incoming changes (theoretical). Needs debouncing after a period of quiet... - Currently for easy testing runs the check *every second*! Should increase testSyncIntervalMs to 30-60sec before landing. - If only to avoid constant 1-5% CPU usage. - Performance concerns: after a day of holding and torture-editing 2 chrome tabs, things crawled to unusably slow stuck-after-every-press. Their combined memory usage grew to ~1.5GB! (plus ~1GB for their dev tools) And at some point CPU usage grew to 100%. - Near the end, I timed Headless getText to take >3 seconds! Initially it's ~1ms for existing Headless and ~230ms for new Headless! This explains 100% CPU - 1sec timer should be after prev timer finished execution, but alas getText() returns immediately. - AFAICT, snapshots were being taken so it's not op composition overhead. - It seems memory leak does not happen in current mathdown.net version (0f69d29).
UPDATE: It seems that whenever one page was opened in 2 places (by you or another person),
and you edited the first line, the other editor could become corrupt and silently fail to save subsequent edits.
THIS BUG HAS BEEN THERE FOR ABOUT HALF A YEAR. You may have lost a lot :-(
Email me [email protected] and I'll try to help. Unfortunately if loss occurred, I'm afraid nothing was sent to the servers, so not sure I'll be able to help.
I've found and fixed the bug; this issue will remain open until I add a second layer of protection (#56) from future similar bugs...
[written from Anat's name but actually by @cben]
In this case I believe I haven't lost edits but syncing did fail — silently — which is a scary data loss scenario!
Both operations have to have the same base length
errors. It seems that changes from Beni's computer do appear on mine.sendOperation() called with invalid operation.
— and did not reflect the edit on Beni's.The text was updated successfully, but these errors were encountered: