New issue
Advanced search Search tips

Issue 825920 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 1
Type: Bug



Sign in to add a comment

Cronet crashing on API 16 devices

Project Member Reported by pauljensen@chromium.org, Mar 26 2018

Issue description

It is really important we get this fixed before tomorrow's Dev channel release:

java.lang.RuntimeException: java.lang.NullPointerException: expected receiver of type android.app.ActivityThread, but got null
	at org.chromium.base.ContextUtils.getProcessName(ContextUtils.java:191)
	at org.chromium.base.ContextUtils.initJavaSideApplicationContext(ContextUtils.java:139)
	at org.chromium.base.ContextUtils.initApplicationContext(ContextUtils.java:69)

Internal bug b/76403552
 
Seems caused by crrev.com/543787
The prior change to base/android/java/src/org/chromium/base/ContextUtils.java, commit hash c484b08, was in 66.0.3343.0, and I didn't seem to exhibit this crash on API 16.
So reverting seems like a possibility, though crrev.com/543787 also seems like a crasher fix.
The crux of this issue is that getProcessName() doesn't work if called from the non-UI thread on Android < JB MR2.

The "fix", which is causing the issues here, is that I added a call to getProcessName() from initApplicationContext() in order to cache the value of getProcessName() on application start.

I assumed that initApplicationContext would always be called on the UI thread, but looks like that's not the case for cronet.

Rather than revert, I'll just remove the call from initApplicationContext -> getProcessName()
How's the fix going?  Do you think this will make it into tomorrow's dev channel release?
it's in cq
Awesome, thank you!  Hopefully it makes tomorrow's Dev channel... I'm never sure when the cutoff time is.
Project Member

Comment 7 by bugdroid1@chromium.org, Mar 26 2018

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

commit 13f7d65e1ca2c68893ce7465763497a4d1d2ea5c
Author: Andrew Grieve <agrieve@chromium.org>
Date: Mon Mar 26 23:51:01 2018

Android: Do not call getProcessName() from initApplicationContext()

In cronet, initApplicationContext() is not guaranteed to be called from
the UI thread.

NOTRY=true  # time sensitive. bot timeout unrelated.

Bug:  825920 
Change-Id: I85a8a9560fee726268637ac96d87d7637407f50a
Reviewed-on: https://chromium-review.googlesource.com/980586
Commit-Queue: agrieve <agrieve@chromium.org>
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545889}
[modify] https://crrev.com/13f7d65e1ca2c68893ce7465763497a4d1d2ea5c/base/android/java/src/org/chromium/base/ContextUtils.java

Fix is in 67.0.3381.0
Status: Fixed (was: Assigned)

Sign in to add a comment