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

SQLiteException in iOS app #2447

Closed
Kamil-H opened this issue Jun 24, 2021 · 2 comments
Closed

SQLiteException in iOS app #2447

Kamil-H opened this issue Jun 24, 2021 · 2 comments

Comments

@Kamil-H
Copy link

Kamil-H commented Jun 24, 2021

We've got a library that internally is using SQLDelight. One of our client is facing crashes on various versions of the iOS. Unfortunately he didn't provide us any steps to reproduce, he just mentioned that crash happens for the few users with the message like this: AudioburstMobileLibrary: ThrowSql_SQLiteException + 400.
Have you ever seen similar issue? What could go wrong in this case?
The only somehow similar issue I found is this: #1668, but it is related to the tvOS (which is not used in my case) and the stacktrace is a little bit different.

Runtime Environment
SQLDelight version: 1.4.4
Application OS: Various versions of iOS: 14.5.1, 14.4.2, 14.0.1
Devices: iPhone 11 Pro Max, iPhone 11 Pro, iPhone 12, iPhone XS, iPhone X

Exception

at 0   ThrowSql_SQLiteException
at 1   android::throw_sqlite3_exception(int, char const*, char const*)
at 2   android::throw_sqlite3_exception(sqlite3, char const*)
at 3   SQLiter_SQLiteConnection_nativePrepareStatement
at 4   kfun:co.touchlab.sqliter.NativeDatabaseConnection#createStatement(kotlin.String){}co.touchlab.sqliter.Statement
at 5   kfun:co.touchlab.sqliter#withStetament@co.touchab.sqliter.DatabaseConnection(kotlin.String;kotlin.Function1<co.touchlab.sqliter.Statement,0:0>){0§<kotlin.Any?>}0:0
at 6   kfun:co.touchlab.sqliter#stringForQuery@co.touchab.sqliter.DatabaseConnection(kotlin.String){}kotlin.String
at 7   kfun:co.touchlab.sqliter.NativeDatabaseManager.createConnection#internal
at 8   kfun:co.touchlab.sqliter.NativeDatabaseManager#createMultiThreadedConnection(){} co.touchab.sqliter.DatabaseConnection
at 9   kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.$<init>$lambda-0$FUNCTION_REFERENCE$418.invoke#internal
at 10   kfun:com.squareup.sqldelight.drivers.native.SinglePool#<init>(kotlin.Function0<1:0>){}
@kpgalligan
Copy link
Collaborator

Well, it's happening on connection init (createConnection), which implies either a pragma setting, or a db migration. It'll be very hard to debug anything without more detail. The failing statement itself would be useful. Also, I have no idea how your sdk works. Essentially this is saying you have a database issue. It's certainly possible there's just a bug with the driver, but you'll also get this when there's a code issue.
Generally there's also a string message with the exception. Is that available? If there's a sql statement issue, I would expect it'll tell you what statement is failing.

@Kamil-H
Copy link
Author

Kamil-H commented Jun 25, 2021

Thank you @kpgalligan for your replay, it sheds some light on the issue.
It's indeed happening during the Database initialization. So far I don't have any migrations.
This is how I'm creating a driver and this method is declared as a expect and here is the actual implementation.
Client said that there is no exception message, but I'm trying to double check that.
If there indeed is no exception message, do you think that wrapping NativeSqliteDriver's constructor into a try-catch and letting library's client to subscribe to any exception would let us better understand what is going on? Or maybe simple try-catch wouldn't be enough and setUnhandledExceptionHook would be needed in this case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants