Closed Bug 1154492 Opened 9 years ago Closed 3 years ago

Crash when calling newWakeLock from non-main thread

Categories

(Firefox for Android Graveyard :: General, defect)

ARM
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: dougt, Unassigned)

Details

(Keywords: crash)

Attachments

(1 file)

newWakeLock("cpu") seems to crash from a non-main thread.  Other platforms this isn't a problem.
Attached file crash.txt
There's nothing in the Android docs to indicate that a wakelock can only be taken from the main thread, so I guess we're doing JNI wrong.
Keywords: crash
OS: Mac OS X → Android
Hardware: x86 → ARM
Summary: using WakeLocks from a non-main thread crash → Crash when calling newWakeLock from non-main thread
Would you have some cycles to mentor me on this one, Richard? I'm not familiar with JNI, or how it interacts with Gecko's threading model at all...so understandable if you'd rather just handle it yourself. In the meantime, I'll remove the wake lock from the tests in bug 1150683 that caused this crash.
I'm not the right person to mentor this, but a little casual grepping:

dom/system/gonk/Volume.cpp
55:// Since WakeLocks can only be queried from the main-thread, the
56:// nsVolumeService looks for WakeLock status changes, and forwards


so maybe this isn't Android-specific, nor necessarily a real bug?
Jim or Snorp might be good people to ask about JNI usage.
Flags: needinfo?(nchen)
It may be as simple as adding "allowMultithread = true" to the line at [1], similar to the method below that. Currently, GeckoAppShell.notifyWakeLockChanged is limited to being called on the main thread, and we crash intentionally if it's called from another thread.

[1] http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/GeckoAppShell.java?rev=1e4ac5801104#2457
Flags: needinfo?(nchen)

We no longer use wakelock for cpu, close this bug.

We have completed our launch of our new Firefox on Android. The development of the new versions use GitHub for issue tracking. If the bug report still reproduces in a current version of [Firefox on Android nightly](https://play.google.com/store/apps/details?id=org.mozilla.fenix) an issue can be reported at the [Fenix GitHub project](https://github.com/mozilla-mobile/fenix/). If you want to discuss your report please use [Mozilla's chat](https://wiki.mozilla.org/Matrix#Connect_to_Matrix) server https://chat.mozilla.org and join the [#fenix](https://chat.mozilla.org/#/room/#fenix:mozilla.org) channel.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INCOMPLETE
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: