Closed Bug 703455 Opened 13 years ago Closed 1 year ago

Firefox hangs for 10 seconds while loading IRCCloud

Categories

(Core :: Graphics, defect)

x86
Windows 7
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: Felipe, Unassigned)

References

Details

(Whiteboard: [Snappy:P3])

Attachments

(1 file)

Whenever I load IRCCloud on my computer, Firefox hangs for about 5-10 seconds (with the Non-responding titlebar) and then returns and continue to working correctly. I can reproduce this every time.

I attached a profiler and here are the top sampled functions:

===========
gfx3DMatrix::operator*                         33.3%
gfxTextRun::AddGlyphRun                        6.2%
gfxAlphaRecovery::GoodAlignmentLog2            4.4%
JSScript::jitDataSize                          3.0%
js::StringIsArrayIndex                         2.7%
NS_CycleCollectorSuspect2_P                    1.7%
js_GetTypeInferenceMemoryStats                 1.4%
js_FindProperty                                1.3%
js_ValueToSource                               1.2%
iswdigit                                       1.2%
gfxTextRunFactory::Release                     1.2%
JS_CallOnce                                    1.2%
JSScript::dataSize                             1.2%
gfxFont::ProvidesGetGlyph                      0.9%
gfx3DMatrix::CanDraw2D                         0.9%
RtlEnterCriticalSection                        0.8%
malloc                                         0.7%
js_GCThingIsMarked                             0.7%
std::_Init_locks::operator=                    0.6%
mozilla::gfx::BaseRect<
  double,gfxRect,gfxPoint,gfxSize,gfxMargin    0.6%
  >::Round
gfxFontGroup::InitScriptRun                    0.6%
gfxFontGroup::FontListLength                   0.6%
WaitForMultipleObjectsEx                       0.6%
RtlLeaveCriticalSection                        0.6%
JS_GetTypeInferenceObjectStats                 0.6%
===========

Attaching the profiler unfortunately makes the Flash plugin loaded to crash, so it's not entirely clear this is the correct sampling, but I believe it's useful.

See also bug 703436, a similar prob. I saved the profiled data and can also reproduce the problem as needed.
See Also: → 703436
IRCCloud requires Flash on Firefox for "web sockets". On Chrome they use the native web sockets, but don't seem to have a timeline for adding support for MozWebSocket.
Whiteboard: [Snappy]
I got a 4 second hang, which eventually caused an unresponsive script popup:
  Script: https://irccloud.com/static/js/dep/jquery-1.6.2.min.js?v=a1a8cb16a060f6280a767187fd22e037:16

When I loaded it a second time, I got 4 second-ish hang, an unresponsive script popup, then when I clicked through, it pinwheeled for another four second.  Looking in my error console, there was a 600ms CC, a 1641ms compartmental GC (!), a 600ms global GC, a 1236ms CC, 520ms compartmental GC, 426ms global GC, then it has settled down a bit.  I don't think all of that is during the initial loading, but at least some of it is.
Marking as [Snappy:P3].  This is a complex webapp, so some slowness on starting it up seems like it may be expected.  From my crude measurements, it seems like a lot of the pauses could be GC and CC, and there's ongoing work in that area.  We should look at this once incremental GC and improved CC has landed, and we have better pause time analysis tools.
Depends on: IncrementalGC
Whiteboard: [Snappy] → [Snappy:P3]
Blocks: 702495
If comparing the performance of IRCCloud between Firefox and Chrome, it is important to note these lines in their JavaScript:

>if (window.WebSocket && !window.MozWebSocket) {
>    window.WEB_SOCKET_SUPPORT = true;
>}
>if (!window.WEB_SOCKET_SUPPORT) {
>    // Global config
>    WEB_SOCKET_SWF_LOCATION = '/static/js/lib/WebSocketMain.swf';
>    WEB_SOCKET_DISABLE_AUTO_INITIALIZATION = true;
>    dep.push('/static/js/dep/swfobject.js');
>    lib.push('/static/js/lib/web_socket.js');
>    app.push('/static/js/app/websocket.js');
>}
You could try to profile it again or compare to Chrome with this:

https://addons.mozilla.org/en-US/firefox/addon/websockets-for-irccloud/

This add-on basically just sets window.WEB_SOCKET_SUPPORT to true.
Darn, we're missing profiling labels for the big culprit(s) under the event handling code.
IRCCloud supports WebSockets in FF natively now.
Attached image irccloud.png
Despite comment 8 this is still happening for me on Fx 29.0.1 with the current version of IRCCloud.  I don't know if it's the same issue, but I get a nonresponsive script error with IRCCloud (see attached).  It's not when I first load the app, but rather when I re-open my laptop after it sleeps to restore my irc sessions.
I have the same problem daily, coming out of suspend mode. I wonder whether it's an IRCCloud problem - i.e. whether it happens for Chrome, too. It might of course not be as visible due to Chrome's process separation.
We've only seen this on Firefox. There may indeed be something we can do to avoid it in Firefox, but unfortunately I haven't been able to get any useful debugging information on what's going on. More detail on where the bottleneck is, with a stacktrace would be extremely helpful.
I don't get any unresponsive scripts dialog, however tab switching hangs as soon as I load IRCCloud for the first time in my Nightly.
I profiles using the built-in profiler and http://people.mozilla.org/~bgirard/cleopatra/#report=14e4dbcb001de34d2982636816d3deda25cbf70e is what I have. Maybe it helps.
Can anyone shed any light on that profiler, or how to read it as an author? (As opposed to a browser developer) It's indecipherable to me.
https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Profiling_with_the_Built-in_Profiler#Understanding_Cleopatra_Profiles has some information. I'm not too familiar with this too, but other here or Benoit Girard might have more information.
Flags: needinfo?(bgirard)
The profile here didn't capture a 10 second hang.

Try collecting the profile again with profiler.interval set to 10 (reboot firefox). Then hit CTRL+SHIFT+2 right after the hang completes. The profile should then contain the hang.
Flags: needinfo?(bgirard)
Posting the IRC discussion with djvj : http://logs.glob.uno/?c=mozilla%23jsapi#c460852
So, we are bailing out a LOT inside our self-hosted ArrayIndexOf, when the second argument to ArrayIndexOf is a non-primitive.  We should be catching this, updating typeinfo, and invalidating the IonScript so that we can re-compile the script in Ion with looser typeinfo.
Depends on: 1059426
So even after bug 1059426 being fixed, I still get the hangs. http://people.mozilla.org/~bgirard/cleopatra/#report=cfb764ce873c83aa10f7bbc0083e23d79d72f182 is another profile on the latest Nightly. BenWa, any idea what might be the issue now?
Flags: needinfo?(bgirard)
Long running JS with a ton of bailout. Back to you :djvj.
Flags: needinfo?(bgirard) → needinfo?(kvijayan)
Firefox is really slow for me today and I see lots of bailout and Ion activity here. Not sure if something changed since yesterday?

http://people.mozilla.org/~bgirard/cleopatra/#report=5bd6633ced239b1c2de0ac72ca845327999006be
(In reply to Tim Taubert [:ttaubert] from comment #21)
> Not sure if something changed since yesterday?

Just noticed I'm running yesterday's Nightly (2014-10-06). Cant' remember having these problems yesterday though.
Flags: needinfo?(kvijayan)
Severity: normal → S3

Unable to reproduce.

Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: