Open Bug 1760937 Opened 3 years ago Updated 10 months ago

Crash in [@ java.lang.RuntimeException: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run] in java.lang.IllegalArgumentException: Tab with same ID already exists

Categories

(Firefox for Android :: Tabs, defect, P2)

All
Android
defect

Tracking

()

REOPENED
Tracking Status
firefox101 --- wontfix
firefox104 --- wontfix
firefox105 --- wontfix
firefox106 --- wontfix
firefox107 --- wontfix
firefox108 --- wontfix
firefox110 --- wontfix
firefox111 --- wontfix
firefox112 --- wontfix
firefox124 --- wontfix
firefox125 --- wontfix
firefox126 --- wontfix
firefox134 --- affected
firefox135 --- affected
firefox136 --- affected

People

(Reporter: kbrosnan, Unassigned, NeedInfo)

References

Details

(Keywords: crash, reproducible, Whiteboard: [fxdroid] [group4])

Crash Data

Attachments

(4 files)

Crash report: https://crash-stats.mozilla.org/report/index/d21eb134-ea61-4c1e-859a-cb4670220321

Java stack trace:

	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.reflect.InvocationTargetException
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
	... 1 more
Caused by: mozilla.components.lib.state.StoreException: Exception while reducing state
	at mozilla.components.lib.state.Store$exceptionHandler$1$1.run(Store.kt:1)
	at android.os.Handler.handleCallback(Handler.java:873)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loop(Looper.java:193)
	at android.app.ActivityThread.main(ActivityThread.java:6898)
	... 3 more
Caused by: java.lang.IllegalArgumentException: Tab with same ID already exists
	at mozilla.components.browser.state.reducer.TabListReducerKt.access$requireUniqueTab(TabListReducer.kt:4)
	at mozilla.components.browser.state.reducer.TabListReducer.reduce(TabListReducer.kt:156)
	at mozilla.components.browser.state.store.BrowserStore$1.invoke(BrowserStore.kt:356)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$chain$1.invoke(ReducerChainBuilder.kt:7)
	at mozilla.components.browser.state.engine.middleware.CrashMiddleware.invoke(CrashMiddleware.kt:3)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.browser.state.engine.middleware.WebExtensionMiddleware.invoke(WebExtensionMiddleware.kt:15)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.browser.state.engine.middleware.SuspendMiddleware.invoke(SuspendMiddleware.kt:9)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.browser.state.engine.middleware.TabsRemovedMiddleware.invoke(TabsRemovedMiddleware.kt:24)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.browser.state.engine.middleware.LinkingMiddleware.invoke(LinkingMiddleware.kt:21)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.browser.state.engine.middleware.CreateEngineSessionMiddleware.invoke(CreateEngineSessionMiddleware.kt:18)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.browser.state.engine.middleware.EngineDelegateMiddleware.invoke(EngineDelegateMiddleware.kt:23)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at org.mozilla.fenix.tabstray.SearchTermTabGroupMiddleware.invoke(SearchTermTabGroupMiddleware.kt:3)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at org.mozilla.fenix.historymetadata.HistoryMetadataMiddleware.invoke(HistoryMetadataMiddleware.kt:50)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.feature.media.middleware.LastMediaAccessMiddleware.invoke(LastMediaAccessMiddleware.kt:3)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.feature.search.middleware.AdsTelemetryMiddleware.invoke(AdsTelemetryMiddleware.kt:51)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.feature.prompts.PromptMiddleware.invoke(PromptMiddleware.kt:18)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.feature.media.middleware.RecordingDevicesMiddleware.invoke(RecordingDevicesMiddleware.kt:3)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.feature.search.middleware.SearchMiddleware.invoke(SearchMiddleware.kt:12)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.feature.search.region.RegionMiddleware.invoke(RegionMiddleware.kt:7)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.feature.session.middleware.undo.UndoMiddleware.invoke(UndoMiddleware.kt:36)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.browser.thumbnails.ThumbnailsMiddleware.invoke(ThumbnailsMiddleware.kt:46)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at org.mozilla.fenix.telemetry.TelemetryMiddleware.invoke(TelemetryMiddleware.kt:29)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.feature.readerview.ReaderViewMiddleware.invoke(ReaderViewMiddleware.kt:43)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.feature.downloads.DownloadMiddleware.invoke(DownloadMiddleware.kt:66)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.feature.recentlyclosed.RecentlyClosedMiddleware.invoke(RecentlyClosedMiddleware.kt:47)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.feature.session.middleware.LastAccessMiddleware.invoke(LastAccessMiddleware.kt:8)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$threadCheck$1.invoke(ReducerChainBuilder.kt:10)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.lib.state.Store$dispatch$1.invokeSuspend(Store.kt:4)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:3)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:18)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:764)

I've encountered this crash on the Focus Nightly 101.0a1 (build 361030509 with GV 101.0a1-20220412094307) with Samsung Galaxy note 8 (Android 9), and found the STR:

  1. Have fingerprint set and enabled on your device.
  2. On Focus, go to Settings - Privacy & Security - Switching Apps, and enable the use of fingerprint.
  3. On Focus open a page.
  4. Put Focus in background, without closing it.
  5. From the device's settings, delete the fingerprint set on step 1.
  6. Open Focus -> crash.

b2c27e0c-9158-4f11-b97f-9b3755aad3a8
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException


java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:504)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
... 1 more
Caused by: java.security.InvalidAlgorithmParameterException: java.lang.IllegalStateException: At least one fingerprint/iris/intelligentScan must be enrolled to create keys requiring user authentication for every use
at android.security.keystore.AndroidKeyStoreKeyGeneratorSpi.engineInit(AndroidKeyStoreKeyGeneratorSpi.java:280)
at android.security.keystore.AndroidKeyStoreKeyGeneratorSpi$AES.engineInit(AndroidKeyStoreKeyGeneratorSpi.java:59)
at javax.crypto.KeyGenerator.init(KeyGenerator.java:519)
at javax.crypto.KeyGenerator.init(KeyGenerator.java:502)
at org.mozilla.focus.biometrics.BiometricAuthenticationHandler.<init>(BiometricAuthenticationHandler.kt:15)
at org.mozilla.focus.biometrics.BiometricAuthenticationDialogFragment.onResume(BiometricAuthenticationDialogFragment.kt:4)
at androidx.fragment.app.FragmentStateManager.resume(FragmentStateManager.java:21)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:7)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:68)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:10)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:14)
at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:1)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7073)
... 3 more
Caused by: java.lang.IllegalStateException: At least one fingerprint/iris/intelligentScan must be enrolled to create keys requiring user authentication for every use
at android.security.keystore.KeymasterUtils.addUserAuthArgs(KeymasterUtils.java:324)
at android.security.keystore.AndroidKeyStoreKeyGeneratorSpi.engineInit(AndroidKeyStoreKeyGeneratorSpi.java:278)
... 18 more

The crash spike on Nightly is gone.

The bug is marked as tracked for firefox106 (nightly). We have limited time to fix this, the soft freeze is in 8 days. However, the bug still isn't assigned.

:cpeterson, could you please find an assignee for this tracked bug? If you disagree with the tracking decision, please talk with the release managers.

For more information, please visit auto_nag documentation.

Flags: needinfo?(cpeterson)

This is a pretty generic crash signature. The exception reason I see in Nightly 106 (UnsupportedOperationException: This isn't a hierarchical URI) is different from that in comment 0 (IllegalArgumentException: Tab with same ID already exists).

...
Caused by: java.lang.UnsupportedOperationException: This isn't a hierarchical URI.
	at android.net.Uri.getQueryParameterNames(Uri.java:1616)
	at org.mozilla.fenix.ext.UriKt.containsQueryParameters(Uri.kt:4)
	at org.mozilla.fenix.home.blocklist.BlocklistHandler.filterContileRecentTab(BlocklistHandler.kt:8)
	at org.mozilla.fenix.home.blocklist.BlocklistMiddleware.invoke(BlocklistMiddleware.kt:20)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$threadCheck$1.invoke(ReducerChainBuilder.kt:10)
	at mozilla.components.lib.state.internal.ReducerChainBuilder$build$1$1.invoke(ReducerChainBuilder.kt:3)
	at mozilla.components.lib.state.Store$dispatch$1.invokeSuspend(Store.kt:4)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:4)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:18)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:920)
Crash Signature: [@ java.lang.RuntimeException: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java)] → [@ java.lang.RuntimeException: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java)] [@ java.lang.RuntimeException: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(Unknown Source:35)] [@ java.lang.RuntimeExcept…
Flags: needinfo?(cpeterson)
Priority: -- → P1

The most recent crashing build ID is 20220901095452, so this crash does seem to have been fixed in Nightly last week. Noah says this crash was fixed by https://github.com/mozilla-mobile/fenix/issues/26759.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED

We may have fixed the spike on Nightly, but this bug pre-dates that specific issue. We probably should have opened a new bug to track that specific regression.

Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Priority: P1 → P2
Component: Stability → General
Priority: P2 → P3
Crash Signature: [@ java.lang.RuntimeException: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java)] [@ java.lang.RuntimeException: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(Unknown Source:35)] [@ java.lang.RuntimeExcept… → [@ java.lang.RuntimeException: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run] [@ java.lang.RuntimeException: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run] [@ java.lang.RuntimeException: at com.android.internal.os.Runti…
Summary: Crash in [@ java.lang.RuntimeException: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java)] in java.lang.IllegalArgumentException: Tab with same ID already exists → Crash in [@ java.lang.RuntimeException: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run] in java.lang.IllegalArgumentException: Tab with same ID already exists
Crash Signature: [@ java.lang.RuntimeException: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run] [@ java.lang.RuntimeException: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run] [@ java.lang.RuntimeException: at com.android.internal.os.Runti… → [@ java.lang.RuntimeException: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java)] [@ java.lang.RuntimeException: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(Unknown Source:35)] [@ java.lang.RuntimeExcept…
See Also: → 1720840

I recently encountered this error.

Flags: needinfo?(cpeterson)

I saw this error in the category: History, under: Recently closed tabs. I clicked on a link in recently closed files and can reproduce the error over and over, in all versions.

(In reply to eclaudiu64 from comment #8)

I saw this error in the category: History, under: Recently closed tabs. I clicked on a link in recently closed files and can reproduce the error over and over, in all versions.

Thanks for the steps to reproduce and video!

Do you have a crash report ID listed in your Firefox's about:crashes?

Severity: S2 → --
Component: General → Tabs
Flags: needinfo?(cpeterson)
Keywords: reproducible
Priority: P3 → --

Thanks! This crash bug is old, but it's still in our top #30 crashes. We've never been able to reproduce it before.

Flags: needinfo?(cpeterson)

(In reply to Chris Peterson [:cpeterson] from comment #12)

Thanks! This crash bug is old, but it's still in our top #30 crashes. We've never been able to reproduce it before.

Much more attention should be paid to this error, as far as I can see it affects a user a lot. After reproducing the error, from the category: History, that error can be repeated again, if it remains the same site, in the same place in the list and we press it again.

Severity: -- → S2
Priority: -- → P2
Whiteboard: [fxdroid] [group4]

The bug is linked to a topcrash signature, which matches the following criteria:

  • Top 10 AArch64 and ARM crashes on beta
  • Top 10 AArch64 and ARM crashes on release

For more information, please visit BugBot documentation.

Keywords: topcrash

This error remains every time stuck on the same link, when I access: History and after Last tabs closed and you can see how bad it is. Can it be solved?

Flags: needinfo?(cpeterson)

In the recording, Firefox seems to be surprised that opening a page from History matches an existing open tab, but I'm not able to reproduce the History crash on my device.

This crash signature is generic signature with many causes, but here's an example of a crash report for this same IllegalArgumentException: Tab with same ID already exists error:

https://crash-stats.mozilla.org/report/index/a3208deb-0efa-453f-944a-c97570240401

From this code:

https://searchfox.org/mozilla-central/rev/10f46c9c638e0e5935ed9fa12aadc9d0d4e71ade/mobile/android/android-components/components/browser/state/src/main/java/mozilla/components/browser/state/reducer/TabListReducer.kt#332

If this code requires a unique tab, can we create a new tab if the Tab ID already exists, instead of crashing the app?

/**
 * Checks that the provided tab doesn't already exist and throws an
 * [IllegalArgumentException] otherwise.
 *
 * @param state the current [BrowserState] (including all existing tabs).
 * @param tab the [TabSessionState] to check.
 */
private fun requireUniqueTab(state: BrowserState, tab: TabSessionState) {
    require(state.tabs.find { it.id == tab.id } == null) {
        "Tab with same ID already exists"
    }
}
Flags: needinfo?(cpeterson)

Tried opening tabs from the Recently Closed Tabs (from both the 3 dot menu and the tabs tray) and didn't see the Tab with same ID already exists exception or any crashes. Once the tab has been opened, it's also removed from the Recently Closed list, so I don't occur the issue with the same link over and over.

Would QE be able to produce some STR?

Flags: qe-verify+

Unfortunately, I was not able to trigger a crash by following Claudiu's steps. I was not able to trigger it with the fingerprint scenario either.
Tested on Samsung Galaxy Note 8 (Android 9), Google Pixel 6 (Android 14), Samsung Galaxy A14 (Android 13), and Oppo Find N2 Flip (Android 14), on Firefox for Android 125.3.0, Nightly 127.0a1 from 5/10.

Flags: qe-verify+

I spent a couple hours today looking into this. I haven't been able to reproduce it, but I do have some hypotheses:

  • Race condition between closing a tab and restoring it
    • The tab has not been removed from browser state by the time restoration happens
  • Statistical anomaly
    • UUIDs are somehow being repeated
      • 128bits, so this seems insanely unlikely
  • 2+ TabListReducer.RestoreActions are being dispatched
  • A closed tab is somehow getting the data of an open tab
  • A closed tab is still living within browser state when it is being restored.

I would suggest for some next steps to be either adding some more breadcrumbs to the browser store actions and recently closed flow OR provide an APK here with an over abundance of logging inside of:

  • TabListReducer.RestoreAction
  • TabListReducer.requireUniqueTab (make sure that the tabs are actually the same and it isn't just the tab ID)
  • Tab restore and remove use cases
  • Tab ID creation (UUID generation)
  • Browser store (log the actions as they flow through the reducer)
  • Reducer state updates to BrowserState.tabs and BrowserState.closedTabs

We will provide an APK with additional logging.

Flags: needinfo?(emanuellclaudiu)

Based on the topcrash criteria, the crash signatures linked to this bug are not in the topcrash signatures anymore.

For more information, please visit BugBot documentation.

Keywords: topcrash
Attached file App Bundle with logs

I've created and attached an app bundle with a bunch of logging to help with the debugging of this crash. If anyone who has faced this issue could please download and install it and share the logs in the ticket when the crash happens next, it'd greatly assist us with trying to diagnose the issue.

See Also: → 1795157
See Also: → 1907615

Dear Ladies and Gentlepeople,

I think i might be affected by the bug described here:

See, among other crash-reports:
https://crash-stats.mozilla.org/report/index/ff2b712b-4ec7-4daa-83e9-9aef80240714#tab-details

Am able to reliably crash Firefox-Beta using my FP4.
If someone knowledgable can confirm my issue is related to the Bug described here, Then I'm happy to help with debugging (providing info/data).

Hey Ruben89, your crash may be more related to this HistoryMetadataMiddleware.createHistoryMetadata crash.

See Also: 1907615

This crash spiked in Nightly 135 starting 2024-12-16. I suspect the automatic crash reporting setting (bug 1812770) that landed on 2024-12-14 is causing a lot of reports to be submitted that might have been backlogged or not caught before. For example, the 23694 (!!!) crash reports received this week were from just 80 installs.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: