Bug 136347

Summary: WebContent hangs under SharedBuffer::duplicateDataBufferIfNecessary() while browsing some websites
Product: WebKit Reporter: Pratik Solanki <psolanki>
Component: WebCore Misc.Assignee: Pratik Solanki <psolanki>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, beidson, kling, koivisto, psolanki
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch kling: review+

Description Pratik Solanki 2014-08-28 12:05:41 PDT
We've got reports of WebContent hangs when browsing some pages. The following two sites have been reported

<http://www.liverpoolway.co.uk/index.php?/forum/1-ff-football-forum/>
<https://sports.yahoo.com/blogs/mlb-big-league-stew/mo-ne-davis-has-rough-outing-in-tough-matchup-with-las-vegas-003922244.html>

The spins show us doing a lot of allocation and memcpy under SharedBuffer::createCFData()

16  WebCore::SharedBuffer::createCFData() + 50 (WebCore + 52722) [0x7fff8fd70df2] 1-16
  16  WebCore::SharedBuffer::data() const + 68 (WebCore + 53780) [0x7fff8fd71214] 1-16
    16  WebCore::SharedBuffer::buffer() const + 36 (WebCore + 53828) [0x7fff8fd71244] 1-16
      16  WebCore::SharedBuffer::duplicateDataBufferIfNecessary() const + 117 (WebCore + 13117829) [0x7fff909e6985] 1-16
        16  WTF::Vector<char, 0ul, WTF::CrashOnOverflow>::operator=(WTF::Vector<char, 0ul, WTF::CrashOnOverflow> const&) + 223 (WebCore + 13118159) [0x7fff909e6acf] 1-16
          16  _platform_memmove$VARIANT$Ivybridge + 49 (libsystem_platform.dylib + 4913) [0x7fff82e76331] 1-16
Comment 1 Pratik Solanki 2014-08-28 12:05:57 PDT
<rdar://problem/18073745>
Comment 2 Pratik Solanki 2014-08-28 12:38:41 PDT
Created attachment 237322 [details]
Patch
Comment 3 Andreas Kling 2014-08-28 13:17:26 PDT
Comment on attachment 237322 [details]
Patch

r=me
Comment 4 Andreas Kling 2014-08-28 13:18:27 PDT
Comment on attachment 237322 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=237322&action=review

> Source/WebCore/platform/SharedBuffer.cpp:359
> +    size_t newCapacity = std::max(static_cast<size_t>(m_size), currentCapacity * 2);

We could consider a less aggressive growth strategy here, e.g 1.25x instead of 2x.
Comment 5 Pratik Solanki 2014-08-28 14:08:43 PDT
Committed r173080: <http://trac.webkit.org/changeset/173080>