Closed Bug 1477041 Opened Last year Closed Last year

Crash in android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground() at android.app.ActivityThread$H.handleMessage(ActivityThread.java)

Categories

(Firefox for Android :: General, defect, critical)

Unspecified
Android
defect
Not set
critical

Tracking

()

VERIFIED FIXED
Firefox 63
Tracking Status
firefox61 --- unaffected
firefox62 --- unaffected
firefox63 blocking verified

People

(Reporter: mccr8, Assigned: vlad.baicu)

References

Details

(Keywords: crash, regression, topcrash, Whiteboard: [priority:high])

Crash Data

Attachments

(1 file)

This crash happened a few times, but there was a huge spike starting with the July 17 Nightly. This is the #1 Android Nightly crash for the July 18 Nightly, with about 15% of all crashes.

This bug was filed from the Socorro interface and is
report bp-da9045c1-61ac-43a7-9c03-ddc750180719.
=============================================================

Top 10 frames of crashing thread:

0 libxul.so GeckoAppShellSupport::ReportJavaCrash widget/android/nsAppShell.cpp:280
1 libxul.so void mozilla::jni::NativeStub<mozilla::java::GeckoAppShell::ReportJavaCrash_t, GeckoAppShellSupport, mozilla::jni::Args<mozilla::jni::Ref<mozilla::jni::TypedObject<_jthrowable*>, _jthrowable*> const&, mozilla::jni::StringParam const&> >::Wrap<&GeckoAppShellSupport::ReportJavaCrash> widget/android/jni/Natives.h:778
2 base.odex (deleted) base.odex @0xba2e3 
3 dalvik-LinearAlloc_2968_2968 (deleted) dalvik-LinearAlloc_2968_2968 @0x4f6a 
4 dalvik-main space (region space)_2968_2968 (deleted) dalvik-main space @0x5ee41e 
5 dalvik-main space (region space)_2968_2968 (deleted) dalvik-main space @0xeff54e 
6 dalvik-main space (region space)_2968_2968 (deleted) dalvik-main space @0x1007a16 
7 libart.so libart.so@0x3dd6e1 
8 dalvik-main space (region space)_2968_2968 (deleted) dalvik-main space @0xeff54e 
9 dalvik-main space (region space)_2968_2968 (deleted) dalvik-main space @0x1007a16 

=============================================================


(Bug 1469086 is an older bug with the same signature.)
"with about 15% of all crashes."

of all Android crashes, I meant.
Whiteboard: --do_not_change--[priority:high]
328 crashes/217 installs so far - this is the top crash on nightly at the moment.
Keywords: topcrash
Probably a regression from patch to fix bug 1349523.
:petru, could you investigate please ?
Blocks: 1349523
Flags: needinfo?(petru.lingurar)
Whiteboard: --do_not_change--[priority:high] → --do_not_change--[priority:high][geckoview:klar]
Assignee: nobody → vlad.baicu
Flags: needinfo?(petru.lingurar)
Attachment #8994593 - Flags: review?(sdaswani) → review?(nchen)
This patch appears to introduce other failures on Android hardware which is currently Tier 3:

https://treeherder.mozilla.org/#/jobs?repo=try&revision=aea5d4da4a9ba9dafc72d3ea41a5116812b97a69&filter-tier=1&filter-tier=2&filter-tier=3&selectedJob=189855573

 java-exception java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.ApplicationInfo android.content.Context.getApplicationInfo()' on a null object reference at android.content.ContextWrapper.getApplicationInfo(ContextWrapper.java:151)
See Also: → 1476315
The current changeset try can be found here as it wasn't ready last night: https://treeherder.mozilla.org/#/jobs?repo=try&revision=10c7249a2b6844ff3876400144de12ea958c4adb&filter-tier=1&filter-tier=2&filter-tier=3

That was a very similar changeset to the one pushed here. I've identified those issues locally and updated the patch before pushing it for review.
Comment on attachment 8994593 [details]
Bug 1477041 - Modified MediaControlService and notification flow.

https://reviewboard.mozilla.org/r/259130/#review266562

::: mobile/android/base/java/org/mozilla/gecko/media/GeckoMediaControlAgent.java:470
(Diff revision 1)
> -        final Bitmap favicon = tab.getFavicon();
> +        ByteArrayOutputStream stream = new ByteArrayOutputStream();
>  
>          // If we do not have a favicon or if it's smaller than 72 pixels then just use the default icon.
> -        if (favicon == null || favicon.getWidth() < minCoverSize || favicon.getHeight() < minCoverSize) {
> +        if (tabFavicon == null || tabFavicon.getWidth() < minCoverSize || tabFavicon.getHeight() < minCoverSize) {
>              // Use the launcher icon as fallback
> -            return BitmapFactory.decodeResource(mContext.getResources(), R.drawable.notification_media);
> +            BitmapFactory.decodeResource(mContext.getResources(), R.drawable.notification_media).compress(Bitmap.CompressFormat.PNG, 100, stream);

Why not read the resource directly as a byte array?

::: mobile/android/base/java/org/mozilla/gecko/media/MediaControlService.java:45
(Diff revision 1)
> -        if (intent != null && intent.getAction() != null) {
> -            GeckoMediaControlAgent.getInstance().handleAction(intent.getAction());
> +        if (intent.hasExtra(GeckoMediaControlAgent.EXTRA_NOTIFICATION_DATA)) {
> +            currentNotification = GeckoMediaControlAgent.getInstance().createNotification(
> +                    (MediaNotification) intent.getParcelableExtra(GeckoMediaControlAgent.EXTRA_NOTIFICATION_DATA));
> +        }
> +
> +        startForeground(R.id.mediaControlNotification, currentNotification);

We shouldn't call this if we're shutting down?

::: mobile/android/base/java/org/mozilla/gecko/media/MediaNotification.java:11
(Diff revision 1)
> +    private boolean onGoing;
> +    private int visibility;
> +    private int tabId;
> +    private String title;
> +    private String text;
> +    private byte[] bitmapBytes;

All `final`

::: mobile/android/base/java/org/mozilla/gecko/media/MediaNotification.java:57
(Diff revision 1)
> +    @Override
> +    public int describeContents() {
> +        return 0;
> +    }
> +
> +    public void writeToParcel(Parcel dest, int flags) {

`@Override`

::: mobile/android/base/java/org/mozilla/gecko/media/MediaNotification.java:70
(Diff revision 1)
> +    }
> +
> +    public static final Parcelable.Creator<MediaNotification> CREATOR = new Parcelable.Creator<MediaNotification>() {
> +        @Override
> +        public MediaNotification createFromParcel(final Parcel source) {
> +            final boolean onGoing = source.readByte() != 0;

`writeToParcel` uses `writeInt` but this uses `readByte`
Attachment #8994593 - Flags: review?(nchen) → review+
Comment on attachment 8994593 [details]
Bug 1477041 - Modified MediaControlService and notification flow.

https://reviewboard.mozilla.org/r/259130/#review266562

> Why not read the resource directly as a byte array?

From what I know we can read raw resources as inputstreams and create byte arrays based on those but not drawables, could you on detail this a bit more ?

> We shouldn't call this if we're shutting down?

Even if we're using a shutting down intent, on Oreo+ we're starting the service with a startForegroundService call and we are required to call it.
Whiteboard: --do_not_change--[priority:high][geckoview:klar] → [priority:high]
Duplicate of this bug: 1478746
Comment on attachment 8994593 [details]
Bug 1477041 - Modified MediaControlService and notification flow.

https://reviewboard.mozilla.org/r/259130/#review266562

> From what I know we can read raw resources as inputstreams and create byte arrays based on those but not drawables, could you on detail this a bit more ?

`openRawResource` should work with drawables as well [1].

[1] https://developer.android.com/reference/android/content/res/Resources.html#openRawResource(int)
Yes, it would be nice to have it return a byte[] but that means copying the drawable in raw resources and accessing it from there which seems a bit roundabout. Also converting that stream to a byte[] could also throw an IO, however unlikely which we need to take into consideration. Gonna leave it as it is for now
Keywords: checkin-needed
Pushed by csabou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/06cdeb2fd522
Modified MediaControlService and notification flow. r=jchen
Keywords: checkin-needed
Backed out for causing Android build bustages on MediaControlService.

Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&filter-resultStatus=testfailed&filter-resultStatus=busted&filter-resultStatus=exception&fromchange=06cdeb2fd5224952178ff7a804b9151a1b5f2af9&tochange=7bf9f3cd75446acbe9d03f4e893ec8f9cd674d6c&selectedJob=190591240

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

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

[task 2018-07-27T19:08:06.305Z] 19:08:06     INFO -  :app:compileOfficialWithoutGeckoBinariesNoMinApiPhotonDebugJavaWithJavac/builds/worker/workspace/build/src/mobile/android/base/java/org/mozilla/gecko/media/MediaControlService.java:32: error: cannot find symbol
[task 2018-07-27T19:08:06.305Z] 19:08:06     INFO -              currentNotification = new Notification.Builder(this, GeckoApplication.getDefaultNotificationChannel().getId()).build();
[task 2018-07-27T19:08:06.306Z] 19:08:06     INFO -                                                                                   ^
[task 2018-07-27T19:08:06.306Z] 19:08:06     INFO -    symbol:   method getDefaultNotificationChannel()
[task 2018-07-27T19:08:06.306Z] 19:08:06     INFO -    location: class GeckoApplication
[task 2018-07-27T19:08:06.306Z] 19:08:06     INFO -  Note: Some input files use or override a deprecated API.
[task 2018-07-27T19:08:06.306Z] 19:08:06     INFO -  Note: Recompile with -Xlint:deprecation for details.
[task 2018-07-27T19:08:06.306Z] 19:08:06     INFO -  1 error
[task 2018-07-27T19:08:06.306Z] 19:08:06     INFO -   FAILED
[task 2018-07-27T19:08:06.306Z] 19:08:06     INFO -  :app:mergeOfficialWithoutGeckoBinariesNoMinApiPhotonDebugAssets
[task 2018-07-27T19:08:06.306Z] 19:08:06     INFO -  :app:transformNativeLibsWithMergeJniLibsForOfficialWithoutGeckoBinariesNoMinApiPhotonDebug
[task 2018-07-27T19:08:06.307Z] 19:08:06     INFO -  :app:mergeOfficialWithoutGeckoBinariesNoMinApiPhotonDebugAndroidTestAssets
[task 2018-07-27T19:08:06.307Z] 19:08:06     INFO -  :app:transformNativeLibsWithMergeJniLibsForOfficialWithoutGeckoBinariesNoMinApiPhotonDebugAndroidTest
[task 2018-07-27T19:08:06.307Z] 19:08:06     INFO -  FAILURE: Build failed with an exception.
[task 2018-07-27T19:08:06.307Z] 19:08:06     INFO -  * What went wrong:
[task 2018-07-27T19:08:06.307Z] 19:08:06     INFO -  Execution failed for task ':app:compileOfficialWithoutGeckoBinariesNoMinApiPhotonDebugJavaWithJavac'.
[task 2018-07-27T19:08:06.307Z] 19:08:06     INFO -  > Compilation failed; see the compiler error output for details.
[task 2018-07-27T19:08:06.307Z] 19:08:06     INFO -  * Try:
[task 2018-07-27T19:08:06.307Z] 19:08:06     INFO -  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[task 2018-07-27T19:08:06.307Z] 19:08:06     INFO -  * Get more help at https://help.gradle.org
[task 2018-07-27T19:08:06.307Z] 19:08:06     INFO -  BUILD FAILED in 27s
[task 2018-07-27T19:08:06.308Z] 19:08:06     INFO -  98 actionable tasks: 98 executed
[task 2018-07-27T19:08:06.308Z] 19:08:06     INFO -  Traceback (most recent call last):
[task 2018-07-27T19:08:06.308Z] 19:08:06     INFO -    File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
[task 2018-07-27T19:08:06.308Z] 19:08:06     INFO -      "__main__", fname, loader, pkg_name)
[task 2018-07-27T19:08:06.308Z] 19:08:06     INFO -    File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
[task 2018-07-27T19:08:06.308Z] 19:08:06     INFO -      exec code in run_globals
[task 2018-07-27T19:08:06.308Z] 19:08:06     INFO -    File "/builds/worker/workspace/build/src/python/mozbuild/mozbuild/action/file_generate.py", line 110, in <module>
[task 2018-07-27T19:08:06.308Z] 19:08:06     INFO -      sys.exit(main(sys.argv[1:]))
[task 2018-07-27T19:08:06.308Z] 19:08:06     INFO -    File "/builds/worker/workspace/build/src/python/mozbuild/mozbuild/action/file_generate.py", line 70, in main
[task 2018-07-27T19:08:06.309Z] 19:08:06     INFO -      ret = module.__dict__[method](output, *args.additional_arguments, **kwargs)
[task 2018-07-27T19:08:06.309Z] 19:08:06     INFO -    File "/builds/worker/workspace/build/src/mobile/android/gradle.py", line 39, in assemble_app
[task 2018-07-27T19:08:06.309Z] 19:08:06     INFO -      return android('assemble-app')
[task 2018-07-27T19:08:06.309Z] 19:08:06     INFO -    File "/builds/worker/workspace/build/src/mobile/android/gradle.py", line 31, in android
[task 2018-07-27T19:08:06.309Z] 19:08:06     INFO -      subprocess.check_call(cmd)
[task 2018-07-27T19:08:06.309Z] 19:08:06     INFO -    File "/usr/lib/python2.7/subprocess.py", line 186, in check_call
[task 2018-07-27T19:08:06.309Z] 19:08:06     INFO -      raise CalledProcessError(retcode, cmd)
[task 2018-07-27T19:08:06.309Z] 19:08:06     INFO -  subprocess.CalledProcessError: Command '[u'/builds/worker/workspace/build/src/mach', 'android', 'assemble-app']' returned non-zero exit status 1
[task 2018-07-27T19:08:06.309Z] 19:08:06     INFO -  backend.mk:54: recipe for target '.deps/android_apks.stub' failed
[task 2018-07-27T19:08:06.310Z] 19:08:06     INFO -  make[4]: *** [.deps/android_apks.stub] Error 1
[task 2018-07-27T19:08:06.310Z] 19:08:06     INFO -  make[4]: Leaving directory '/builds/worker/workspace/build/src/obj-firefox/mobile/android/base'
[task 2018-07-27T19:08:06.310Z] 19:08:06     INFO -  /builds/worker/workspace/build/src/config/recurse.mk:101: recipe for target 'mobile/android/base/export' failed
[task 2018-07-27T19:08:06.310Z] 19:08:06     INFO -  make[3]: *** [mobile/android/base/export] Error 2
[task 2018-07-27T19:08:06.310Z] 19:08:06     INFO -  /builds/worker/workspace/build/src/config/recurse.mk:32: recipe for target 'export' failed
[task 2018-07-27T19:08:06.310Z] 19:08:06     INFO -  make[2]: *** [export] Error 2
[task 2018-07-27T19:08:06.310Z] 19:08:06     INFO -  /builds/worker/workspace/build/src/config/rules.mk:423: recipe for target 'default' failed
[task 2018-07-27T19:08:06.310Z] 19:08:06     INFO -  make[1]: *** [default] Error 2
[task 2018-07-27T19:08:06.310Z] 19:08:06     INFO -  client.mk:150: recipe for target 'build' failed
[task 2018-07-27T19:08:06.311Z] 19:08:06     INFO -  make: *** [build] Error 2
[task 2018-07-27T19:08:06.342Z] 19:08:06     INFO -  0 compiler warnings present.
[task 2018-07-27T19:08:06.370Z] 19:08:06    ERROR - Return code: 2
[task 2018-07-27T19:08:06.370Z] 19:08:06  WARNING - setting return code to 2
[task 2018-07-27T19:08:06.370Z] 19:08:06    FATAL - 'mach build -v' did not run successfully. Please check log for errors.
[task 2018-07-27T19:08:06.370Z] 19:08:06    FATAL - Running post_fatal callback...
[task 2018-07-27T19:08:06.370Z] 19:08:06    FATAL - Exiting -1
[task 2018-07-27T19:08:06.371Z] 19:08:06     INFO - [mozharness: 2018-07-27 19:08:06.370991Z] Finished build step (failed)
[task 2018-07-27T19:08:06.371Z] 19:08:06     INFO - Running post-run listener: _summarize
[task 2018-07-27T19:08:06.371Z] 19:08:06    ERROR - # TBPL FAILURE #
[task 2018-07-27T19:08:06.371Z] 19:08:06     INFO - [mozharness: 2018-07-27 19:08:06.371280Z] FxDesktopBuild summary:
[task 2018-07-27T19:08:06.371Z] 19:08:06    ERROR - # TBPL FAILURE #
Flags: needinfo?(vlad.baicu)
Fixed the patch, seems to have been a conflict with https://bugzilla.mozilla.org/show_bug.cgi?id=1476720 landing first, should be good to go now
Flags: needinfo?(vlad.baicu)
Keywords: checkin-needed
Pushed by apavel@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/21e509371ac5
Modified MediaControlService and notification flow. r=jchen
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/21e509371ac5
Status: NEW → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → Firefox 63
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.