Bug 105646 - ASSERT in WebResourceLoadScheduler::scheduleLoad with a crashed NetworkProcess with release build symptoms.
Summary: ASSERT in WebResourceLoadScheduler::scheduleLoad with a crashed NetworkProces...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac All
: P2 Normal
Assignee: Brady Eidson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2012-12-21 11:29 PST by Brady Eidson
Modified: 2012-12-21 14:19 PST (History)
2 users (show)

See Also:


Attachments
Patch v1 (5.01 KB, patch)
2012-12-21 13:33 PST, Brady Eidson
ap: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brady Eidson 2012-12-21 11:29:45 PST
ASSERT in WebResourceLoadScheduler::scheduleLoad with a crashed NetworkProcess with release build symptoms.

To reproduce this find a whole bunch of imgur galleries - I used about 20.
Open them all at once and - while they're loading -  do a`killall -9 NetworkProcess`

SHOULD NEVER BE REACHED
/Volumes/SSD-Data/git/OpenSource/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp(105) : void WebKit::WebResourceLoadScheduler::scheduleLoad(WebCore::ResourceLoader *, WebCore::ResourceLoadPriority)
1   0x109e6e17b WebKit::WebResourceLoadScheduler::scheduleLoad(WebCore::ResourceLoader*, WebCore::ResourceLoadPriority)
2   0x109e6de4c WebKit::WebResourceLoadScheduler::scheduleSubresourceLoad(WebCore::Frame*, WebCore::CachedResource*, WebCore::ResourceRequest const&, WebCore::ResourceLoadPriority, WebCore::ResourceLoaderOptions const&)
3   0x10bf57989 WebCore::CachedResource::load(WebCore::CachedResourceLoader*, WebCore::ResourceLoaderOptions const&)
4   0x10bf4aed4 WebCore::CachedImage::load(WebCore::CachedResourceLoader*, WebCore::ResourceLoaderOptions const&)
...

The asserting code is:
    if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::ScheduleResourceLoad(loadParameters), Messages::NetworkConnectionToWebProcess::ScheduleResourceLoad::Reply(identifier), 0)) {
        // FIXME (NetworkProcess): What should we do if this fails?
        ASSERT_NOT_REACHED();
    }

In a release build the assert doesn't fire, but we do add a resourceloader that will never, ever finish loading.  That results in leaking resourceloaders each time the NetworkProcess crashes.

A resourceloader we can't schedule because we can't get through to the NetworkProcess here should be scheduled to fail.

In radar as <rdar://problem/12924845>
Comment 1 Brady Eidson 2012-12-21 13:33:43 PST
Created attachment 180548 [details]
Patch v1
Comment 2 Alexey Proskuryakov 2012-12-21 13:44:36 PST
Comment on attachment 180548 [details]
Patch v1

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

> Source/WebKit2/ChangeLog:10
> +        Since these loaders will never succeed in loading we should schedule them to fail on a timer.

We could also retry the load, but that's a lot of complexity for a case that should never ever happen.

> Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.h:70
> +    HashSet<RefPtr<WebCore::ResourceLoader> > m_failedResourceLoaders;

I'd appreciate a more descriptive name, this set is not used for regular failed loads (e.g. unreachable host).
Comment 3 Brady Eidson 2012-12-21 14:19:05 PST
http://trac.webkit.org/changeset/138397