Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Issue 2626413004: Bind Android ChildProcessServices to a specific client PID. (Closed)

Created:
3 years, 11 months ago by Robert Sesek
Modified:
3 years, 11 months ago
CC:
chromium-reviews, jam, darin-cc_chromium.org, agrieve+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Bind Android ChildProcessServices to a specific client PID. A ChildProcessService may only be setup once, but nothing enforced this limit, and a second client of the service would receive no indication of failure. This situation could occur with Android WebView in multi-process mode, if two android:processes in the same package tried to use WebView. To solve this issue, introduce an initial handshake message in IChildProcessService that must be issued before setupConnection. This method binds the service to the calling PID. If that binding fails, the ChildProcessLauncher can then re-try creating a service process using the next available slot. BUG=558377, 683133 Review-Url: https://codereview.chromium.org/2626413004 Cr-Commit-Position: refs/heads/master@{#445779} Committed: https://chromium.googlesource.com/chromium/src/+/abd3ee77b9cfd7b3d8cf5f95c511e328645f8fde

Patch Set 1 : '' #

Total comments: 13

Patch Set 2 : Address comments #

Total comments: 2

Patch Set 3 : Add a test #

Total comments: 2

Patch Set 4 : typo #

Patch Set 5 : Add OWNERS file #

Total comments: 8
Unified diffs Side-by-side diffs Delta from patch set Stats (+437 lines, -28 lines) Patch
M content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java View 1 2 chunks +36 lines, -3 lines 0 comments Download
M content/public/android/java/src/org/chromium/content/browser/ChildProcessConnection.java View 2 chunks +20 lines, -1 line 0 comments Download
M content/public/android/java/src/org/chromium/content/browser/ChildProcessConnectionImpl.java View 1 4 chunks +21 lines, -1 line 4 comments Download
M content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java View 1 2 10 chunks +96 lines, -17 lines 2 comments Download
M content/public/android/java/src/org/chromium/content/common/IChildProcessService.aidl View 1 chunk +5 lines, -0 lines 0 comments Download
A content/public/android/java/src/org/chromium/content/common/OWNERS View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherTest.java View 1 2 3 chunks +147 lines, -0 lines 2 comments Download
M content/public/android/junit/src/org/chromium/content/browser/BindingManagerImplTest.java View 2 chunks +8 lines, -6 lines 0 comments Download
M content/shell/android/BUILD.gn View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M content/shell/android/shell_apk/AndroidManifest.xml.jinja2 View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
A content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestHelperService.java View 1 2 3 1 chunk +99 lines, -0 lines 0 comments Download

Messages

Total messages: 77 (53 generated)
Robert Sesek
3 years, 11 months ago (2017-01-14 22:02:46 UTC) #14
Tobias Sargeant
https://codereview.chromium.org/2626413004/diff/40001/content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java File content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java (right): https://codereview.chromium.org/2626413004/diff/40001/content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java#newcode118 content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java:118: Log.e(TAG, "Client pid %d does not match the bound ...
3 years, 11 months ago (2017-01-14 23:24:58 UTC) #17
Torne
https://codereview.chromium.org/2626413004/diff/40001/content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java File content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java (right): https://codereview.chromium.org/2626413004/diff/40001/content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java#newcode118 content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java:118: Log.e(TAG, "Client pid %d does not match the bound ...
3 years, 11 months ago (2017-01-16 12:44:43 UTC) #18
Robert Sesek
https://codereview.chromium.org/2626413004/diff/40001/content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java File content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java (right): https://codereview.chromium.org/2626413004/diff/40001/content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java#newcode118 content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java:118: Log.e(TAG, "Client pid %d does not match the bound ...
3 years, 11 months ago (2017-01-17 19:51:22 UTC) #28
Torne
LGTM
3 years, 11 months ago (2017-01-18 13:55:13 UTC) #29
Tobias Sargeant
On 2017/01/18 13:55:13, Torne wrote: > LGTM LGTM too.
3 years, 11 months ago (2017-01-19 10:42:49 UTC) #30
Robert Sesek
+mariakhomenko for OWNERS
3 years, 11 months ago (2017-01-19 16:31:22 UTC) #32
Maria
Please add tests for the new functionality. https://codereview.chromium.org/2626413004/diff/70007/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java File content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java (right): https://codereview.chromium.org/2626413004/diff/70007/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java#newcode728 content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java:728: public void ...
3 years, 11 months ago (2017-01-19 18:09:09 UTC) #33
Robert Sesek
On 2017/01/19 18:09:09, Maria wrote: > Please add tests for the new functionality. I looked ...
3 years, 11 months ago (2017-01-19 19:10:07 UTC) #34
Maria
On 2017/01/19 19:10:07, Robert Sesek wrote: > On 2017/01/19 18:09:09, Maria wrote: > > Please ...
3 years, 11 months ago (2017-01-19 21:31:54 UTC) #35
Torne
On 2017/01/19 19:10:07, Robert Sesek wrote: > On 2017/01/19 18:09:09, Maria wrote: > > Please ...
3 years, 11 months ago (2017-01-20 12:06:42 UTC) #36
Tobias Sargeant
Torne asked that this and the other concurrent CL to add service entries to webview ...
3 years, 11 months ago (2017-01-20 13:44:41 UTC) #37
Robert Sesek
PTAL, added a test.
3 years, 11 months ago (2017-01-23 22:16:04 UTC) #45
Maria
lgtm Thank you for adding the test. Very much appreciated. https://codereview.chromium.org/2626413004/diff/110001/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestHelperService.java File content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestHelperService.java (right): https://codereview.chromium.org/2626413004/diff/110001/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestHelperService.java#newcode28 ...
3 years, 11 months ago (2017-01-23 22:28:42 UTC) #46
Torne
still LGTM, thanks for the test.
3 years, 11 months ago (2017-01-24 12:39:34 UTC) #53
Robert Sesek
https://codereview.chromium.org/2626413004/diff/110001/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestHelperService.java File content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestHelperService.java (right): https://codereview.chromium.org/2626413004/diff/110001/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestHelperService.java#newcode28 content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ChildProcessLauncherTestHelperService.java:28: * starts a sandboxed service process via the ChildProcessLauncher. ...
3 years, 11 months ago (2017-01-24 16:26:51 UTC) #54
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2626413004/130001
3 years, 11 months ago (2017-01-24 16:27:03 UTC) #57
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/348729)
3 years, 11 months ago (2017-01-24 16:36:03 UTC) #59
Robert Sesek
+boliu for content OWNERS
3 years, 11 months ago (2017-01-24 16:39:03 UTC) #63
boliu
all minor things that can be fixed later, so lgtm one other potential optimization is ...
3 years, 11 months ago (2017-01-24 17:37:34 UTC) #66
Robert Sesek
On 2017/01/24 17:37:34, boliu wrote: > all minor things that can be fixed later, so ...
3 years, 11 months ago (2017-01-24 18:52:49 UTC) #69
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2626413004/150001
3 years, 11 months ago (2017-01-24 19:29:17 UTC) #73
commit-bot: I haz the power
Committed patchset #5 (id:150001) as https://chromium.googlesource.com/chromium/src/+/abd3ee77b9cfd7b3d8cf5f95c511e328645f8fde
3 years, 11 months ago (2017-01-24 19:38:50 UTC) #76
Robert Sesek
3 years, 11 months ago (2017-01-25 16:14:03 UTC) #77
Message was sent while issue was closed.
Comments addressed on this CL: https://codereview.chromium.org/2652293002/

https://codereview.chromium.org/2626413004/diff/150001/content/public/android...
File
content/public/android/java/src/org/chromium/content/browser/ChildProcessConnectionImpl.java
(right):

https://codereview.chromium.org/2626413004/diff/150001/content/public/android...
content/public/android/java/src/org/chromium/content/browser/ChildProcessConnectionImpl.java:181:
if (mStartCallback != null) {
On 2017/01/24 17:37:34, boliu wrote:
> nit: could do this check first, so it's not repeated and easier to read

Done.

https://codereview.chromium.org/2626413004/diff/150001/content/public/android...
content/public/android/java/src/org/chromium/content/browser/ChildProcessConnectionImpl.java:187:
}
On 2017/01/24 17:37:34, boliu wrote:
> can set mStartCallback to null after? the closure seem to have a lot of
state..

Done.

https://codereview.chromium.org/2626413004/diff/150001/content/public/android...
File
content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java
(right):

https://codereview.chromium.org/2626413004/diff/150001/content/public/android...
content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java:730:
AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() {
On 2017/01/24 17:37:34, boliu wrote:
> can we just use the launcher thread (through native code I guess..) AsyncTask
> thread pool is shared with the app, so can be backed up, and launching child
> process is pretty time sensitive?
> 
> or maybe not, this is only webview when app is using this from multiple
> processes, so they are doing something already

I would prefer to do this on the ProcessLauncher thread, but there's no Java
handle to it. Is it worth round-tripping through JNI to avoid this? (We're
already operating in an edge condition here).

https://codereview.chromium.org/2626413004/diff/150001/content/public/android...
File
content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherTest.java
(right):

https://codereview.chromium.org/2626413004/diff/150001/content/public/android...
content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherTest.java:406:
ChildProcessLauncher.getServiceMapForTesting();
On 2017/01/24 17:37:34, boliu wrote:
> I guess ideally, this should wait for the actual nativeOnChildProcessStarted
> call. But mocking that might be hard.

Right, we're interested in the native callback getting run, but there is no
plumbing for testing that.

Powered by Google App Engine
This is Rietveld 408576698