Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when searching for "henchmen" #35

Closed
caarmen opened this issue Oct 29, 2016 · 0 comments

Comments

@caarmen
Copy link
Owner

commented Oct 29, 2016

Steps to reproduce:

  • In the settings, enable "Show all rhymes"
  • Search for "henchmen" or "me".
    • The app crashes

Reason: there is a huge number (12000+) of words matching "henchmen", and we try to do a single query trying to find out which ones have definitions or not.
Solution: split this single query into smaller queries and aggregate the results.

java.lang.RuntimeException: An error occurred while executing doInBackground()
    at android.support.v4.content.ModernAsyncTask$3.done(ModernAsyncTask.java:161)
    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
    at java.util.concurrent.FutureTask.run(FutureTask.java:242)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    at java.lang.Thread.run(Thread.java:818)
Caused by: android.database.sqlite.SQLiteException: too many SQL variables (code 1): , while compiling: SELECT word FROM word_variants WHERE word in (?,?,...?,?,?,?) AND has_definition=1
    at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
    at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1093)
    at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:670)
    at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:59)
    at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
    at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
    at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1440)
    at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1287)
    at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1158)
    at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1326)
    at ca.rmen.android.poetassistant.main.dictionaries.rt.Rhymer.getWordsWithDefinitions(Rhymer.java:137)
    at ca.rmen.android.poetassistant.main.dictionaries.rt.RhymerLoader.addResultSection(RhymerLoader.java:129)
    at ca.rmen.android.poetassistant.main.dictionaries.rt.RhymerLoader.loadInBackground(RhymerLoader.java:2087)```

@caarmen caarmen added the bug label Oct 29, 2016

@caarmen caarmen self-assigned this Oct 29, 2016

caarmen added a commit that referenced this issue Oct 29, 2016

@caarmen caarmen closed this Oct 29, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.