Open Bug 643918 Opened 13 years ago Updated 2 years ago

Infinite hang in line breaking code with large amount of text in a <pre> with "white-space: pre-wrap" inside a narrow iframe

Categories

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

x86
macOS
defect

Tracking

()

People

(Reporter: jamesr, Unassigned)

References

(Depends on 1 open bug, )

Details

(Keywords: regression)

Attachments

(4 files, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b13pre) Gecko/20110316 Firefox/4.0b13pre
Build Identifier: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b13pre) Gecko/20110316 Firefox/4.0b13pre

When loading the page in the URL field firefox goes into an infinite loop, or at least takes more than a few minutes.  OS X's sample utility seems to implicate the line breaking code which makes sense as this is a testcase that stresses the line breaker pretty hard.

The page loads up a large amount of text inside a <pre style="word-wrap: break-word; white-space: pre-wrap;"> loaded inside <iframe>s of various width to measure the line breaking behavior (it's actually from a test for an unrelated WebKit bug, for the curious).

This is a regression from Firefox 3.6.15 which on my box terminates in a reasonable amount of time.

Reproducible: Always

Steps to Reproduce:
1. Open the page
2. Observe it successfully handle the 0px - 30px cases but goes into an infinite loop on 40px.



Here's the output from OS X's sample tool (excluding non-main threads) from my MacBook pro:

Sampling process 245 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling firefox-bin (pid 245) every 1 millisecond
Call graph:
    1771 Thread_3369   DispatchQueue_1: com.apple.main-thread  (serial)
      1756 start
        1756 main
          1756 XRE_main
            1756 nsAppStartup::Run()
              1756 nsAppShell::Run()
                1756 -[NSApplication run]
                  1756 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
                    1756 _DPSNextEvent
                      1756 BlockUntilNextEventMatchingListInMode
                        1756 ReceiveNextEventCommon
                          1756 RunCurrentEventLoopInMode
                            1756 CFRunLoopRunSpecific
                              1756 __CFRunLoopRun
                                1756 __CFRunLoopDoSources0
                                  1756 nsAppShell::ProcessGeckoEvents(void*)
                                    1756 nsBaseAppShell::NativeEventCallback()
                                      1756 NS_ProcessPendingEvents_P(nsIThread*, unsigned int)
                                        1756 nsThread::ProcessNextEvent(int, int*)
                                          1756 nsRunnableMethodImpl<void (nsDocument::*)(), true>::Run()
                                            1756 nsDocument::DispatchContentLoadedEvents()
                                              1756 nsDocument::DoUnblockOnload()
                                                1756 nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, unsigned int)
                                                  1756 nsDocLoader::OnStopRequest(nsIRequest*, nsISupports*, unsigned int)
                                                    1756 nsDocLoader::DocLoaderIsEmpty(int)
                                                      1756 nsDocLoader::FireOnStateChange(nsIWebProgress*, nsIRequest*, int, unsigned int)
                                                        1756 nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, unsigned int)
                                                          1756 nsDocShell::EndPageLoad(nsIWebProgress*, nsIChannel*, unsigned int)
                                                            1756 DocumentViewerImpl::LoadComplete(unsigned int)
                                                              1756 PresShell::FlushPendingNotifications(mozFlushType)
                                                                1756 PresShell::ProcessReflowCommands(int)
                                                                  1756 PresShell::DoReflow(nsIFrame*, int)
                                                                    1756 ViewportFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&)
                                                                      1756 nsContainerFrame::ReflowChild(nsIFrame*, nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, int, int, unsigned int, unsigned int&, nsOverflowContinuationTracker*)
                                                                        1756 nsHTMLScrollFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&)
                                                                          1756 nsHTMLScrollFrame::ReflowContents(ScrollReflowState*, nsHTMLReflowMetrics const&)
                                                                            1756 nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowState*, int, int, nsHTMLReflowMetrics*, int)
                                                                              1756 nsContainerFrame::ReflowChild(nsIFrame*, nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, int, int, unsigned int, unsigned int&, nsOverflowContinuationTracker*)
                                                                                1756 nsCanvasFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&)
                                                                                  1756 nsContainerFrame::ReflowChild(nsIFrame*, nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, int, int, unsigned int, unsigned int&, nsOverflowContinuationTracker*)
                                                                                    1756 nsBlockFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&)
                                                                                      1756 nsBlockFrame::ReflowDirtyLines(nsBlockReflowState&)
                                                                                        1756 nsBlockFrame::ReflowLine(nsBlockReflowState&, nsLineList_iterator, int*)
                                                                                          1756 nsBlockFrame::ReflowBlockFrame(nsBlockReflowState&, nsLineList_iterator, int*)
                                                                                            1756 nsBlockReflowContext::ReflowBlock(nsRect const&, int, nsCollapsingMargin&, int, int, nsLineBox*, nsHTMLReflowState&, unsigned int&, nsBlockReflowState&)
                                                                                              1756 nsBlockFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&)
                                                                                                1756 nsBlockFrame::ReflowDirtyLines(nsBlockReflowState&)
                                                                                                  1756 nsBlockFrame::ReflowLine(nsBlockReflowState&, nsLineList_iterator, int*)
                                                                                                    1756 nsBlockFrame::ReflowBlockFrame(nsBlockReflowState&, nsLineList_iterator, int*)
                                                                                                      1756 nsBlockReflowContext::ReflowBlock(nsRect const&, int, nsCollapsingMargin&, int, int, nsLineBox*, nsHTMLReflowState&, unsigned int&, nsBlockReflowState&)
                                                                                                        1756 nsBlockFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&)
                                                                                                          1756 nsBlockFrame::ReflowDirtyLines(nsBlockReflowState&)
                                                                                                            1756 nsBlockFrame::ReflowLine(nsBlockReflowState&, nsLineList_iterator, int*)
                                                                                                              1756 nsBlockFrame::ReflowInlineFrames(nsBlockReflowState&, nsLineList_iterator, int*)
                                                                                                                1755 nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState&, nsLineLayout&, nsLineList_iterator, nsFlowAreaRect&, int&, nsFloatManager::SavedState*, int*, LineReflowStatus*, int)
                                                                                                                  1126 nsBlockFrame::ReflowInlineFrame(nsBlockReflowState&, nsLineLayout&, nsLineList_iterator, nsIFrame*, LineReflowStatus*)
                                                                                                                    1125 nsLineLayout::ReflowFrame(nsIFrame*, unsigned int&, nsHTMLReflowMetrics*, int&)
                                                                                                                      1121 nsTextFrame::ReflowText(nsLineLayout&, int, nsIRenderingContext*, int, nsHTMLReflowMetrics&, unsigned int&)
                                                                                                                        1118 nsTextFrame::SetLength(int, nsLineLayout*, unsigned int)
                                                                                                                          1118 nsBlockFrame::DoRemoveFrame(nsIFrame*, unsigned int)
                                                                                                                            1081 nsLineBox::IndexOf(nsIFrame*) const
                                                                                                                            20 nsBlockFrame::DoRemoveFrame(nsIFrame*, unsigned int)
                                                                                                                            14 nsContinuingTextFrame::DestroyFrom(nsIFrame*)
                                                                                                                              11 nsTextFrame::ClearTextRun(nsTextFrame*)
                                                                                                                                11 UnhookTextRunFromFrames(gfxTextRun*, nsTextFrame*)
                                                                                                                                  10 UnhookTextRunFromFrames(gfxTextRun*, nsTextFrame*)
                                                                                                                                  1 moz_free
                                                                                                                              2 gfxTextRun::~gfxTextRun()
                                                                                                                                1 nsTArray_base<nsTArrayDefaultAllocator>::ShrinkCapacity(unsigned int)
                                                                                                                                1 szone_free_definite_size
                                                                                                                                  1 small_free_list_add_ptr
                                                                                                                              1 nsContinuingTextFrame::DestroyFrom(nsIFrame*)
                                                                                                                            2 nsFrame::DestroyFrom(nsIFrame*)
                                                                                                                              1 PresShell::NotifyDestroyingFrame(nsIFrame*)
                                                                                                                                1 mozilla::FramePropertyTable::DeleteAllFor(nsIFrame*)
                                                                                                                                  1 PL_DHashTableOperate
                                                                                                                              1 nsSVGEffects::InvalidateDirectRenderingObservers(nsIFrame*)
                                                                                                                            1 nsLineBox::Destroy(nsIPresShell*)
                                                                                                                        1 nsINode::GetProperty(unsigned short, nsIAtom*, unsigned int*) const
                                                                                                                          1 nsPropertyTable::GetPropertyInternal(nsPropertyOwner, nsIAtom*, int, unsigned int*)
                                                                                                                        1 nsTextFrame::UnionTextDecorationOverflow(nsPresContext*, PropertyProvider&, nsRect*)
                                                                                                                          1 nsLayoutUtils::GetTextShadowRectsUnion(nsRect const&, nsIFrame*, unsigned int)
                                                                                                                        1 nsThebesFontMetrics::Release()
                                                                                                                      4 nsLineLayout::ReflowFrame(nsIFrame*, unsigned int&, nsHTMLReflowMetrics*, int&)
                                                                                                                    1 nsBlockFrame::ReflowInlineFrame(nsBlockReflowState&, nsLineLayout&, nsLineList_iterator, nsIFrame*, LineReflowStatus*)
                                                                                                                  627 nsBlockFrame::PlaceLine(nsBlockReflowState&, nsLineLayout&, nsLineList_iterator, nsFloatManager::SavedState*, nsRect&, int&, int*)
                                                                                                                    621 nsLineLayout::TrimTrailingWhiteSpace()
                                                                                                                      621 nsLineLayout::TrimTrailingWhiteSpaceIn(nsLineLayout::PerSpanData*, int*)
                                                                                                                        621 nsTextFrame::TrimTrailingWhiteSpace(nsIRenderingContext*)
                                                                                                                          620 nsTextFrame::EnsureTextRun(gfxContext*, nsIFrame*, nsLineList_iterator const*, unsigned int*)
                                                                                                                            567 nsBlockInFlowLineIterator::nsBlockInFlowLineIterator(nsBlockFrame*, nsIFrame*, int*)
                                                                                                                              560 nsLineBox::IndexOf(nsIFrame*) const
                                                                                                                              6 nsBlockInFlowLineIterator::nsBlockInFlowLineIterator(nsBlockFrame*, nsIFrame*, int*)
                                                                                                                              1 nsLayoutUtils::FindChildContainingDescendant(nsIFrame*, nsIFrame*)
                                                                                                                            42 BuildTextRunsScanner::ScanFrame(nsIFrame*)
                                                                                                                              42 BuildTextRunsScanner::FlushFrames(int, int)
                                                                                                                                42 BuildTextRunsScanner::BuildTextRunForFrames(void*)
                                                                                                                                  28 MakeTextRun(unsigned char const*, unsigned int, gfxFontGroup*, gfxTextRunFactory::Parameters const*, unsigned int)
                                                                                                                                    28 TextRunWordCache::MakeTextRun(unsigned char const*, unsigned int, gfxFontGroup*, gfxTextRunFactory::Parameters const*, unsigned int)
                                                                                                                                      18 gfxFontGroup::MakeTextRun(unsigned char const*, unsigned int, gfxTextRunFactory::Parameters const*, unsigned int)
                                                                                                                                        18 gfxFontGroup::InitTextRun(gfxContext*, gfxTextRun*, unsigned short const*, unsigned int)
                                                                                                                                          15 gfxFontGroup::InitScriptRun(gfxContext*, gfxTextRun*, unsigned short const*, unsigned int, unsigned int, unsigned int, int)
                                                                                                                                            15 gfxFont::SplitAndInitTextRun(gfxContext*, gfxTextRun*, unsigned short const*, unsigned int, unsigned int, int)
                                                                                                                                              15 gfxMacFont::InitTextRun(gfxContext*, gfxTextRun*, unsigned short const*, unsigned int, unsigned int, int, int)
                                                                                                                                                15 gfxCoreTextShaper::InitTextRun(gfxContext*, gfxTextRun*, unsigned short const*, unsigned int, unsigned int, int)
                                                                                                                                                  4 CTLineCreateWithAttributedString
                                                                                                                                                    4 TTypesetterAttrString::Initialize()
                                                                                                                                                      2 TGlyphEncoder::EncodeChars(CFRange, __CFDictionary const*)
                                                                                                                                                        1 TRun::TRun(TCFBase<TGlyphStorage>*, CFRange, __CFDictionary const*)
                                                                                                                                                          1 TAttributes::TAttributes(__CFDictionary const*)
                                                                                                                                                            1 TAttributes::ParseAttributes(__CFDictionary const*, void const*&)
                                                                                                                                                              1 CFDictionaryApplyFunction
                                                                                                                                                        1 _CFRuntimeCreateInstance
                                                                                                                                                          1 malloc_zone_malloc
                                                                                                                                                            1 szone_malloc_should_clear
                                                                                                                                                              1 tiny_malloc_from_free_list
                                                                                                                                                      2 TTypesetter::FinishEncoding(TLine&, unsigned char) const
                                                                                                                                                        2 TShapingEngine::ShapeGlyphs(TLine&, TCharStream const&)
                                                                                                                                                          2 TAATMorphTable::ShapeGlyphs(bool&, bool&)
                                                                                                                                                            2 TAATMorphSubtableMorx::SetTablePtr(void const*)
                                                                                                                                                  4 _CFRelease
                                                                                                                                                    1 TLine::~TLine()
                                                                                                                                                      1 _CFRelease
                                                                                                                                                        1 __CFArrayReleaseValues
                                                                                                                                                          1 _CFRelease
                                                                                                                                                            1 _CFRelease
                                                                                                                                                              1 __CFBasicHashDrain
                                                                                                                                                    1 _CFRelease
                                                                                                                                                      1 __CFRunArrayDeallocate
                                                                                                                                                    1 __spin_lock
                                                                                                                                                    1 object_getClass
                                                                                                                                                  3 CFAttributedStringCreate
                                                                                                                                                    3 CFDictionaryCreateMutableCopy
                                                                                                                                                      2 CFDictionaryCreateMutableCopy
                                                                                                                                                      1 CFBasicHashCreateCopy
                                                                                                                                                        1 objc_assign_strongCast
                                                                                                                                                  2 CFStringCreateWithCharactersNoCopy
                                                                                                                                                    2 __CFStringCreateImmutableFunnel3
                                                                                                                                                      1 __CFStringCreateImmutableFunnel3
                                                                                                                                                      1 pthread_getspecific
                                                                                                                                                  1 CTLineGetGlyphRuns
                                                                                                                                                  1 gfxCoreTextShaper::SetGlyphsFromRun(gfxTextRun*, __CTRun const*, int, int, int)
                                                                                                                                                    1 TLine::GetPositionsForRun(TRun const*) const
                                                                                                                                                      1 TLine::CachePositions() const
                                                                                                                                                        1 TRun::CacheGlyphPositions(double&, double&, CGPoint*) const
                                                                                                                                          3 gfxFontGroup::InitTextRun(gfxContext*, gfxTextRun*, unsigned short const*, unsigned int)
                                                                                                                                      4 TextRunWordCache::MakeTextRun(unsigned char const*, unsigned int, gfxFontGroup*, gfxTextRunFactory::Parameters const*, unsigned int)
                                                                                                                                      3 TextRunWordCache::LookupWord(gfxTextRun*, gfxFont*, unsigned int, unsigned int, unsigned int, nsTArray<TextRunWordCache::DeferredWord, nsTArrayDefaultAllocator>*)
                                                                                                                                        3 gfxTextRun::CopyGlyphDataFrom(gfxTextRun*, unsigned int, unsigned int, unsigned int)
                                                                                                                                      2 gfxTextRun::Create(gfxTextRunFactory::Parameters const*, void const*, unsigned int, gfxFontGroup*, unsigned int)
                                                                                                                                        2 gfxTextRun::AllocateStorage(void const*&, unsigned int, unsigned int)
                                                                                                                                          1 malloc
                                                                                                                                            1 malloc_zone_malloc
                                                                                                                                              1 szone_malloc_should_clear
                                                                                                                                                1 tiny_malloc_from_free_list
                                                                                                                                          1 memcpy
                                                                                                                                      1 gfxTextRun::~gfxTextRun()
                                                                                                                                        1 free
                                                                                                                                          1 szone_size
                                                                                                                                  6 BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun*, int, int)
                                                                                                                                    5 nsLineBreaker::AppendText(nsIAtom*, unsigned char const*, unsigned int, unsigned int, nsILineBreakSink*)
                                                                                                                                      3 nsLineBreaker::FlushCurrentWord()
                                                                                                                                        3 nsJISx4051LineBreaker::GetJISx4051Breaks(unsigned short const*, unsigned int, unsigned char*)
                                                                                                                                          2 nsJISx4051LineBreaker::GetJISx4051Breaks(unsigned short const*, unsigned int, unsigned char*)
                                                                                                                                          1 GetClass(unsigned short)
                                                                                                                                      2 nsJISx4051LineBreaker::GetJISx4051Breaks(unsigned char const*, unsigned int, unsigned char*)
                                                                                                                                    1 BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun*, int, int)
                                                                                                                                  4 NS_Alloc_P
                                                                                                                                    4 malloc
                                                                                                                                      4 malloc_zone_malloc
                                                                                                                                        4 szone_malloc_should_clear
                                                                                                                                          2 szone_malloc_should_clear
                                                                                                                                          1 OSSpinLockLock
                                                                                                                                          1 tiny_malloc_from_free_list
                                                                                                                                  3 GetFontGroupForFrame(nsIFrame*, nsIFontMetrics**)
                                                                                                                                    3 nsFontCache::GetMetricsFor(nsFont const&, nsIAtom*, gfxUserFontSet*, nsIFontMetrics*&)
                                                                                                                                      2 nsThebesFontMetrics::GetLanguage(nsIAtom**)
                                                                                                                                        1 PermanentAtomImpl::AddRef()
                                                                                                                                        1 nsThebesFontMetrics::GetLanguage(nsIAtom**)
                                                                                                                                      1 nsFontCache::GetMetricsFor(nsFont const&, nsIAtom*, gfxUserFontSet*, nsIFontMetrics*&)
                                                                                                                                  1 nsTArray_base<nsTArrayDefaultAllocator>::EnsureCapacity(unsigned int, unsigned int)
                                                                                                                                    1 moz_xrealloc
                                                                                                                                      1 realloc
                                                                                                                                        1 malloc_zone_realloc
                                                                                                                                          1 szone_realloc
                                                                                                                                            1 mag_lock_zine_for_region_trailer
                                                                                                                            3 BuildTextRunsScanner::FlushLineBreaks(gfxTextRun*)
                                                                                                                              3 nsLineBreaker::Reset(int*)
                                                                                                                                3 nsLineBreaker::FlushCurrentWord()
                                                                                                                                  3 nsJISx4051LineBreaker::GetJISx4051Breaks(unsigned short const*, unsigned int, unsigned char*)
                                                                                                                                    2 nsJISx4051LineBreaker::GetJISx4051Breaks(unsigned short const*, unsigned int, unsigned char*)
                                                                                                                                    1 GetClass(unsigned short)
                                                                                                                            2 BuildTextRunsScanner::AccumulateRunInfo(nsTextFrame*)
                                                                                                                              2 nsTArray_base<nsTArrayDefaultAllocator>::EnsureCapacity(unsigned int, unsigned int)
                                                                                                                                2 moz_xrealloc
                                                                                                                                  2 realloc
                                                                                                                                    2 malloc_zone_realloc
                                                                                                                                      2 szone_realloc
                                                                                                                                        1 __memcpy
                                                                                                                                        1 szone_free
                                                                                                                            2 nsTextFrame::EnsureTextRun(gfxContext*, nsIFrame*, nsLineList_iterator const*, unsigned int*)
                                                                                                                            1 BuildTextRunsScanner::ContinueTextRunAcrossFrames(nsTextFrame*, nsTextFrame*)
                                                                                                                            1 BuildTextRunsScanner::FindBoundaries(nsIFrame*, BuildTextRunsScanner::FindBoundaryState*)
                                                                                                                            1 nsLayoutUtils::GetAsBlock(nsIFrame*)
                                                                                                                            1 nsLineBreaker::nsLineBreaker()
                                                                                                                          1 nsTextFrame::TrimTrailingWhiteSpace(nsIRenderingContext*)
                                                                                                                    2 nsLineLayout::HorizontalAlignFrames(nsRect&, int)
                                                                                                                    2 nsLineLayout::RelativePositionFrames(nsLineLayout::PerSpanData*, nsOverflowAreas&)
                                                                                                                      2 nsIFrame::FinishAndStoreOverflow(nsOverflowAreas&, nsSize)
                                                                                                                        2 ComputeOutlineAndEffectsRect(nsIFrame*, int*, nsRect const&, nsSize const&, int)
                                                                                                                    1 nsBlockFrame::PlaceLine(nsBlockReflowState&, nsLineLayout&, nsLineList_iterator, nsFloatManager::SavedState*, nsRect&, int&, int*)
                                                                                                                    1 nsLineLayout::VerticalAlignLine()
                                                                                                                      1 nsLineLayout::VerticalAlignFrames(nsLineLayout::PerSpanData*)
                                                                                                                        1 nsRuleNode::GetStyleTextReset(nsStyleContext*, int)
                                                                                                                  1 nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState&, nsLineLayout&, nsLineList_iterator, nsFlowAreaRect&, int&, nsFloatManager::SavedState*, int*, LineReflowStatus*, int)
                                                                                                                  1 nsLineLayout::BeginLineReflow(int, int, int, int, int, int)
                                                                                                                1 nsLineLayout::~nsLineLayout()
                                                                                                                  1 FreeArenaList
                                                                                                                    1 LockArena
                                                                                                                      1 PR_Lock
      4 0x134d37c98
        4 0x8000000a00000001
          3 BuildTextRunsScanner::AccumulateRunInfo(nsTextFrame*)
          1 nsTextFrame::GetNextContinuation() const
      4 0x134d5c538
        4 0x8000000a00000001
          4 BuildTextRunsScanner::AccumulateRunInfo(nsTextFrame*)
      2 0x134d37a70
        2 0x8000000a00000001
          1 BuildTextRunsScanner::BuildTextRunForFrames(void*)
          1 BuildTextRunsScanner::FlushFrames(int, int)
      1 0x40000000000005a0
        1 nsLineLayout::VerticalAlignLine()
      1 0x841f0f
        1 gfxTextRun::~gfxTextRun()
          1 0x13668a600
            1 UnhookTextRunFromFrames(gfxTextRun*, nsTextFrame*)
              1 szone_free_definite_size
      1 0x8b4c187303078b48
        1 BuildTextRunsScanner::BreakSink::SetCapitalization(unsigned int, unsigned int, unsigned char*)
          1 0x11a50cdc0
            1 0x4f00000000
              1 nsLineBreaker::FlushCurrentWord()
      1 NS_Alloc_P
        1 malloc
      1 TextRunWordCache::LookupWord(gfxTextRun*, gfxFont*, unsigned int, unsigned int, unsigned int, nsTArray<TextRunWordCache::DeferredWord, nsTArrayDefaultAllocator>*)
        1 gfxMacFont::InitTextRun(gfxContext*, gfxTextRun*, unsigned short const*, unsigned int, unsigned int, int, int)

Total number in stack (recursive counted multiple, when >=5):
        16       _pthread_start
        16       thread_start
        14       _pt_root
        13       PR_WaitCondVar
        13       __semwait_signal
        13       _pthread_cond_wait
        12       nsThread::ProcessNextEvent(int, int*)
        11       NS_ProcessNextEvent_P(nsIThread*, int)
        10       nsThread::ThreadFunc(void*)
        7       PR_Wait
        7       nsEventQueue::GetEvent(int, nsIRunnable**)
        5       _CFRelease

Sort by top of stack, same collapsed (when >= 5):
        __semwait_signal        23023
        kevent        3542
        mach_msg_trap        1771
        select$DARWIN_EXTSN        1771
        nsLineBox::IndexOf(nsIFrame*) const        1641
        nsBlockFrame::DoRemoveFrame(nsIFrame*, unsigned int)        20
        UnhookTextRunFromFrames(gfxTextRun*, nsTextFrame*)        10
        BuildTextRunsScanner::AccumulateRunInfo(nsTextFrame*)        7
        nsBlockInFlowLineIterator::nsBlockInFlowLineIterator(nsBlockFrame*, nsIFrame*, int*)        6
Sample analysis of process 245 written to file /dev/stdout
The 60px width is the one I see take a long time here (order of a minute); everything else is reasonably quick.

There seem to be two hotspots.  The first is nsLineBox::IndexOf called from nsBlockFrame::DoRemoveFrame called from nsTextFrame::SetLength.  This is code that was added in bug 597627.  But if I comment this new code out, we actually get _slower_, with all the time set in SetLength.

The second hotspot is nsLineBox::IndexOf called from nsBlockInFlowLineIterator::nsBlockInFlowLineIterator, called from EnsureTextRun, called from TrimTrailingWhiteSpace.

roc, it sounds like we're ending up with at ton of text frames all on one line for some reason.  Is that expected here?
Blocks: 597627
Status: UNCONFIRMED → NEW
Ever confirmed: true
Oh, and when I say "hotspot", one of those is 45.8% of the time in my profile and the other is 46.7%.
Keywords: regression
Attached file Data file
Attached file Testcase
OK, if I back out the entire patch from bug 597627, not just the frame destruction bit, then things are faster.
Mats, can you take a look at this?
It did eventually terminate on my Mac:

time: 1251 ms width: 0px height: 2911048
time: 811 ms width: 10px height: 2911048
time: 1688 ms width: 20px height: 2911048
time: 1652 ms width: 30px height: 2911048
time: 504562 ms width: 40px height: 1016624
time: 195099 ms width: 50px height: 777616
time: 74397 ms width: 60px height: 640038
time: 11977 ms width: 70px height: 545510
time: 13294 ms width: 80px height: 418278
time: 8989 ms width: 90px height: 375536
time: 5912 ms width: 100px height: 343042
time: 3265 ms width: 110px height: 291774
time: 2406 ms width: 120px height: 271698
time: 1957 ms width: 130px height: 253960
time: 1563 ms width: 140px height: 238616
time: 997 ms width: 150px height: 213780
time: 934 ms width: 160px height: 202272
time: 746 ms width: 170px height: 193284
time: 571 ms width: 180px height: 175980
time: 518 ms width: 190px height: 168490

so at 40px it took about 8 minutes 20 seconds.  I suspect that the exact time depends on the line breaking opportunities which depend on the font metrics for the given system.
Results from an Athlon X2 2.8GHz Ubuntu 8.04 over a remote X connection.  Jprof to follow.  Recent Trunk build., --enable-debug, --enable-jprof, --enable-optimize="-g -O3 -fno-omit-frame-pointer"

time: 4319 ms width: 0px height: 3118980
time: 3847 ms width: 10px height: 3118980
time: 4145 ms width: 20px height: 3118980
time: 94121 ms width: 30px height: 1597200
time: 9811 ms width: 40px height: 1089615
time: 29663 ms width: 50px height: 833745
time: 8120 ms width: 60px height: 585015
time: 4295 ms width: 70px height: 507420
time: 4216 ms width: 80px height: 402750
time: 7181 ms width: 90px height: 368070
time: 1998 ms width: 100px height: 313005
time: 1832 ms width: 110px height: 291480
time: 4508 ms width: 120px height: 272370
time: 1060 ms width: 130px height: 241770
time: 1390 ms width: 140px height: 229170
time: 1281 ms width: 150px height: 207240
time: 1292 ms width: 160px height: 197295
time: 1417 ms width: 170px height: 180750
time: 1622 ms width: 180px height: 173955
time: 1253 ms width: 190px height: 167130
Attached file jprof for my Ubuntu test run (obsolete) —
Major hotspot (54.7% direct hits) is consistent with bz's profile (nsLineBox::IndexOf(nsIFrame*) const).

37.4% is in BuildTextRuns(), called via TrimTrailingWhiteSpace() (hmmm) - 20% of the 37.4% ends up in IndexOf() above; the rest comes through SetLength() per bz's results.
>  --enable-debug

It's really pretty pointless to do performance measurements in debug builds... For one thing, various part of layout have different algorithmic complexity in debug and non-debug.  Maybe you'll get the same results as an opt build.  But maybe you won't.
debug was what I had and I figured it would be a high signal; my opt build is ready now and is getting similar results - uniformly faster, but no real shift in the peaks.  Output (with a more idle system than the last measurement)

time: 3901 ms width: 0px height: 3118980
time: 2990 ms width: 10px height: 3118980
time: 2704 ms width: 20px height: 3118980
time: 87352 ms width: 30px height: 1597200
time: 8564 ms width: 40px height: 1089615
time: 22544 ms width: 50px height: 833745
time: 2312 ms width: 60px height: 585030
time: 3574 ms width: 70px height: 507420
time: 2845 ms width: 80px height: 402750
time: 1645 ms width: 90px height: 368070
time: 2070 ms width: 100px height: 313005
time: 1032 ms width: 110px height: 291480
time: 1793 ms width: 120px height: 272370
time: 1030 ms width: 130px height: 241770
time: 906 ms width: 140px height: 229170
time: 961 ms width: 150px height: 207240
time: 1169 ms width: 160px height: 197280
time: 1145 ms width: 170px height: 180750
time: 767 ms width: 180px height: 173955
time: 1011 ms width: 190px height: 167145
Attached file jprof (disable-debug)
Jprof with --disable-debug (I've tweaked my objdir setup to reduce the cost in time (1hr+) of switching back and forth).

Similar results, with a higher peak (64% vs 57%) for IndexOf() - but the number of direct hits is almost the same, and the ratios for coming in via SetLength vs nsBlockInFlowLineIterator() are basically the same.  More time is being spent elsewhere in the debug version, but that didn't affect these routines noticably or the number of times these routines are called (or so it appears).
Attachment #538612 - Attachment is obsolete: true
Depends on: 682052
Summary: Infinite hang in line breaking code with large amount of text in a <pre> inside a narrow iframe → Infinite hang in line breaking code with large amount of text in a <pre> with "white-space: pre-wrap" inside a narrow iframe
FYI, the testcase (which depends on google maps API, etc) no longer works.  The issue probably is still valid
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: