Our app was facing a database corruption crash while reading from the database.
I was going through the implementation of SQLite.swift to check for possible synchronisation issues and found this piece of code.
Each call to statement.next() is executed in a serial queue. But in between the two calls the code switches to the caller thread and leaves the database exposed to a sneaky write operation. This can potentially cause the subsequent statement.next() call to throw a corruption error.
Our app was facing a database corruption crash while reading from the database. I was going through the implementation of SQLite.swift to check for possible synchronisation issues and found this piece of code.
Each call to statement.next() is executed in a serial queue. But in between the two calls the code switches to the caller thread and leaves the database exposed to a sneaky write operation. This can potentially cause the subsequent statement.next() call to throw a corruption error.
@jberkel @NathanFallet Please check.