New issue
Advanced search Search tips

Issue 831570 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2018
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

DownloadManagerImpl uses a network::mojom::NetworkContext on the wrong thread/sequence

Project Member Reported by sdefresne@chromium.org, Apr 11 2018

Issue description

The test DownloadTest.DownloadDangerousBlobData when the scoped_refptr<network::SharedURLLoaderFactory> is destroyed (which happens in download::DownloadItemImpl::Start as it is unused).

This is because the method is invoked via a task posted on the UI thread. With NetworkService enabled, then DownloadManagerImpl is the sole owner of that scoped_refptr<> and if DownloadItemImpl does not use it (which happen in the test), then the network::SharedURLLoaderFactory is deallocated on the UI thread.

However, SharedURLLoaderFactory documentation says it should only be used on a single sequence:

  // A SharedURLLoaderFactory instance is supposed to be used on a single
  // sequence. To use it on a different sequence, use Clone() and pass the
  // resulting SharedURLLoaderFactoryInfo instance to the target sequence. On the
  // target sequence, call SharedURLLoaderFactory::Create() to convert the info
  // instance to a new SharedURLLoaderFactory.

So I think the DownloadManagerImpl code is incorrect as it move the object across thread. Instead it should according to the documentation use Clone to get a SharedURLLoaderFactoryInfo and recreate the factory on the other instance. Or maybe the factory should be detached from the current sequence before being passed to the DownloadManagerImpl.
 
Owner: caseq@chromium.org
Status: Fixed (was: Untriaged)
This was fixed by Andrey in https://chromium-review.googlesource.com/c/chromium/src/+/1013379.


Project Member

Comment 2 by bugdroid1@chromium.org, Apr 19 2018

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

commit 82cd07078e90accc205dc3676104648fd454e732
Author: Sylvain Defresne <sdefresne@chromium.org>
Date: Thu Apr 19 18:43:34 2018

Enable DownloadTest.DownloadDangerousBlobData test

CL https://crrev.com/c/1013379 fixed the use of SharedURLLoaderFactory
so that the object is always used on the correct thread. This fixes
the tests that was failing on a DCHECK in the destructor of an object
that should only be used on a single sequence.

Bug:  831570 
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: I3d57c7bb3f6c0694be862b93d9bb4762efccc8e6
Reviewed-on: https://chromium-review.googlesource.com/1019865
Reviewed-by: Min Qin <qinmin@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#552096}
[modify] https://crrev.com/82cd07078e90accc205dc3676104648fd454e732/testing/buildbot/filters/mojo.fyi.network_browser_tests.filter

Sign in to add a comment