we keep sending preload requests for the same image to the main process

RESOLVED INVALID

Status

()

Core
ImageLib
RESOLVED INVALID
6 years ago
6 years ago

People

(Reporter: gal, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
STR: load cnn.com on B2G while attached to the client process and break on nsDocument::MaybePreLoadImage
(Reporter)

Comment 1

6 years ago
(gdb) c
Continuing.

Breakpoint 2, nsDocument::MaybePreLoadImage (this=0x11f74e0, uri=0x13bb050, aCrossOriginAttr=...)
    at /Users/gal/workspace/B2G/gecko/content/base/src/nsDocument.cpp:7658
7658	  if (nsContentUtils::IsImageInCache(uri) ||
3: *uri = (nsStandardURL) {<nsIFileURL> = {<nsIURL> = {<nsIURI> = {<nsISupports> = {
          _vptr.nsISupports = 0x411d4108}, <No data fields>}, <No data fields>}, <No data fields>}, <nsIStandardURL> = {<nsIMutable> = {<nsISupports> = {_vptr.nsISupports = 0x411d4230}, <No data fields>}, <No data fields>}, <nsISerializable> = {<nsISupports> = {
      _vptr.nsISupports = 0x411d4250}, <No data fields>}, <nsIIPCSerializable> = {<nsISupports> = {
      _vptr.nsISupports = 0x411d426c}, <No data fields>}, <nsIClassInfo> = {<nsISupports> = {
      _vptr.nsISupports = 0x411d4288}, <No data fields>}, <nsISizeOf> = {<nsISupports> = {_vptr.nsISupports = 0x411d42bc}, <No data fields>}, 
  mRefCnt = {mValue = 1}, mSpec = {<nsACString_internal> = {
      mData = 0x13bb108 "http://i2.cdn.turner.com/cnn/dam/assets/120723010544-syria-unrest-15-topics.jpg", mLength = 79, 
      mFlags = 5}, <No data fields>}, mDefaultPort = 80, mPort = -1, mScheme = {mPos = 0, mLen = 4}, mAuthority = {mPos = 7, mLen = 17}, mUsername = {
    mPos = 7, mLen = -1}, mPassword = {mPos = 7, mLen = -1}, mHost = {mPos = 7, mLen = 17}, mPath = {mPos = 24, mLen = 55}, mFilepath = {mPos = 24, 
    mLen = 55}, mDirectory = {mPos = 24, mLen = 16}, mBasename = {mPos = 40, mLen = 35}, mExtension = {mPos = 76, mLen = 3}, mQuery = {mPos = 24, 
    mLen = -1}, mRef = {mPos = 24, mLen = -1}, mOriginCharset = warning: can't find linker symbol for virtual table for `nsCString' value
warning:   found `EmptyCString()::sEmpty' instead
{<nsACString_internal> = {mData = 0x41336b1c "", mLength = 0, 
      mFlags = 1}, <No data fields>}, mParser = {<nsCOMPtr_base> = {mRawPtr = 0xef4768}, <No data fields>}, mFile = {<nsCOMPtr_base> = {
      mRawPtr = 0x0}, <No data fields>}, mHostA = 0x0, mHostEncoding = 1, mSpecEncoding = 0, mURLType = 2, mMutable = 1, mSupportsFileURL = 0, 
  static gIDN = 0xeda558, static gCharsetMgr = 0x0, static gInitialized = true, static gEscapeUTF8 = true, static gAlwaysEncodeInUTF8 = true, 
  static gEncodeQueryInUTF8 = <optimized out>}
(gdb) c
Continuing.

Breakpoint 2, nsDocument::MaybePreLoadImage (this=0x11f74e0, uri=0x13d5c08, aCrossOriginAttr=...)
    at /Users/gal/workspace/B2G/gecko/content/base/src/nsDocument.cpp:7658
7658	  if (nsContentUtils::IsImageInCache(uri) ||
3: *uri = (nsStandardURL) {<nsIFileURL> = {<nsIURL> = {<nsIURI> = {<nsISupports> = {
          _vptr.nsISupports = 0x411d4108}, <No data fields>}, <No data fields>}, <No data fields>}, <nsIStandardURL> = {<nsIMutable> = {<nsISupports> = {_vptr.nsISupports = 0x411d4230}, <No data fields>}, <No data fields>}, <nsISerializable> = {<nsISupports> = {
      _vptr.nsISupports = 0x411d4250}, <No data fields>}, <nsIIPCSerializable> = {<nsISupports> = {
      _vptr.nsISupports = 0x411d426c}, <No data fields>}, <nsIClassInfo> = {<nsISupports> = {
      _vptr.nsISupports = 0x411d4288}, <No data fields>}, <nsISizeOf> = {<nsISupports> = {_vptr.nsISupports = 0x411d42bc}, <No data fields>}, 
  mRefCnt = {mValue = 1}, mSpec = {<nsACString_internal> = {
      mData = 0x13d5cc0 "http://i2.cdn.turner.com/cnn/dam/assets/120722104150-syria-2-topics.jpg", mLength = 71, mFlags = 5}, <No data fields>}, 
  mDefaultPort = 80, mPort = -1, mScheme = {mPos = 0, mLen = 4}, mAuthority = {mPos = 7, mLen = 17}, mUsername = {mPos = 7, mLen = -1}, mPassword = {
    mPos = 7, mLen = -1}, mHost = {mPos = 7, mLen = 17}, mPath = {mPos = 24, mLen = 47}, mFilepath = {mPos = 24, mLen = 47}, mDirectory = {mPos = 24, 
    mLen = 16}, mBasename = {mPos = 40, mLen = 27}, mExtension = {mPos = 68, mLen = 3}, mQuery = {mPos = 24, mLen = -1}, mRef = {mPos = 24, 
    mLen = -1}, mOriginCharset = warning: can't find linker symbol for virtual table for `nsCString' value
warning:   found `EmptyCString()::sEmpty' instead
{<nsACString_internal> = {mData = 0x41336b1c "", mLength = 0, mFlags = 1}, <No data fields>}, 
  mParser = {<nsCOMPtr_base> = {mRawPtr = 0xef4768}, <No data fields>}, mFile = {<nsCOMPtr_base> = {mRawPtr = 0x0}, <No data fields>}, mHostA = 0x0, 
  mHostEncoding = 1, mSpecEncoding = 0, mURLType = 2, mMutable = 1, mSupportsFileURL = 0, static gIDN = 0xeda558, static gCharsetMgr = 0x0, 
  static gInitialized = true, static gEscapeUTF8 = true, static gAlwaysEncodeInUTF8 = true, static gEncodeQueryInUTF8 = <optimized out>}
(gdb) c
Continuing.

Breakpoint 2, nsDocument::MaybePreLoadImage (this=0x11f74e0, uri=0x1358f70, aCrossOriginAttr=...)
    at /Users/gal/workspace/B2G/gecko/content/base/src/nsDocument.cpp:7658
7658	  if (nsContentUtils::IsImageInCache(uri) ||
3: *uri = (nsStandardURL) {<nsIFileURL> = {<nsIURL> = {<nsIURI> = {<nsISupports> = {
          _vptr.nsISupports = 0x411d4108}, <No data fields>}, <No data fields>}, <No data fields>}, <nsIStandardURL> = {<nsIMutable> = {<nsISupports> = {_vptr.nsISupports = 0x411d4230}, <No data fields>}, <No data fields>}, <nsISerializable> = {<nsISupports> = {
      _vptr.nsISupports = 0x411d4250}, <No data fields>}, <nsIIPCSerializable> = {<nsISupports> = {
      _vptr.nsISupports = 0x411d426c}, <No data fields>}, <nsIClassInfo> = {<nsISupports> = {
      _vptr.nsISupports = 0x411d4288}, <No data fields>}, <nsISizeOf> = {<nsISupports> = {_vptr.nsISupports = 0x411d42bc}, <No data fields>}, 
  mRefCnt = {mValue = 1}, mSpec = {<nsACString_internal> = {
      mData = 0x1359028 "http://i2.cdn.turner.com/cnn/dam/assets/120722104101-syria-1-topics.jpg", mLength = 71, mFlags = 5}, <No data fields>}, 
  mDefaultPort = 80, mPort = -1, mScheme = {mPos = 0, mLen = 4}, mAuthority = {mPos = 7, mLen = 17}, mUsername = {mPos = 7, mLen = -1}, mPassword = {
    mPos = 7, mLen = -1}, mHost = {mPos = 7, mLen = 17}, mPath = {mPos = 24, mLen = 47}, mFilepath = {mPos = 24, mLen = 47}, mDirectory = {mPos = 24, 
    mLen = 16}, mBasename = {mPos = 40, mLen = 27}, mExtension = {mPos = 68, mLen = 3}, mQuery = {mPos = 24, mLen = -1}, mRef = {mPos = 24, 
    mLen = -1}, mOriginCharset = warning: can't find linker symbol for virtual table for `nsCString' value
warning:   found `EmptyCString()::sEmpty' instead
{<nsACString_internal> = {mData = 0x41336b1c "", mLength = 0, mFlags = 1}, <No data fields>}, 
  mParser = {<nsCOMPtr_base> = {mRawPtr = 0xef4768}, <No data fields>}, mFile = {<nsCOMPtr_base> = {mRawPtr = 0x0}, <No data fields>}, mHostA = 0x0, 
  mHostEncoding = 1, mSpecEncoding = 0, mURLType = 2, mMutable = 1, mSupportsFileURL = 0, static gIDN = 0xeda558, static gCharsetMgr = 0x0, 
  static gInitialized = true, static gEscapeUTF8 = true, static gAlwaysEncodeInUTF8 = true, static gEncodeQueryInUTF8 = <optimized out>}
(gdb) c
Continuing.

Breakpoint 2, nsDocument::MaybePreLoadImage (this=0x11f74e0, uri=0x13d52d8, aCrossOriginAttr=...)
    at /Users/gal/workspace/B2G/gecko/content/base/src/nsDocument.cpp:7658
7658	  if (nsContentUtils::IsImageInCache(uri) ||
3: *uri = (nsStandardURL) {<nsIFileURL> = {<nsIURL> = {<nsIURI> = {<nsISupports> = {
          _vptr.nsISupports = 0x411d4108}, <No data fields>}, <No data fields>}, <No data fields>}, <nsIStandardURL> = {<nsIMutable> = {<nsISupports> = {_vptr.nsISupports = 0x411d4230}, <No data fields>}, <No data fields>}, <nsISerializable> = {<nsISupports> = {
      _vptr.nsISupports = 0x411d4250}, <No data fields>}, <nsIIPCSerializable> = {<nsISupports> = {
      _vptr.nsISupports = 0x411d426c}, <No data fields>}, <nsIClassInfo> = {<nsISupports> = {
      _vptr.nsISupports = 0x411d4288}, <No data fields>}, <nsISizeOf> = {<nsISupports> = {_vptr.nsISupports = 0x411d42bc}, <No data fields>}, 
  mRefCnt = {mValue = 1}, mSpec = {<nsACString_internal> = {
      mData = 0x13d5390 "http://i2.cdn.turner.com/cnn/dam/assets/120722104317-syria-3-topics.jpg", mLength = 71, mFlags = 5}, <No data fields>}, 
  mDefaultPort = 80, mPort = -1, mScheme = {mPos = 0, mLen = 4}, mAuthority = {mPos = 7, mLen = 17}, mUsername = {mPos = 7, mLen = -1}, mPassword = {
    mPos = 7, mLen = -1}, mHost = {mPos = 7, mLen = 17}, mPath = {mPos = 24, mLen = 47}, mFilepath = {mPos = 24, mLen = 47}, mDirectory = {mPos = 24, 
    mLen = 16}, mBasename = {mPos = 40, mLen = 27}, mExtension = {mPos = 68, mLen = 3}, mQuery = {mPos = 24, mLen = -1}, mRef = {mPos = 24, 
    mLen = -1}, mOriginCharset = warning: can't find linker symbol for virtual table for `nsCString' value
warning:   found `EmptyCString()::sEmpty' instead
{<nsACString_internal> = {mData = 0x41336b1c "", mLength = 0, mFlags = 1}, <No data fields>}, 
  mParser = {<nsCOMPtr_base> = {mRawPtr = 0xef4768}, <No data fields>}, mFile = {<nsCOMPtr_base> = {mRawPtr = 0x0}, <No data fields>}, mHostA = 0x0, 
  mHostEncoding = 1, mSpecEncoding = 0, mURLType = 2, mMutable = 1, mSupportsFileURL = 0, static gIDN = 0xeda558, static gCharsetMgr = 0x0, 
  static gInitialized = true, static gEscapeUTF8 = true, static gAlwaysEncodeInUTF8 = true, static gEncodeQueryInUTF8 = <optimized out>}
(gdb) bt 50
#0  nsDocument::MaybePreLoadImage (this=0x11f74e0, uri=0x13d52d8, aCrossOriginAttr=...)
    at /Users/gal/workspace/B2G/gecko/content/base/src/nsDocument.cpp:7658
#1  0x407a3f7c in nsHtml5TreeOpExecutor::PreloadImage (this=0xee7460, aURL=<value optimized out>, aCrossOrigin=...)
    at /Users/gal/workspace/B2G/gecko/parser/html/nsHtml5TreeOpExecutor.cpp:1079
#2  0x407a6f3e in nsHtml5SpeculativeLoad::Perform (this=0x126a198, aExecutor=0xee7460)
    at /Users/gal/workspace/B2G/gecko/parser/html/nsHtml5SpeculativeLoad.cpp:31
#3  0x407a4794 in nsHtml5TreeOpExecutor::RunFlushLoop (this=0xee7460) at /Users/gal/workspace/B2G/gecko/parser/html/nsHtml5TreeOpExecutor.cpp:513
#4  0x407a658e in nsHtml5ExecutorFlusher::Run (this=<value optimized out>) at /Users/gal/workspace/B2G/gecko/parser/html/nsHtml5StreamParser.cpp:127
#5  0x40b14982 in nsThread::ProcessNextEvent (this=0xd55ad0, mayWait=<value optimized out>, result=0xbedae017)
    at /Users/gal/workspace/B2G/gecko/xpcom/threads/nsThread.cpp:624
#6  0x40af58b6 in NS_ProcessNextEvent_P (thread=0xee7460, mayWait=false) at /Users/gal/workspace/B2G/objdir-gecko/xpcom/build/nsThreadUtils.cpp:217
#7  0x40a6ce98 in mozilla::ipc::MessagePump::Run (this=0xd49f50, aDelegate=0xbedae908) at /Users/gal/workspace/B2G/gecko/ipc/glue/MessagePump.cpp:82
#8  0x40a6cf2c in mozilla::ipc::MessagePumpForChildProcess::Run (this=0x412eae30, aDelegate=0x40f64205)
    at /Users/gal/workspace/B2G/gecko/ipc/glue/MessagePump.cpp:211
#9  0x40b3404c in MessageLoop::RunInternal (this=0x40f64205) at /Users/gal/workspace/B2G/gecko/ipc/chromium/src/base/message_loop.cc:208
#10 0x40b34102 in MessageLoop::RunHandler (this=0xbedae908) at /Users/gal/workspace/B2G/gecko/ipc/chromium/src/base/message_loop.cc:201
#11 MessageLoop::Run (this=0xbedae908) at /Users/gal/workspace/B2G/gecko/ipc/chromium/src/base/message_loop.cc:175
#12 0x409ffa24 in nsBaseAppShell::Run (this=0xf27998) at /Users/gal/workspace/B2G/gecko/widget/xpwidgets/nsBaseAppShell.cpp:163
#13 0x403ce0b4 in XRE_RunAppShell () at /Users/gal/workspace/B2G/gecko/toolkit/xre/nsEmbedFunctions.cpp:642
#14 0x40a6cf26 in mozilla::ipc::MessagePumpForChildProcess::Run (this=0xd49f50, aDelegate=0xf27998)
    at /Users/gal/workspace/B2G/gecko/ipc/glue/MessagePump.cpp:197
#15 0x40b3404c in MessageLoop::RunInternal (this=0xf27998) at /Users/gal/workspace/B2G/gecko/ipc/chromium/src/base/message_loop.cc:208
#16 0x40b34102 in MessageLoop::RunHandler (this=0xbedae908) at /Users/gal/workspace/B2G/gecko/ipc/chromium/src/base/message_loop.cc:201
#17 MessageLoop::Run (this=0xbedae908) at /Users/gal/workspace/B2G/gecko/ipc/chromium/src/base/message_loop.cc:175
#18 0x403ce39c in XRE_InitChildProcess (aArgc=<value optimized out>, aArgv=<value optimized out>, aProcess=GeckoProcessType_Content)
    at /Users/gal/workspace/B2G/gecko/toolkit/xre/nsEmbedFunctions.cpp:481
#19 0x00008450 in main (argc=4, argv=0xbedaea54) at /Users/gal/workspace/B2G/gecko/ipc/app/MozillaRuntimeMain.cpp:48
(gdb)
(Reporter)

Comment 2

6 years ago
I think this is the source of the frequent writes jeff observed.
(Reporter)

Comment 3

6 years ago
And I will take that back. Those are actually separate images. cnn is loading tiles or something insane like that.
(Reporter)

Comment 4

6 years ago
Official verdict: cnn.com is insane. I wonder whether the mobile version does this.
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → INVALID
We're pretty good about pipelining async IPC, but we're not very good about coalescing or otherwise optimizing delivery of messages to listeners.  This might be a good test case for fixing that.
You need to log in before you can comment on or make changes to this bug.