Closed Bug 860492 Opened 12 years ago Closed 3 years ago

Viewing big text files hangs the browser for a long time

Categories

(Core :: Layout: Text and Fonts, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: ernstp, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: hang, perf)

Attachments

(1 file)

(deleted), application/octet-stream
Details
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20130410 Firefox/23.0 Build ID: 20130410065939 Steps to reproduce: I often look at build logs of around 10 MB or sometimes more. Loading those takes very long time in Firefox, but worst of all is that it hangs the entire UI completely for a long time. Here's a bit smaller example: https://launchpadlibrarian.net/136191756/buildlog_ubuntu-raring-amd64.firefox_20.0%2Bbuild1-0ubuntu1_UPLOADING.txt.gz plain/text of html with a big <pre> or similar doesn't seem to matter, they're both slow. I actually expect these to load instantaneously and without hangs, just like a good text editor would do. They contain no layout, DOM, html etc so it should be possible to do a lot of optimizations. It's a little bit better in Nightly than on Aurora. Actual results: Here's the trace from about:telemetry gfxSkipCharsIterator::IsOriginalCharSkipped(int *) (in xul.pdb) nsSkipCharsRunIterator::NextRun() (in xul.pdb) PropertyProvider::GetHyphenationBreaks(unsigned int,unsigned int,bool *) (in xul.pdb) gfxTextRun::BreakAndMeasureText(unsigned int,unsigned int,bool,double,gfxTextRun::PropertyProvider *,bool,double *,gfxFont::RunMetrics *,gfxFont::BoundingBoxType,gfxContext *,bool *,unsigned int *,bool,gfxBreakPriority *) (in xul.pdb) nsTextFrame::ReflowText(nsLineLayout &,int,nsRenderingContext *,bool,nsHTMLReflowMetrics &,unsigned int &) (in xul.pdb) nsLineLayout::ReflowFrame(nsIFrame *,unsigned int &,nsHTMLReflowMetrics *,bool &) (in xul.pdb) nsBlockFrame::ReflowInlineFrame(nsBlockReflowState &,nsLineLayout &,nsLineList_iterator,nsIFrame *,LineReflowStatus *) (in xul.pdb) nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState &,nsLineLayout &,nsLineList_iterator,nsFlowAreaRect &,int &,nsFloatManager::SavedState *,bool *,LineReflowStatus *,bool) (in xul.pdb) nsBlockFrame::ReflowInlineFrames(nsBlockReflowState &,nsLineList_iterator,bool *) (in xul.pdb) nsBlockFrame::ReflowDirtyLines(nsBlockReflowState &) (in xul.pdb) nsBlockFrame::Reflow(nsPresContext *,nsHTMLReflowMetrics &,nsHTMLReflowState const &,unsigned int &) (in xul.pdb) nsBlockReflowContext::ReflowBlock(nsRect const &,bool,nsCollapsingMargin &,int,bool,nsLineBox *,nsHTMLReflowState &,unsigned int &,nsBlockReflowState &) (in xul.pdb) nsBlockFrame::ReflowBlockFrame(nsBlockReflowState &,nsLineList_iterator,bool *) (in xul.pdb) nsBlockFrame::ReflowDirtyLines(nsBlockReflowState &) (in xul.pdb) nsBlockFrame::Reflow(nsPresContext *,nsHTMLReflowMetrics &,nsHTMLReflowState const &,unsigned int &) (in xul.pdb) nsBlockReflowContext::ReflowBlock(nsRect const &,bool,nsCollapsingMargin &,int,bool,nsLineBox *,nsHTMLReflowState &,unsigned int &,nsBlockReflowState &) (in xul.pdb) nsBlockFrame::ReflowBlockFrame(nsBlockReflowState &,nsLineList_iterator,bool *) (in xul.pdb) nsBlockFrame::ReflowDirtyLines(nsBlockReflowState &) (in xul.pdb) nsBlockFrame::Reflow(nsPresContext *,nsHTMLReflowMetrics &,nsHTMLReflowState const &,unsigned int &) (in xul.pdb) nsContainerFrame::ReflowChild(nsIFrame *,nsPresContext *,nsHTMLReflowMetrics &,nsHTMLReflowState const &,int,int,unsigned int,unsigned int &,nsOverflowContinuationTracker *) (in xul.pdb) nsCanvasFrame::Reflow(nsPresContext *,nsHTMLReflowMetrics &,nsHTMLReflowState const &,unsigned int &) (in xul.pdb) nsContainerFrame::ReflowChild(nsIFrame *,nsPresContext *,nsHTMLReflowMetrics &,nsHTMLReflowState const &,int,int,unsigned int,unsigned int &,nsOverflowContinuationTracker *) (in xul.pdb) nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowState *,bool,bool,nsHTMLReflowMetrics *,bool) (in xul.pdb) nsHTMLScrollFrame::ReflowContents(ScrollReflowState *,nsHTMLReflowMetrics const &) (in xul.pdb) nsHTMLScrollFrame::Reflow(nsPresContext *,nsHTMLReflowMetrics &,nsHTMLReflowState const &,unsigned int &) (in xul.pdb) nsContainerFrame::ReflowChild(nsIFrame *,nsPresContext *,nsHTMLReflowMetrics &,nsHTMLReflowState const &,int,int,unsigned int,unsigned int &,nsOverflowContinuationTracker *) (in xul.pdb) ViewportFrame::Reflow(nsPresContext *,nsHTMLReflowMetrics &,nsHTMLReflowState const &,unsigned int &) (in xul.pdb) PresShell::DoReflow(nsIFrame *,bool) (in xul.pdb) PresShell::ProcessReflowCommands(bool) (in xul.pdb) PresShell::FlushPendingNotifications(mozilla::ChangesToFlush) (in xul.pdb) PresShell::FlushPendingNotifications(mozFlushType) (in xul.pdb) nsDocumentViewer::LoadComplete(tag_nsresult) (in xul.pdb) nsDocShell::EndPageLoad(nsIWebProgress *,nsIChannel *,tag_nsresult) (in xul.pdb) nsDocShell::OnStateChange(nsIWebProgress *,nsIRequest *,unsigned int,tag_nsresult) (in xul.pdb) nsDocLoader::DoFireOnStateChange(nsIWebProgress * const,nsIRequest * const,int &,tag_nsresult) (in xul.pdb) nsDocLoader::doStopDocumentLoad(nsIRequest *,tag_nsresult) (in xul.pdb) nsDocLoader::DocLoaderIsEmpty(bool) (in xul.pdb) nsDocLoader::OnStopRequest(nsIRequest *,nsISupports *,tag_nsresult) (in xul.pdb) nsLoadGroup::RemoveRequest(nsIRequest *,nsISupports *,tag_nsresult) (in xul.pdb) nsDocument::DoUnblockOnload() (in xul.pdb) nsDocument::UnblockOnload(bool) (in xul.pdb) nsBindingManager::DoProcessAttachedQueue() (in xul.pdb) nsRunnableMethodImpl<void ( nsBindingManager::*)(void),1>::Run() (in xul.pdb) nsThread::ProcessNextEvent(bool,bool *) (in xul.pdb) NS_ProcessNextEvent(nsIThread *,bool) (in xul.pdb) mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate *) (in xul.pdb) MessageLoop::RunHandler() (in xul.pdb) MessageLoop::Run() (in xul.pdb) nsBaseAppShell::Run() (in xul.pdb) nsAppShell::Run() (in xul.pdb) nsAppStartup::Run() (in xul.pdb) XREMain::XRE_mainRun() (in xul.pdb) XREMain::XRE_main(int,char * * const,nsXREAppData const *) (in xul.pdb) XRE_main (in xul.pdb) do_main (in firefox.pdb) wmain (in firefox.pdb) __tmainCRTStartup (in firefox.pdb) BaseThreadInitThunk (in wkernel32.pdb) __RtlUserThreadStart (in wntdll.pdb) _RtlUserThreadStart (in wntdll.pdb)
Keywords: hang, perf
Same behavior on Linux.
Attached file Example (deleted) —
Actually my previous statement was false, putting the above build log in a html file with <pre></pre> makes it a LOT worse, at least on Nightly.
Oh that gz isn't smaller, it's 33 MB uncompressed.
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20130415 Firefox/22.0 Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:23.0) Gecko/20130410 Firefox/23.0 I was able to reproduce the issue on Firefox 23 (Build ID:20130410031044), Firefox 22 (Build ID:20130415004014) and on Firefox21 Beta2 (Build ID:20130408165307). It takes a few seconds for loading the page, but after the page is loaded, the scroll works smoothly. Does this bug should be moved to Core - Document navigation component?
Blocks: 859558
We've had a number of these bugs filed but I'm going to single this one out as a proxy for hangs due to large text file rendering. Not strictly a "font" hang, probably better described as a layout hang.
After looking at it a bit more I think this could be split into two bugs. One for text/plain and one for HTML with a huge <pre></pre> tag. text/plain seems to be slow because of various "BreakAndMeasureText" and Reflow. For the <pre> case Nightly started taking 4 GBs of memory so there was some kind of fishy regression going on I think... So should we keep this bug aboug text/plain and file a new one for the <pre> case?
(In reply to John Daggett - out 14 - 24 June (:jtd) from comment #6) > We've had a number of these bugs filed but I'm going to single this one out > as a proxy for hangs due to large text file rendering. Not strictly a > "font" hang, probably better described as a layout hang. John, can you triage this to a more appropriate component if this is layout-related? It probably shouldn't stay in Firefox in that case...
Flags: needinfo?(jdaggett)
Component: Untriaged → Layout: Text
Flags: needinfo?(jdaggett)
OS: Windows 7 → All
Product: Firefox → Core
Hardware: x86_64 → All
Depends on: 934770
It must be possible to optimize the layout code to display text/plain with less CPU overhead, no?
I don't know it's the same problem or not but Firefox has really hard time opening the following URL, but it can be easily opened in Chrome: http://fa.wikipedia.beta.wmflabs.org/w/index.php?title=%D8%B9%D8%A8%D8%AF%D8%A7%D9%84%DA%A9%D8%B1%DB%8C%D9%85_%D8%B3%D8%B1%D9%88%D8%B4&diff=715&oldid=714 I tried running Firefox in safe mode and disabling JavaScript, but no luck. Using Firefox 46.0.1 on a Win 10 64-bit machine.
Still a problem. For instance build-logs from koji: https://kojipkgs.fedoraproject.org//packages/firefox/47.0/3.fc24/data/logs/x86_64/build.log Firefox freezes (UI) and takes 100% CPU.
Status: UNCONFIRMED → NEW
Ever confirmed: true

Yeah WFM. Multi process also makes everything a lot better here.

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

Attachment

General

Created:
Updated:
Size: