Fenix: FNX-3399 ⁃ [Bug]Crash when opening the Bookmarks & History section on devices with Android 5 & 6

Created on 29 Apr 2020  ·  11Comments  ·  Source: mozilla-mobile/fenix

Steps to reproduce

  1. From the Home screen tap the ⋮ Main menu
  2. Tap on Bookmarks

Expected behavior

Bookmarks section is properly opened

Actual behavior

Crash

Device information

  • Android device:
    • OnePlus A3 (Android 6.0.1)
    • Samsung Galaxy A6 (Android 5.1.1)
  • Fenix version:
    • Nightly 200429 from 4/29
    • Beta 5.0.0-beta.1 from 4/29

Notes

❗The crash when trying to access the History section occurs only on Beta 5.0.0-beta.1
❗ Not reproducible on Android >= 7

► Video
20200429-100212

► Video
20200429-095844

► Log Bookmarks

 --------- beginning of crash
04-29 09:57:29.451 10802-10802/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: org.mozilla.fenix.beta, PID: 10802
    java.lang.NoSuchMethodError: No virtual method putBoolean(Ljava/lang/Object;JZ)V in class Lsun/misc/Unsafe; or its super classes (declaration of 'sun.misc.Unsafe' appears in /system/framework/core-libart.jar)
        at com.google.protobuf.UnsafeUtil$JvmMemoryAccessor.putBoolean(UnsafeUtil.java:1)
        at com.google.protobuf.UnsafeUtil.putBoolean(UnsafeUtil.java:1)
        at com.google.protobuf.MessageSchema.mergeFromHelper(MessageSchema.java:224)
        at com.google.protobuf.MessageSchema.mergeFrom(MessageSchema.java:84)
        at com.google.protobuf.GeneratedMessageLite.parsePartialFrom(GeneratedMessageLite.java:6)
        at com.google.protobuf.GeneratedMessageLite.parseFrom(GeneratedMessageLite.java:23)
        at com.google.protobuf.GeneratedMessageLite.parseFrom(GeneratedMessageLite.java:22)
        at mozilla.appservices.places.MsgTypes$BookmarkNode.parseFrom(MsgTypes.java:13)
        at mozilla.appservices.places.PlacesReaderConnection.getBookmarksTree(PlacesConnection.kt:11)
        at mozilla.components.browser.storage.sync.PlacesBookmarksStorage$getTree$2.invokeSuspend(PlacesBookmarksStorage.kt:3)
        at mozilla.components.browser.storage.sync.PlacesBookmarksStorage$getTree$2.invoke(PlacesBookmarksStorage.kt)
        at kotlin.jvm.internal.Intrinsics.startUndispatchedOrReturn(Intrinsics.java:2)
        at kotlin.jvm.internal.Intrinsics.withContext(Intrinsics.java:9)
        at mozilla.components.browser.storage.sync.PlacesBookmarksStorage.getTree(PlacesBookmarksStorage.kt:1)
        at kotlin.jvm.internal.Intrinsics.getTree$default(Intrinsics.java:1)
        at org.mozilla.fenix.library.bookmarks.BookmarkFragment$loadInitialBookmarkFolder$1$currentRoot$1.invokeSuspend(BookmarkFragment.kt:6)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:2)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:19)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:1)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:14)
04-29 09:57:29.451 10802-10802/? D/AppTracker: App Event: crash

► Log History

--------- beginning of crash
04-29 12:15:40.335 21628-21721/? E/AndroidRuntime: FATAL EXCEPTION: arch_disk_io_2
    Process: org.mozilla.fenix.beta, PID: 21628
    java.lang.NoSuchMethodError: No virtual method putBoolean(Ljava/lang/Object;JZ)V in class Lsun/misc/Unsafe; or its super classes (declaration of 'sun.misc.Unsafe' appears in /system/framework/core-libart.jar)
        at com.google.protobuf.UnsafeUtil$JvmMemoryAccessor.putBoolean(UnsafeUtil.java:1)
        at com.google.protobuf.UnsafeUtil.putBoolean(UnsafeUtil.java:1)
        at com.google.protobuf.MessageSchema.mergeFromHelper(MessageSchema.java:224)
        at com.google.protobuf.MessageSchema.mergeFrom(MessageSchema.java:84)
        at com.google.protobuf.CodedInputStreamReader.readMessage(CodedInputStreamReader.java:9)
        at com.google.protobuf.CodedInputStreamReader.readMessageList(CodedInputStreamReader.java:2)
        at com.google.protobuf.MessageSchema.readMessageList(MessageSchema.java:4)
        at com.google.protobuf.MessageSchema.mergeFromHelper(MessageSchema.java:156)
        at com.google.protobuf.MessageSchema.mergeFrom(MessageSchema.java:84)
        at com.google.protobuf.GeneratedMessageLite.parsePartialFrom(GeneratedMessageLite.java:6)
        at com.google.protobuf.GeneratedMessageLite.parseFrom(GeneratedMessageLite.java:23)
        at com.google.protobuf.GeneratedMessageLite.parseFrom(GeneratedMessageLite.java:22)
        at mozilla.appservices.places.MsgTypes$HistoryVisitInfos.parseFrom(MsgTypes.java:13)
        at mozilla.appservices.places.PlacesReaderConnection.getVisitPage(PlacesConnection.kt:8)
        at mozilla.components.browser.storage.sync.PlacesHistoryStorage$getVisitsPaginated$2.invokeSuspend(PlacesHistoryStorage.kt:7)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:2)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:19)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:1)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:14)
04-29 12:15:40.336 21628-21721/? E/AbstractTracker: Can't create handler inside thread that has not called Looper.prepare()
04-29 12:15:40.336 21628-21721/? D/AppTracker: App Event: crash
04-29 12:15:40.336 21628-21628/? D/AppTracker: App Event: stop
04-29 12:15:40.340 21628-21721/? E/AbstractTracker: mTrackerAsyncQueryHandler is null
Bookmarks History Release Blocker S1 crash engverified triage 🐞 bug

All 11 comments

Upon further investigation, the cause of this issue might be the version of the com.google.protobuf:protobuf-javalite plugin that is used in the application services, as indicated by https://github.com/protocolbuffers/protobuf/issues/6551 .

The version that is currently used is 3.9.2, and the issue that I mentioned is fixed in 3.10. However, it is mentioned that they (application services) are blocked from updating the version by another issue: https://github.com/protocolbuffers/protobuf/issues/7422, so this seems to be a recent regression from android-services.

I think it's worth mentioning that reverting the android component version changes that were made in https://github.com/mozilla-mobile/fenix/pull/10269 prevents these crashes from happening, as this issue occurs only on the most recent builds.

Upon further investigation, the cause of this issue might be the version of the com.google.protobuf:protobuf-javalite plugin that is used in the application services

CC @grigoryk, @eoger

I think it's worth mentioning that reverting the android component version changes that were made in #10269 prevents these crashes from happening, as this issue occurs only on the most recent builds.

-    const val VERSION = "39.0.20200427130108"
+    const val VERSION = "40.0.20200428130031"

I don't see any AS dependency change in this range. 🤔

Not exact range, much larger: https://github.com/mozilla-mobile/android-components/compare/02c1759aa4af150be7fc4607d00ee0c76c14be28...master

The only remotely interesting change in that range is maybe the Glean update? But then again it doesn't look like Glean uses protobuf. At least not directly as a dependency (Just in case CC @Dexterp37, @mdboom)

Ah, no, I may have been confused by the commit date (which can be much older than the date the merge happened).

The AS bump to 0.58.1 just happened two days ago:
https://github.com/mozilla-mobile/android-components/pull/6636

CC @grigoryk @eoger

The only remotely interesting change in that range is maybe the Glean update? But then again it doesn't look like Glean uses protobuf. At least not directly as a dependency (Just in case CC @Dexterp37, @mdboom)

Nope, Glean doesn't use protobuf. Moreover, the changes introduced in version 28 do not really change the dependencies compared to 27.1.0

v0.58.2 is out (bump in a-c here), switching assignee to @grigoryk who'll take it from there.

Preparing an AC 39.0.1 dot release now that includes the AS bump to 0.58.2.

The 39.0.1 release went out earlier today!

Hi, verified as fixed on the Debug Build from Master I've just created: 39.0.1, f19856fa4 GV: 77.0a1 20200427094322 AS: 0.58.2 using the following devices:
• OnePlus A3 (Android 6.0.1)
• HTC Desire 820 (Android 6.0.1)
• Samsung Galaxy A6 (Android 5.1.1)

► Video
20200430-153335

Hi, verified as fixed on Beta 76.0.0-beta.1 from 5/1 using the following devices:
• OnePlus A3 (Android 6.0.1)
• Samsung Galaxy A6 (Android 5.1.1)

Was this page helpful?
0 / 5 - 0 ratings