Closed Bug 1647470 Opened 3 months ago Closed 3 months ago

E10S process selectors do not respect dom.ipc.keepProcessesAlive

Categories

(Core :: DOM: Content Processes, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla79
Tracking Status
firefox79 --- fixed

People

(Reporter: aklotz, Assigned: aklotz)

References

(Blocks 1 open bug)

Details

(Whiteboard: [geckoview:m79][geckoview:m80])

Attachments

(1 file, 1 obsolete file)

In GV we have dom.ipc.keepProcessesAlive.web set to 1. While this does indeed keep the process around, under e10s-multi, that retained process never gets reused until the number of live content processes reaches the maximum.

If we do something like this in GV:

geckoSession1.open(...);    // Create first content process
geckoSession1.close();    // First content process is kept around because of keepProcessesAlive
geckoSession2.open(...);    // But we're not yet at the maximum, so instead of reusing that first process, we create a second one

We end up with two content processes even though one would have sufficed, and we don't get the perf benefits of reusing an existing process.

This is particularly egregious on mobile due to Android process termination etc.

When the current number of existing content processes is less than the maximum,
MinTabSelector previously always created a new process. This is inefficient in
the case where we have dom.ipc.keepProcessesAlive.web set and there are
content processes that are idle with zero tabs -- we should allow those to be
reused.

Blocks: 1633600
Attachment #9158366 - Attachment description: Bug 1647470: Fix MinTabSelector to take into account empty but reusable content processes; r=nika → Bug 1647470: Part 1 - Fix MinTabSelector to take into account empty but reusable content processes; r=nika

While testing Part 1 I discovered that we are including dead ContentParents
in the list of candidates supplied to the process selector. It looks like the
call to ContentParent::GetUsedBrowserProcess came in after a ContentParent
actor was shut down but before the object itself was destroyed.

Depends on D80560

I was looking at the same issue as part 2 in bug 1596254, but I never got around to addressing the review comments.

Thanks Andrew, that's helpful!

Attachment #9158587 - Attachment is obsolete: true
Attachment #9158366 - Attachment description: Bug 1647470: Part 1 - Fix MinTabSelector to take into account empty but reusable content processes; r=nika → Bug 1647470: Fix MinTabSelector to take into account empty but reusable content processes; r=nika
Pushed by aklotz@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/481e9149f22f
Fix MinTabSelector to take into account empty but reusable content processes; r=nika
Blocks: 1636720
Priority: -- → P1
Whiteboard: [geckoview:m79]

Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&group_state=expanded&resultStatus=testfailed%2Cbusted%2Cexception&revision=481e9149f22f4d890ca186a35c4fc21de5e4503f&searchStr=%28bc&selectedTaskRun=czqhFJJ7SFizimexF57Osw.0

Failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=307305163&repo=autoland

Backout link: https://hg.mozilla.org/integration/autoland/rev/e09e793c027aec0d7529e0347568b4305cf961a4

[task 2020-06-23T22:54:08.490Z] 22:54:08     INFO - TEST-START | dom/l10n/tests/mochitest/document_l10n/non-system-principal/browser_resource_uri.js
[task 2020-06-23T22:54:08.490Z] 22:54:08     INFO - GECKO(476) | Chrome file doesn't exist: Z:\task_1592950662\build\tests\mochitest\browser\dom\l10n\tests\mochitest\document_l10n\non-system-principal\head.js
[task 2020-06-23T22:54:08.565Z] 22:54:08     INFO - GECKO(476) | ###!!! [Parent][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost
[task 2020-06-23T22:54:08.568Z] 22:54:08     INFO - GECKO(476) | [Child 1120: Main Thread]: I/DocShellAndDOMWindowLeak ++DOCSHELL 072C0C00 == 2 [pid = 1120] [id = {d5bbf4be-7f65-4c82-b773-45ac1a18848b}]
[task 2020-06-23T22:54:08.568Z] 22:54:08     INFO - GECKO(476) | [Child 1120: Main Thread]: I/DocShellAndDOMWindowLeak ++DOMWINDOW == 5 (013F6BD0) [pid = 1120] [serial = 5] [outer = 00000000]
[task 2020-06-23T22:54:08.571Z] 22:54:08     INFO - GECKO(476) | [Child 1120: Main Thread]: I/DocShellAndDOMWindowLeak ++DOMWINDOW == 6 (072C2C00) [pid = 1120] [serial = 6] [outer = 013F6BD0]
[task 2020-06-23T22:54:08.598Z] 22:54:08     INFO - GECKO(476) | [Parent 540, Main Thread] WARNING: NS_ENSURE_TRUE(mPresShell) failed: file /builds/worker/checkouts/gecko/layout/generic/nsFrameSelection.cpp, line 1610
[task 2020-06-23T22:54:08.601Z] 22:54:08     INFO - GECKO(476) | [Child 5764, Main Thread] WARNING: Extra shutdown CC: 'i < NORMAL_SHUTDOWN_COLLECTIONS', file /builds/worker/checkouts/gecko/xpcom/base/nsCycleCollector.cpp, line 3359
[task 2020-06-23T22:54:08.636Z] 22:54:08     INFO - GECKO(476) | [Parent 540, Gecko_IOThread] WARNING: file /builds/worker/checkouts/gecko/ipc/chromium/src/base/process_util_win.cc, line 166
[task 2020-06-23T22:54:08.671Z] 22:54:08     INFO - GECKO(476) | JavaScript error: resource://gre/modules/E10SUtils.jsm, line 594: NS_ERROR_UNEXPECTED:
[task 2020-06-23T22:54:08.671Z] 22:54:08     INFO - GECKO(476) | [Parent 540, Main Thread] WARNING: 'NS_FAILED(rv)', file /builds/worker/checkouts/gecko/netwerk/ipc/DocumentLoadListener.cpp, line 1297
[task 2020-06-23T22:54:08.678Z] 22:54:08     INFO - GECKO(476) | [Child 1120: Main Thread]: I/DocShellAndDOMWindowLeak ++DOMWINDOW == 7 (072C5C00) [pid = 1120] [serial = 7] [outer = 013F6BD0]
[task 2020-06-23T22:54:08.719Z] 22:54:08     INFO - GECKO(476) | JavaScript error: , line 0: uncaught exception: undefined
[task 2020-06-23T22:54:11.146Z] 22:54:11     INFO - GECKO(476) | [Parent 540: Main Thread]: I/DocShellAndDOMWindowLeak --DOMWINDOW == 12 (00969350) [pid = 540] [serial = 1] [outer = 00000000] [url = chrome://gfxsanity/content/sanityparent.html]
[task 2020-06-23T22:54:12.013Z] 22:54:12     INFO - GECKO(476) | [Child 1120: Main Thread]: I/DocShellAndDOMWindowLeak --DOCSHELL 013AFC00 == 1 [pid = 1120] [id = {cd15406d-e6c2-437f-b4c6-af261a072362}] [url = about:blank]
[task 2020-06-23T22:54:12.140Z] 22:54:12     INFO - GECKO(476) | [Parent 540, Main Thread] WARNING: Not resolving response because actor is dead.: file /builds/worker/workspace/obj-build/ipc/ipdl/PContentParent.cpp, line 11585
[task 2020-06-23T22:54:13.500Z] 22:54:13     INFO - GECKO(476) | [Child 4612: Main Thread]: I/DocShellAndDOMWindowLeak --DOCSHELL 014B7800 == 1 [pid = 4612] [id = {15abe76d-077e-4553-a681-73855e18a23b}] [url = chrome://gfxsanity/content/sanitytest.html]
[task 2020-06-23T22:54:15.315Z] 22:54:15     INFO - GECKO(476) | [Parent 540: Main Thread]: I/DocShellAndDOMWindowLeak --DOMWINDOW == 11 (0F424800) [pid = 540] [serial = 2] [outer = 00000000] [url = about:blank]
[task 2020-06-23T22:54:15.315Z] 22:54:15     INFO - GECKO(476) | [Parent 540: Main Thread]: I/DocShellAndDOMWindowLeak --DOMWINDOW == 10 (19AD0400) [pid = 540] [serial = 10] [outer = 00000000] [url = about:blank]
[task 2020-06-23T22:54:16.090Z] 22:54:16     INFO - GECKO(476) | [Child 1120: Main Thread]: I/DocShellAndDOMWindowLeak --DOMWINDOW == 6 (013B7800) [pid = 1120] [serial = 2] [outer = 00000000] [url = about:blank]
[task 2020-06-23T22:54:16.090Z] 22:54:16     INFO - GECKO(476) | [Child 1120: Main Thread]: I/DocShellAndDOMWindowLeak --DOMWINDOW == 5 (072C2C00) [pid = 1120] [serial = 6] [outer = 00000000] [url = about:blank]
[task 2020-06-23T22:54:16.129Z] 22:54:16     INFO - GECKO(476) | [Child 1120: Main Thread]: I/DocShellAndDOMWindowLeak --DOMWINDOW == 4 (013F6680) [pid = 1120] [serial = 1] [outer = 00000000] [url = about:blank]
[task 2020-06-23T22:54:17.604Z] 22:54:17     INFO - GECKO(476) | [Child 4612: Main Thread]: I/DocShellAndDOMWindowLeak --DOMWINDOW == 4 (014BF800) [pid = 4612] [serial = 2] [outer = 00000000] [url = about:blank]
[task 2020-06-23T22:54:17.624Z] 22:54:17     INFO - GECKO(476) | [Child 4612: Main Thread]: I/DocShellAndDOMWindowLeak --DOMWINDOW == 3 (014FC680) [pid = 4612] [serial = 1] [outer = 00000000] [url = chrome://gfxsanity/content/sanitytest.html]
[task 2020-06-23T22:54:18.124Z] 22:54:18     INFO - GECKO(476) | [Child 4152: Main Thread]: I/DocShellAndDOMWindowLeak --DOMWINDOW == 14 (06AD4000) [pid = 4152] [serial = 2] [outer = 00000000] [url = about:blank]
[task 2020-06-23T22:54:18.124Z] 22:54:18     INFO - GECKO(476) | [Child 4152: Main Thread]: I/DocShellAndDOMWindowLeak --DOMWINDOW == 13 (06ADF800) [pid = 4152] [serial = 10] [outer = 00000000] [url = about:blank]
[task 2020-06-23T22:54:18.124Z] 22:54:18     INFO - GECKO(476) | [Child 4152: Main Thread]: I/DocShellAndDOMWindowLeak --DOMWINDOW == 12 (06ADCC00) [pid = 4152] [serial = 8] [outer = 00000000] [url = about:blank]
[task 2020-06-23T22:54:18.124Z] 22:54:18     INFO - GECKO(476) | [Child 4152: Main Thread]: I/DocShellAndDOMWindowLeak --DOMWINDOW == 11 (06AD7000) [pid = 4152] [serial = 4] [outer = 00000000] [url = about:blank]
[task 2020-06-23T22:54:18.124Z] 22:54:18     INFO - GECKO(476) | [Child 4152: Main Thread]: I/DocShellAndDOMWindowLeak --DOMWINDOW == 10 (06ADA000) [pid = 4152] [serial = 6] [outer = 00000000] [url = about:blank]
[task 2020-06-23T22:54:18.184Z] 22:54:18     INFO - GECKO(476) | [Child 4152: Main Thread]: I/DocShellAndDOMWindowLeak --DOCSHELL 06AD8800 == 4 [pid = 4152] [id = {0fac73a5-06fb-4ae4-a3d4-fbabd60b00fe}] [url = moz-extension://cf5723d7-e745-4bf6-b35c-81c486e7e814/_generated_background_page.html]
[task 2020-06-23T22:54:18.184Z] 22:54:18     INFO - GECKO(476) | [Child 4152: Main Thread]: I/DocShellAndDOMWindowLeak --DOMWINDOW == 9 (00BB58A0) [pid = 4152] [serial = 5] [outer = 00000000] [url = moz-extension://cf5723d7-e745-4bf6-b35c-81c486e7e814/_generated_background_page.html]
[task 2020-06-23T22:54:18.944Z] 22:54:18     INFO - GECKO(476) | [Child 3224: Main Thread]: I/DocShellAndDOMWindowLeak --DOMWINDOW == 2 (012AFC00) [pid = 3224] [serial = 2] [outer = 00000000] [url = about:blank]
[task 2020-06-23T22:54:20.179Z] 22:54:20     INFO - GECKO(476) | [Child 1120: Main Thread]: I/DocShellAndDOMWindowLeak --DOMWINDOW == 3 (072BAC00) [pid = 1120] [serial = 3] [outer = 00000000] [url = about:blank]
[task 2020-06-23T22:54:20.179Z] 22:54:20     INFO - GECKO(476) | [Child 1120: Main Thread]: I/DocShellAndDOMWindowLeak --DOMWINDOW == 2 (072C0800) [pid = 1120] [serial = 4] [outer = 00000000] [url = about:blank]
[task 2020-06-23T22:54:21.658Z] 22:54:21     INFO - GECKO(476) | [Child 4612: Main Thread]: I/DocShellAndDOMWindowLeak --DOMWINDOW == 2 (073BFC00) [pid = 4612] [serial = 3] [outer = 00000000] [url = chrome://gfxsanity/content/sanitytest.html]
[task 2020-06-23T22:54:22.219Z] 22:54:22     INFO - GECKO(476) | [Child 4152: Main Thread]: I/DocShellAndDOMWindowLeak --DOMWINDOW == 8 (09B31800) [pid = 4152] [serial = 13] [outer = 00000000] [url = moz-extension://cf5723d7-e745-4bf6-b35c-81c486e7e814/_generated_background_page.html]
[task 2020-06-23T22:55:38.508Z] 22:55:38     INFO - TEST-INFO | started process screenshot
[task 2020-06-23T22:55:38.571Z] 22:55:38     INFO - TEST-INFO | screenshot: exit 0
[task 2020-06-23T22:55:38.571Z] 22:55:38     INFO - Buffered messages logged at 22:54:08
[task 2020-06-23T22:55:38.571Z] 22:55:38     INFO - Entering test bound 
[task 2020-06-23T22:55:38.572Z] 22:55:38     INFO - Console message: [JavaScript Error: "NS_ERROR_UNEXPECTED: " {file: "resource://gre/modules/E10SUtils.jsm" line: 594}]
[task 2020-06-23T22:55:38.572Z] 22:55:38     INFO - getRemoteTypeForPrincipal@resource://gre/modules/E10SUtils.jsm:594:26
[task 2020-06-23T22:55:38.572Z] 22:55:38     INFO - 
[task 2020-06-23T22:55:38.572Z] 22:55:38     INFO - Console message: [JavaScript Error: "uncaught exception: undefined"]
[task 2020-06-23T22:55:38.572Z] 22:55:38     INFO - Buffered messages finished
[task 2020-06-23T22:55:38.572Z] 22:55:38     INFO - TEST-UNEXPECTED-FAIL | dom/l10n/tests/mochitest/document_l10n/non-system-principal/browser_resource_uri.js | Test timed out -
Flags: needinfo?(aklotz)
Backout by csabou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/17708e1aa12c
Backed out changeset 481e9149f22f for bc failures on browser_resource_uri.js.

I don't see how this could cause that failure. Let's see how the next few pushes on autoland look.

Flags: needinfo?(aklotz)

Ranges look something like this or this.

I think this is triggering bug 1640333 from a different angle.

Whiteboard: [geckoview:m79] → [geckoview:m79][geckoview:m80]
Depends on: 1648631
Pushed by aklotz@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/035d17b431ef
Fix MinTabSelector to take into account empty but reusable content processes; r=nika
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79
Blocks: 1607878
You need to log in before you can comment on or make changes to this bug.