-
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
User-visible warning for disconnected/not saving state #56
Comments
Asked for advice at firepad group: https://groups.google.com/forum/#!topic/firepad-io/s1aTZXZniAM |
Also initial "loading..." indication. Not sure it's water-tight wrt bugs like #85.
This is partially implemented, and works very nicely when typing and when internet goes offline/online. |
restore generic "Alpha quality" warning. While #56 is not water-tight yet, the specific bug has been fixed.
Bah. What I pushed was somewhat broken
I'm somewhat fond of the fading out to "done" / "saved" so looking at solutions that don't give them up. http://viget.com/inspire/css-pointer-events-and-a-pure-css3-animating-tooltip and http://www.greywyvern.com/?post=337 sound promising... |
BTW, |
Also actually hide them on IE8,9. (part of collateral damage I inflicted dealing with #56) Tested on Chrome and Firefox, will test more before deploying. This really could use automated testing, but it's rather tricky :-( http://stackoverflow.com/a/10352525/239657 and http://www.taccgl.org/blog/css-transition-visibility.html have good explanations why `visibility` transition does the right thing. I discovered that I had to set `#status_container{ visibility: hidden }` or it wouldn't work on Chrome; this also avoids #status_container from blocking clicks, so reverting the less elegant `height: 0`. I wasn't sure if I should also set `pointer-events: none`. It makes sure you can click through the status even when it's visible, but I'm not sure that's a feature, it doesn't work on IE<11, and would mysteriously prevent adding a hover tooltip to statuses.
Back to the real goal: would current indication based on firepad's (Reproducing #85 took some effort. Going back to the buggy CM-MJ wasn't enough; it seems firebase-debug.js not only reports but also tolerates exceptions better, and I only managed to reproduce with the non-debug firepad.js) |
|
Aha moment! |
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).
Progress: Headless firepad works. (For some reason it didn't for ~ a day when I initially played in the JS console but now it works both from script and console) But the much bigger issue is performance. As commented on 0e8a2d4 , I'm seeing a memory leak and slowdown; Is memory leak root cause of slowness? I did experince whole computer slowdown. Ideas:
|
Oh, dev consoles leak a lot as well. Quickly reach hundreds of megabytes. |
https://groups.google.com/forum/#!topic/firebase-talk/AEDekJ_B480 is interesting. |
Just reducing CPU usage to say once/minute is not good enough. I should also check whether this whole feature noticably increases a tab's memory usage. At best, I'll still be constructing 2 copies of the text (codemirror getValue, firepad getText). But that's negligible compared to the full usage I see. |
Using heap profiling on the ~100K document. All these strings are retained! They're retained in Which is exactly what I assumed above - new Firepad.Headless() retains everything via callbacks. |
Oh, and the accumulating callbacks also explain slowdown :-) |
See #56 for detailed investigation; in short every Headless registers firebase callbacks so it never goes away, and that's expensive because the Headless has a copy of the text (and eventually expensive in CPU).
Brilliant - 8d031b7 fixed the leak according to Chrome allocations profiler :-) |
Looked at firebase analytics and saw this strange bandwidth graph: It's never been this sharp! And why is it suddenly flat? I really hope that the high bandwidth was specific to the fresh-Headless-every second version and the one-Headless is saner. Need to test before landing. |
Yesterday I pushed broken CM/firepad combo such that pages loaded, you could edit but edits weren't saved! There was no user-visible indication this is the case.
But simply being offline gives a similar result.
It's not enough to check firepad's idea of version made it to the server; I suspect in this case there was an exception early in firepad such that it's version. Ideal might be comparing full text (not too frequently)?
Local storage backup wouldn't hurt too, but that's another story.
The text was updated successfully, but these errors were encountered: