Bug 144971 - Networking process on iOS can be suspended and never exit
Summary: Networking process on iOS can be suspended and never exit
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Brady Eidson
URL:
Keywords: InRadar
Depends on: 145030
Blocks:
  Show dependency treegraph
 
Reported: 2015-05-13 14:23 PDT by Brady Eidson
Modified: 2015-05-18 15:10 PDT (History)
3 users (show)

See Also:


Attachments
Patch v1 (12.36 KB, patch)
2015-05-13 14:32 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff
Patch v2 (12.28 KB, patch)
2015-05-13 15:15 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff
Patch v3 (12.34 KB, patch)
2015-05-13 15:32 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff
New patch v1 (18.46 KB, patch)
2015-05-15 16:11 PDT, Brady Eidson
darin: 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 2015-05-13 14:23:44 PDT
Networking process on iOS can be suspended and never exit

This is for apps that use multiple WKProcessPools and sometimes deallocate a WKProcessPool that had an active Networking process.

In those cases, the Networking process can be suspended instead of terminated, and once suspended it can no longer respond to further messages.

Furthermore, calling RunLoop::main().stop() is not aggressive enough to actually terminate the process - _exit is bulletproof.

rdar://problem/20368630
Comment 1 Brady Eidson 2015-05-13 14:24:40 PDT
Note: The bug exists on iOS, but the fix of having the Networking process explicitly kill itself instead of implicitly noticing an IPC::Connection close is reasonable to implement cross-platform
Comment 2 Brady Eidson 2015-05-13 14:32:55 PDT
Created attachment 253060 [details]
Patch v1
Comment 3 Brady Eidson 2015-05-13 14:38:27 PDT
Apparently big changes to ProcessThrottler in the last couple of days. Updating and fixing the build.
Comment 4 Brady Eidson 2015-05-13 15:15:36 PDT
Created attachment 253063 [details]
Patch v2
Comment 5 Brady Eidson 2015-05-13 15:32:59 PDT
Created attachment 253067 [details]
Patch v3
Comment 6 Brady Eidson 2015-05-14 11:37:36 PDT
Comment on attachment 253067 [details]
Patch v3

Sam, Gavin, and I looked at this in person and came up with a plan for even more changes.  Removing r?
Comment 7 Brady Eidson 2015-05-15 16:11:05 PDT
Created attachment 253235 [details]
New patch v1
Comment 8 Darin Adler 2015-05-17 10:03:15 PDT
Comment on attachment 253235 [details]
New patch v1

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

r=me assuming you have a good way to test the new behavior

> Source/WebKit2/Shared/ChildProcess.cpp:166
> +    // FIXME: Subclasses of ChildProcess should all have a chance to do some explicit cleanup
> +    // before the process is terminated.

I think this FIXME is too vague. What kinds of cleanup specifically are you thinking about? While this comment may be correct, I’m not sure we should have a FIXME here unless we know of some specific cleanup that is not being done at this time. We don’t need a FIXME about having a hook that we wouldn’t have a reason to do at this time.

> Source/WebKit2/Shared/ChildProcess.h:100
> +    virtual void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;

Can this override be private instead of protected?
Comment 9 Brady Eidson 2015-05-18 09:26:01 PDT
(In reply to comment #8)
> Comment on attachment 253235 [details]
> New patch v1
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=253235&action=review
> 
> r=me assuming you have a good way to test the new behavior

Indeed.

> 
> > Source/WebKit2/Shared/ChildProcess.cpp:166
> > +    // FIXME: Subclasses of ChildProcess should all have a chance to do some explicit cleanup
> > +    // before the process is terminated.
> 
> I think this FIXME is too vague. What kinds of cleanup specifically are you
> thinking about? While this comment may be correct, I’m not sure we should
> have a FIXME here unless we know of some specific cleanup that is not being
> done at this time. We don’t need a FIXME about having a hook that we
> wouldn’t have a reason to do at this time.

Fair enough.

> > Source/WebKit2/Shared/ChildProcess.h:100
> > +    virtual void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;
> 
> Can this override be private instead of protected?

Nope - For now, the subclasses NetworkProcess and WebProcess call it directly from within their didReceiveMessage.

We'll be working on a way to make that unnecessary in the future, at which point it can be private.
Comment 10 Brady Eidson 2015-05-18 10:55:08 PDT
http://trac.webkit.org/changeset/184503
Comment 11 Brady Eidson 2015-05-18 15:10:23 PDT
Fixed broken API tests in followup: http://trac.webkit.org/changeset/184514