New issue
Advanced search Search tips

Issue 891904 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Oct 23
Cc:
Components:
EstimatedDays: ----
NextAction: 2018-10-26
OS: Linux , Windows , Mac
Pri: 1
Type: Bug
Proj-Servicification

Blocking:
issue 737282



Sign in to add a comment

Corb exceptions for plugins aren't persisted across network process crashes

Project Member Reported by jam@chromium.org, Oct 3

Issue description

RenderProcessHostImpl calls NetworkService::AddCorbExceptionForPlugin() when a Flash plugin is started.

If the network process crashes, this state is lost. So maybe RenderProcessHost needs to keep track of this, and then if it sees the network service crashed it can call it again?
 
Cc: dxie@chromium.org
Cc: toyoshim@chromium.org
+toyoshim@ - I wonder if BrowserContext::SetCorsOriginAccessListsForOrigin might suffer from a similar defect (AFAICT is also does not resend the CORS exceptions to the NetworkService).  If so, then we might want to have a separate bug for OOR-CORS.

I also wonder how the current code from RenderFrameHostImpl::CreateNetworkServiceDefaultFactoryAndObserve might be made more generic and reusable (for CORB/plugins and/or OOR-CORS/extension-policy). Brainstorming-mode, so the ideas below might be silly:
- Global functions:
  int content::RegisterHandlerForNetworkServiceCrash(base::RepeatingClosure)
  void content::UnregisterHandlerForNetworkServiceCrash(int registration_token)
- Legacy notifications system (e.g. content::NotificationObserver)
- Public content::NetworkService class (implements network::mojom::NetworkService + has an inner Observer class that has OnCrashedAndReloaded notification)?

WDYT?
Re SetCorsOriginAccessListsForOrigin, that's tracked in bug 891891. An API like (Un)RegisterHandlerForNetworkServiceCrash that you describe sgtm.
I have a WIP CL at https://crrev.com/c/1263555 that adds the following, generic API:

    NetworkServiceCrashHandlerId RegisterNetworkServiceCrashHandler(
        base::RepeatingClosure handler);

    void UnregisterNetworkServiceCrashHandler(
        NetworkServiceCrashHandlerId handler_id);

Let's see if the trybots like it.  Also - any suggestions wrt testing are welcomed (e.g. how can I have my test kill/crash the NetworkService process?):

- It probably would be good to explicitly test RegisterNetworkServiceCrashHandler via a browser_test that
    0) only runs if NetworkService feature is enabled
    1) calls GetNetworkService() to make sure the network service is up
    2) calls RegisterNetworkServiceCrashHandler
    3) ?somehow? kills or crashes the NetworkService process
    4) verifies that the handler callback got run

- I am not sure if the crude handler in RenderFrameHostImpl already has test coverage...
Status: Started (was: Assigned)
The WIP CL is quite red, but it did help me find NetworkServiceRestartBrowserTest test suite - I guess this is where I can try adding tests for RegisterNetworkServiceCrashHandler.
I am still struggling with the CL from #c4 - I've tried describing the races that I think I am hitting in a post here: https://groups.google.com/a/chromium.org/d/msg/network-service-dev/b8oc-TBWbNs/658QdDW5AgAJ
Cc: falken@chromium.org nasko@google.com creis@chromium.org shimazu@chromium.org
adding a few more people for help here.
Status update for https://crrev.com/c/1263555
- Product code is fixed
- Test coverage is present

Remaining work:
- Need to refactor new tests to move them to //content layer

I hope to land it some time next week?
great thanks!
Project Member

Comment 10 by bugdroid1@chromium.org, Oct 23

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ce4487b7a0d0ef150b5edea19f2db53668dd7d0f

commit ce4487b7a0d0ef150b5edea19f2db53668dd7d0f
Author: Lukasz Anforowicz <lukasza@chromium.org>
Date: Tue Oct 23 18:05:53 2018

Make CORB exceptions for plugins resilient to NetworkService crashes.

Bug:  891904 , 891891
Change-Id: I1e05b2527ff7f2e2c452525fa3a460dedc96e9f5
Reviewed-on: https://chromium-review.googlesource.com/c/1263555
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Raymes Khoury <raymes@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#602020}
[modify] https://crrev.com/ce4487b7a0d0ef150b5edea19f2db53668dd7d0f/content/browser/network_service_instance.cc
[modify] https://crrev.com/ce4487b7a0d0ef150b5edea19f2db53668dd7d0f/content/browser/network_service_restart_browsertest.cc
[modify] https://crrev.com/ce4487b7a0d0ef150b5edea19f2db53668dd7d0f/content/browser/renderer_host/render_process_host_impl.cc
[modify] https://crrev.com/ce4487b7a0d0ef150b5edea19f2db53668dd7d0f/content/public/browser/network_service_instance.h
[modify] https://crrev.com/ce4487b7a0d0ef150b5edea19f2db53668dd7d0f/content/public/test/ppapi_test_utils.cc
[modify] https://crrev.com/ce4487b7a0d0ef150b5edea19f2db53668dd7d0f/content/public/test/ppapi_test_utils.h
[modify] https://crrev.com/ce4487b7a0d0ef150b5edea19f2db53668dd7d0f/content/test/BUILD.gn
[modify] https://crrev.com/ce4487b7a0d0ef150b5edea19f2db53668dd7d0f/ppapi/BUILD.gn
[modify] https://crrev.com/ce4487b7a0d0ef150b5edea19f2db53668dd7d0f/ppapi/shared_impl/ppapi_constants.h
[add] https://crrev.com/ce4487b7a0d0ef150b5edea19f2db53668dd7d0f/ppapi/tests/corb_test_plugin.cc
[modify] https://crrev.com/ce4487b7a0d0ef150b5edea19f2db53668dd7d0f/ppapi/tests/test_url_loader.cc
[modify] https://crrev.com/ce4487b7a0d0ef150b5edea19f2db53668dd7d0f/ppapi/tests/test_url_loader.h
[modify] https://crrev.com/ce4487b7a0d0ef150b5edea19f2db53668dd7d0f/ppapi/tests/test_utils.cc
[modify] https://crrev.com/ce4487b7a0d0ef150b5edea19f2db53668dd7d0f/ppapi/tests/test_utils.h

Cc: gov...@chromium.org
Labels: Target-71
NextAction: 2018-10-26
Status: Fixed (was: Started)
+govind@ as FYI, since we tentatively plan to merge the fix above into M71 (to help ship NetworkService to stable in M71).

I plan to add appropriate merge request labels to the bug after letting the fix bake in Dev/Canary for a few days.
The NextAction date has arrived: 2018-10-26
Labels: Merge-Request-71
Requesting a merge of r602020 to M71:

- Safety of the merge:
    - The CL:
        - r602020 should in theory only affect scenarios that involve
          NetworkService (which AFAIk will attempt to ship to stable in M71
          but which still isn't enabled by default) and only scenarios that
          involve a NetworkService crash.  So, even in the unlikely event
          that something goes wrong with the fix, the fix should have
          low impact from that perspective.
        - r602020 should not affect any scenarios outside of CORB - the code
          added in the fix is only used by CORB.
        - The fix seems relatively straightforward / there are no tricky
          gotchas or something like that.  Most of the CL is test-related,
          the product changes are limited to:
          - Adding ability to register handlers for NetworkService crash
          - Registering the crash handlers for CORB/plugins
     - Bake time: the fix has been baking for ~3 releases (it landed in 72.0.3590.0)
       and there are currently no known issues caused by the fix.

- Desirability of the merge:
    - r602020 helps with the attempt to ship NetworkService to stable in M71.
      Without the fix, a crash of the NetworkService would break some Flash
      plugins that depend on cross-origin fetches (to recover a user would
      have to reload the page, possibly loosing state and/or data because
      of the reload).
    - The fix is verified via regression tests added in r602020.  In theory
      is should be possible to also perform manual tests to verify the bug
      and the fix, but this hasn't been attempted (I am pretty confident in
      the newly added automated tests / have tried them before and after the
      fix and they have the expected results).
Project Member

Comment 14 by sheriffbot@chromium.org, Oct 26

Labels: -Merge-Request-71 Hotlist-Merge-Review Merge-Review-71
This bug requires manual review: M71 has already been promoted to the beta branch, so this requires manual review
Please contact the milestone owner if you have questions.
Owners: benmason@(Android), kariahda@(iOS), kbleicher@(ChromeOS), govind@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Merge-Review-71 Merge-Approved-71
Approving merge to M71 branch 3578 based on comment #13. Please merge ASAP so we can pick it up for next week beta release. Thank you.
Project Member

Comment 16 by bugdroid1@chromium.org, Oct 26

Labels: -merge-approved-71 merge-merged-3578
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2f99066c58a0bfc6e950d877eace8d057b255954

commit 2f99066c58a0bfc6e950d877eace8d057b255954
Author: Lukasz Anforowicz <lukasza@chromium.org>
Date: Fri Oct 26 20:14:09 2018

Make CORB exceptions for plugins resilient to NetworkService crashes.

TBR=lukasza@chromium.org

(cherry picked from commit ce4487b7a0d0ef150b5edea19f2db53668dd7d0f)

Bug:  891904 , 891891
Change-Id: I1e05b2527ff7f2e2c452525fa3a460dedc96e9f5
Reviewed-on: https://chromium-review.googlesource.com/c/1263555
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Raymes Khoury <raymes@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#602020}
Reviewed-on: https://chromium-review.googlesource.com/c/1302658
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/branch-heads/3578@{#349}
Cr-Branched-From: 4226ddf99103e493d7afb23a4c7902ee496108b6-refs/heads/master@{#599034}
[modify] https://crrev.com/2f99066c58a0bfc6e950d877eace8d057b255954/content/browser/network_service_instance.cc
[modify] https://crrev.com/2f99066c58a0bfc6e950d877eace8d057b255954/content/browser/network_service_restart_browsertest.cc
[modify] https://crrev.com/2f99066c58a0bfc6e950d877eace8d057b255954/content/browser/renderer_host/render_process_host_impl.cc
[modify] https://crrev.com/2f99066c58a0bfc6e950d877eace8d057b255954/content/public/browser/network_service_instance.h
[modify] https://crrev.com/2f99066c58a0bfc6e950d877eace8d057b255954/content/public/test/ppapi_test_utils.cc
[modify] https://crrev.com/2f99066c58a0bfc6e950d877eace8d057b255954/content/public/test/ppapi_test_utils.h
[modify] https://crrev.com/2f99066c58a0bfc6e950d877eace8d057b255954/content/test/BUILD.gn
[modify] https://crrev.com/2f99066c58a0bfc6e950d877eace8d057b255954/ppapi/BUILD.gn
[modify] https://crrev.com/2f99066c58a0bfc6e950d877eace8d057b255954/ppapi/shared_impl/ppapi_constants.h
[add] https://crrev.com/2f99066c58a0bfc6e950d877eace8d057b255954/ppapi/tests/corb_test_plugin.cc
[modify] https://crrev.com/2f99066c58a0bfc6e950d877eace8d057b255954/ppapi/tests/test_url_loader.cc
[modify] https://crrev.com/2f99066c58a0bfc6e950d877eace8d057b255954/ppapi/tests/test_url_loader.h
[modify] https://crrev.com/2f99066c58a0bfc6e950d877eace8d057b255954/ppapi/tests/test_utils.cc
[modify] https://crrev.com/2f99066c58a0bfc6e950d877eace8d057b255954/ppapi/tests/test_utils.h

Labels: Merge-Merged-71-3578
The following revision refers to this bug: 
https://chromium.googlesource.com/chromium/src.git/+/2f99066c58a0bfc6e950d877eace8d057b255954

Commit: 2f99066c58a0bfc6e950d877eace8d057b255954
Author: lukasza@chromium.org
Commiter: lukasza@chromium.org
Date: 2018-10-26 20:14:09 +0000 UTC

Make CORB exceptions for plugins resilient to NetworkService crashes.

TBR=lukasza@chromium.org

(cherry picked from commit ce4487b7a0d0ef150b5edea19f2db53668dd7d0f)

Bug:  891904 , 891891
Change-Id: I1e05b2527ff7f2e2c452525fa3a460dedc96e9f5
Reviewed-on: https://chromium-review.googlesource.com/c/1263555
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Raymes Khoury <raymes@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#602020}
Reviewed-on: https://chromium-review.googlesource.com/c/1302658
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/branch-heads/3578@{#349}
Cr-Branched-From: 4226ddf99103e493d7afb23a4c7902ee496108b6-refs/heads/master@{#599034}

Sign in to add a comment