Bug 35089 - Mono.Data.Sqlite.SqliteException Attempt to write a read-only database
Summary: Mono.Data.Sqlite.SqliteException Attempt to write a read-only database
Status: RESOLVED NORESPONSE
Alias: None
Product: iOS
Classification: Xamarin
Component: BCL Class Libraries ()
Version: XI 9.2
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-10-20 09:20 UTC by John Miller [MSFT]
Modified: 2016-04-12 15:14 UTC (History)
6 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NORESPONSE

Description John Miller [MSFT] 2015-10-20 09:20:32 UTC
**Overview:**

   Since using iOS 8.2, a customer has been noticing intermittent SQLite errors in their app. 
   Note* iOS updated SQLite for 8.2

**Steps to Reproduce:**

   Unclear, need a sample. 

**Actual Results:**

Mono.Data.Sqlite.SqliteException: Attempt to write a read-only database
attempt to write a readonly database
at Mono.Data.Sqlite.SQLite3.Reset (Mono.Data.Sqlite.SqliteStatement stmt) [0x00000] in <filename unknown>:0
at Mono.Data.Sqlite.SQLite3.Step (Mono.Data.Sqlite.SqliteStatement stmt) [0x00000] in <filename unknown>:0
at Mono.Data.Sqlite.SqliteDataReader.NextResult () [0x00000] in <filename unknown>:0
at Mono.Data.Sqlite.SqliteDataReader..ctor (Mono.Data.Sqlite.SqliteCommand cmd, CommandBehavior behave) [0x00000] in <filename unknown>:0
at Mono.Data.Sqlite.SqliteCommand.ExecuteReader (CommandBehavior behavior) [0x00000] in <filename unknown>:0
at Mono.Data.Sqlite.SqliteCommand.ExecuteNonQuery () [0x00000] in <filename unknown>:0
at projectname.EntityObject.InsertToDB (Boolean bRecursive, Mono.Data.Sqlite.SqliteTransaction trans) [0x00000] in <filename unknown>:0
at projectname.EntityObject.Save (Boolean bRecursive) [0x00000] in <filename unknown>:0
*
Mono.Data.Sqlite.SqliteException: Attempt to write a read-only database attempt to write a readonly database at Mono.Data.Sqlite.SQLite3.Reset (Mono.Data.Sqlite.SqliteStatement stmt) [0x00000] in <filename unknown>:0 at Mono.Data.Sqlite.SQLite3.Step (Mono.Data.Sqlite.SqliteStatement stmt) [0x00000] in <filename unknown>:0 at Mono.Data.Sqlite.SqliteDataReader.NextResult () [0x00000] in <filename unknown>:0 at Mono.Data.Sqlite.SqliteDataReader..ctor (Mono.Data.Sqlite.SqliteCommand cmd, CommandBehavior behave) [0x00000] in <filename unknown>:0 at Mono.Data.Sqlite.SqliteCommand.ExecuteReader (CommandBehavior behavior) [0x00000] in <filename unknown>:0 at Mono.Data.Sqlite.SqliteCommand.ExecuteNonQuery () [0x00000] in <filename unknown>:0 at projectname.DBHandler.ExecuteNonQuery (System.String query, System.Collections.Hashtable paramsHT, Mono.Data.Sqlite.SqliteTransaction trans, Mono.Data.Sqlite.SqliteCommand cmd) [0x00000] in <filename unknown>:0

**Expected Results:**

   No exceptions. 
   The database is set to Serialized mode. 

**Build Date & Platform:**

Xamarin Studio
Version 5.9.7 (build 22)
Installation UUID: f32e4a39-680d-45ad-ab60-d4de233e22c6
Runtime:
Mono 4.0.3 ((detached/d6946b4)
GTK+ 2.24.23 (Raleigh theme)

Package version: 400030020

Apple Developer Tools
Xcode 6.4 (7720)
Build 6E35b

Xamarin.iOS
Version: 8.10.4.46 (Enterprise Edition)
Hash: 2c66d2f
Branch: master
Build date: 2015-08-04 13:52:25-0400

**Additional Information:**

   Looking for suggestions on how to narrow down where the issue might be.
Comment 2 Rolf Bjarne Kvinge [MSFT] 2015-10-21 11:17:44 UTC
I don't think this is a bug in our code (since it started happening when iOS updated its sqlite library in iOS 8.2). This also means that even if we find out what the bug is, we'll probably be unable to fix it, and in any case there will buggy iOS devices in the wild (so even if it's fixed in future versions of iOS, the customer might have to account for buggy iOS devices).

Thus the goal isn't "find the bug and fix it", but instead "figure out how I can make my sqlite code work".

In any case the first point is to know if the customer is able to reproduce this issue himself, or if they've only seen this from their customers. If they can't reproduce it themselves, they must figure out a way to do it, otherwise they'll just be shooting in the dark.

Once they have some way to reproduce it, they can start modifying their code to try to create a smaller test case, which will either end up explaining the bug (and thus a workaround), or they'll find a way to work around it.
Comment 3 Sebastien Pouliot 2016-04-12 15:14:01 UTC
We have not received further information and will assume this is not an issue anymore. If you can still affected by this please re-open the bug and include the requested information. Thanks.