Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

NoSuchElementExceptionkotlin.collections.ArraysKt in first fatal List is empty #11985

Closed
liuche opened this issue Jun 26, 2020 · 5 comments
Closed
Labels
b:crash Crashes Fenix: should link to Sentry, Crash-Stats or GPlay info Feature:SearchProvider needs:triage Issue needs triage

Comments

@liuche
Copy link
Contributor

liuche commented Jun 26, 2020

Crash seen on Sentry for Fenix Nightly, has grown in the past two days with hundreds of events.

https://sentry.prod.mozaws.net/operations/fenix-nightly/issues/8870448/?query=is%3Aunresolved

May be related to changes from #9935? or similar to #11906

┆Issue is synchronized with this Jira Task

@liuche liuche added b:crash Crashes Fenix: should link to Sentry, Crash-Stats or GPlay info Feature:SearchProvider labels Jun 26, 2020
@liuche liuche added this to To do in Fenix Crashes via automation Jun 26, 2020
@liuche liuche added this to Backlog in Theme: Eng Health via automation Jun 26, 2020
@liuche liuche moved this from Backlog to Potential Release Blockers & Crashes in Theme: Eng Health Jun 26, 2020
@github-actions github-actions bot added the needs:triage Issue needs triage label Jun 26, 2020
@mcarare
Copy link
Contributor

mcarare commented Jun 26, 2020

I think this is caused by the use of engines.list.first() as a fallback value in getDefaultEngine. cc @boek

/**
 * Returns first element.
 * @throws [NoSuchElementException] if the list is empty.
 */
public fun <T> List<T>.first(): T {
    if (isEmpty())
        throw NoSuchElementException("List is empty.")
    return this[0]
}

@DmitriyFrogo
Copy link

DmitriyFrogo commented Jun 26, 2020

I think this is caused by the use of engines.list.first() as a fallback value in getDefaultEngine. cc @boek

/**
 * Returns first element.
 * @throws [NoSuchElementException] if the list is empty.
 */
public fun <T> List<T>.first(): T {
    if (isEmpty())
        throw NoSuchElementException("List is empty.")
    return this[0]
}

Steps to reproduce

  1. Add custom search, like DuckDuckGo (https://duckduckgo.com/?q=%s) (I'm on russian locale, so there's no DDG in default engines)
  2. Delete all other default search engines
  3. Restart browser and see crash

To avoid crash, leave at least one default search engine in list

@kglazko
Copy link
Contributor

kglazko commented Jun 26, 2020

I made this PR to attempt to address the crash but it certainly doesn't address the cause of the null condition mozilla-mobile/android-components#7531

@liuche liuche added this to Inbox in Fenix Sprint Kanban Jun 27, 2020
@kbrosnan kbrosnan added this to Needs triage in Android: Crash Tracking Jun 30, 2020
@kbrosnan kbrosnan moved this from Needs triage to Release blocker in Android: Crash Tracking Jun 30, 2020
@kbrosnan kbrosnan removed this from To do in Fenix Crashes Jun 30, 2020
@kbrosnan kbrosnan removed this from Potential Release Blockers & Crashes in Theme: Eng Health Jun 30, 2020
@kbrosnan kbrosnan added this to Backlog in Theme: Eng Health via automation Jun 30, 2020
@kbrosnan kbrosnan moved this from Backlog to Potential Release Blockers & Crashes in Theme: Eng Health Jun 30, 2020
@DmitriyFrogo
Copy link

Can't reproduce on Nightly 200714 06:01. Maybe fixed.

@liuche
Copy link
Contributor Author

liuche commented Jul 17, 2020

We believe it's been handled by #12544 , please reopen if you see it again after 7/17 Nightly.

@liuche liuche closed this as completed Jul 17, 2020
Fenix Sprint Kanban automation moved this from Inbox to Sprint 20.11 Done Jul 17, 2020
Android: Crash Tracking automation moved this from Possible release blockers to Closed Jul 17, 2020
@data-sync-user data-sync-user changed the title NoSuchElementExceptionkotlin.collections.ArraysKt in first fatal List is empty FNX3-15050 ⁃ NoSuchElementExceptionkotlin.collections.ArraysKt in first fatal List is empty Aug 11, 2020
Fenix Sprint Kanban automation moved this from Sprint 20.11 Done to In Progress Aug 11, 2020
Android: Crash Tracking automation moved this from Closed to Needs triage Aug 11, 2020
@data-sync-user data-sync-user changed the title FNX3-15050 ⁃ NoSuchElementExceptionkotlin.collections.ArraysKt in first fatal List is empty FNX-12993 ⁃ NoSuchElementExceptionkotlin.collections.ArraysKt in first fatal List is empty Aug 11, 2020
Fenix Sprint Kanban automation moved this from In Progress to Sprint 20.11 Done Aug 11, 2020
Android: Crash Tracking automation moved this from Needs triage to Closed Aug 11, 2020
@data-sync-user data-sync-user changed the title FNX-12993 ⁃ NoSuchElementExceptionkotlin.collections.ArraysKt in first fatal List is empty FNX2-13703 ⁃ NoSuchElementExceptionkotlin.collections.ArraysKt in first fatal List is empty Aug 11, 2020
Fenix Sprint Kanban automation moved this from Sprint 20.11 Done to In Progress Aug 11, 2020
Android: Crash Tracking automation moved this from Closed to Needs triage Aug 11, 2020
@kbrosnan kbrosnan changed the title FNX2-13703 ⁃ NoSuchElementExceptionkotlin.collections.ArraysKt in first fatal List is empty NoSuchElementExceptionkotlin.collections.ArraysKt in first fatal List is empty Aug 14, 2020
Fenix Sprint Kanban automation moved this from In Progress to Sprint 20.11 Done Aug 14, 2020
Android: Crash Tracking automation moved this from Needs triage to Closed Aug 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
b:crash Crashes Fenix: should link to Sentry, Crash-Stats or GPlay info Feature:SearchProvider needs:triage Issue needs triage
Projects
Fenix Sprint Kanban
  
Sprint 20.11 Done
Development

No branches or pull requests

6 participants