New issue
Advanced search Search tips

Issue 607178 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 1
Type: Bug



Sign in to add a comment

crashing when CronetEngines are created on multiple threads

Project Member Reported by pauljensen@chromium.org, Apr 27 2016

Issue description

Version: ToT, M51
OS: Android

Creating a CronetEngine on one thread calls 
CronetLibraryLoader.ensureInitialized() which posts to the main thread, but
if a CronetEngine is created immediately after this on the main thread without
first returning to the message loop, that initialization won't have happened
and the initialization of the CronetEngine being created on the main thread
could crash when it tries to get the current native MessageLoop.

Internal bug b/28367121
 
Crash stack:

base::ThreadTaskRunnerHandle::Get()
net::ProxyService::CreateSystemProxyConfigService(scoped_refptr<base::SingleThreadTaskRunner> const&, scoped_refptr<base::SingleThreadTaskRunner> const&)
cronet::CronetURLRequestContextAdapter::InitRequestContextOnMainThread(_JNIEnv*, base::android::JavaParamRef<_jobject*> const&)
Java_org_chromium_net_CronetUrlRequestContext_nativeInitRequestContextOnMainThread

Project Member

Comment 3 by bugdroid1@chromium.org, Apr 27 2016

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

commit aa99c6902d3ec652f37bc38bcc6862f83ed3deae
Author: pauljensen <pauljensen@chromium.org>
Date: Wed Apr 27 21:48:42 2016

[Cronet] Avoid crashing when CronetEngines are created on multiple threads

Creating a CronetEngine on one thread calls
CronetLibraryLoader.ensureInitialized() which posts to the main thread, but
if a CronetEngine is created immediately after this on the main thread without
first returning to the message loop, that initialization won't have happened
and the initialization of the CronetEngine being created on the main thread
could crash when it tries to get the current native MessageLoop.

BUG= 607178 

Review-Url: https://codereview.chromium.org/1926683003
Cr-Commit-Position: refs/heads/master@{#390204}

[modify] https://crrev.com/aa99c6902d3ec652f37bc38bcc6862f83ed3deae/components/cronet/android/java/src/org/chromium/net/CronetLibraryLoader.java
[modify] https://crrev.com/aa99c6902d3ec652f37bc38bcc6862f83ed3deae/components/cronet/android/java/src/org/chromium/net/CronetUrlRequestContext.java
[modify] https://crrev.com/aa99c6902d3ec652f37bc38bcc6862f83ed3deae/components/cronet/android/test/javatests/src/org/chromium/net/CronetUrlRequestContextTest.java

Status: Fixed (was: Started)
Project Member

Comment 5 by bugdroid1@chromium.org, Apr 28 2016

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

commit 53d985cf3f606aa5fb0e157654da21c4691d6fb8
Author: pasko <pasko@chromium.org>
Date: Thu Apr 28 10:47:42 2016

Revert of [Cronet] Avoid crashing when CronetEngines are created on multiple threads (patchset #2 id:20001 of https://codereview.chromium.org/1926683003/ )

Reason for revert:
CronetUrlRequestContextTest#testSkipLibraryLoading fails on public cronet bots:

 http://crbug.com/607464 

Original issue's description:
> [Cronet] Avoid crashing when CronetEngines are created on multiple threads
>
> Creating a CronetEngine on one thread calls
> CronetLibraryLoader.ensureInitialized() which posts to the main thread, but
> if a CronetEngine is created immediately after this on the main thread without
> first returning to the message loop, that initialization won't have happened
> and the initialization of the CronetEngine being created on the main thread
> could crash when it tries to get the current native MessageLoop.
>
> BUG= 607178 

TBR=mef@chromium.org,kapishnikov@chromium.org,pauljensen@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG= 607178 

Review-Url: https://codereview.chromium.org/1927863004
Cr-Commit-Position: refs/heads/master@{#390341}

[modify] https://crrev.com/53d985cf3f606aa5fb0e157654da21c4691d6fb8/components/cronet/android/java/src/org/chromium/net/CronetLibraryLoader.java
[modify] https://crrev.com/53d985cf3f606aa5fb0e157654da21c4691d6fb8/components/cronet/android/java/src/org/chromium/net/CronetUrlRequestContext.java
[modify] https://crrev.com/53d985cf3f606aa5fb0e157654da21c4691d6fb8/components/cronet/android/test/javatests/src/org/chromium/net/CronetUrlRequestContextTest.java

Comment 6 by mef@chromium.org, Apr 28 2016

Status: Assigned (was: Fixed)
Project Member

Comment 7 by bugdroid1@chromium.org, Apr 29 2016

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

commit 315ed9b17216bff1847dce29ecae62828e09ead8
Author: pauljensen <pauljensen@chromium.org>
Date: Fri Apr 29 02:19:19 2016

[Cronet] Avoid crashing when CronetEngines are created on multiple threads

Creating a CronetEngine on one thread calls
CronetLibraryLoader.ensureInitialized() which posts to the main thread, but
if a CronetEngine is created immediately after this on the main thread without
first returning to the message loop, that initialization won't have happened
and the initialization of the CronetEngine being created on the main thread
could crash when it tries to get the current native MessageLoop.

BUG= 607178 

Review-Url: https://codereview.chromium.org/1926683003
Cr-Commit-Position: refs/heads/master@{#390576}

[modify] https://crrev.com/315ed9b17216bff1847dce29ecae62828e09ead8/components/cronet/android/java/src/org/chromium/net/CronetLibraryLoader.java
[modify] https://crrev.com/315ed9b17216bff1847dce29ecae62828e09ead8/components/cronet/android/java/src/org/chromium/net/CronetUrlRequestContext.java
[modify] https://crrev.com/315ed9b17216bff1847dce29ecae62828e09ead8/components/cronet/android/test/javatests/src/org/chromium/net/CronetUrlRequestContextTest.java

Status: Fixed (was: Assigned)
Project Member

Comment 9 by bugdroid1@chromium.org, Apr 29 2016

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

commit b20cd0fe76a4e163920ecf8ab7f9fbb9ed39c9ec
Author: pauljensen <pauljensen@chromium.org>
Date: Fri Apr 29 20:18:43 2016

[Cronet] Avoid crashing when CronetEngines are created on multiple threads

Creating a CronetEngine on one thread calls
CronetLibraryLoader.ensureInitialized() which posts to the main thread, but
if a CronetEngine is created immediately after this on the main thread without
first returning to the message loop, that initialization won't have happened
and the initialization of the CronetEngine being created on the main thread
could crash when it tries to get the current native MessageLoop.

BUG= 607178 

Review-Url: https://codereview.chromium.org/1926683003
Cr-Commit-Position: refs/heads/master@{#390738}

[modify] https://crrev.com/b20cd0fe76a4e163920ecf8ab7f9fbb9ed39c9ec/components/cronet/android/java/src/org/chromium/net/CronetLibraryLoader.java
[modify] https://crrev.com/b20cd0fe76a4e163920ecf8ab7f9fbb9ed39c9ec/components/cronet/android/java/src/org/chromium/net/CronetUrlRequestContext.java
[modify] https://crrev.com/b20cd0fe76a4e163920ecf8ab7f9fbb9ed39c9ec/components/cronet/android/test/javatests/src/org/chromium/net/CronetUrlRequestContextTest.java

Sign in to add a comment