We have a situation where our Sitcore application is constantly failing while interacting with an SQLite database stored on the SD card. We have created a simple application to recreate the issue which is attached with this email.
Basically, when inserting records into a table, an exception is thrown randomly with an error "database or disk is full" (also seen "disk I/O error').
Once an error happens, there is no recovery unless we reset the device, and the database file becomes zero length.
This is a showstopper issue and needs your attention and resolution as soon as possible as we don't find any workaround.
Our environment:
Sitcore SCM20260E
SD Card: SanDisk 8GB Micro SD HC
Firmware and Library version: v2.2.2.1000
namespace SQLiteDBOnSDCard
{
internal class Program
{
static void Main()
{
var sd = GHIElectronics.TinyCLR.Devices.Storage.StorageController.FromName(GHIElectronics.TinyCLR.Pins.SC20260.StorageController.SdCard);
var drive = GHIElectronics.TinyCLR.IO.FileSystem.Mount(sd.Hdc);
for (int j = 0; j < 500; ++j)
{
var database = System.IO.Path.Combine(drive.Name, $"{j}.db");
if (System.IO.File.Exists(database))
{
System.IO.File.Delete(database);
GHIElectronics.TinyCLR.IO.FileSystem.Flush(sd.Hdc);
System.Threading.Thread.Sleep(1000);
}
using (var db = new GHIElectronics.TinyCLR.Data.SQLite.SQLiteDatabase(database))
{
try
{
System.Diagnostics.Debug.WriteLine($"iteration: {j} Executing CREATE TABLE...");
db.ExecuteNonQuery("CREATE TABLE Test (Var1 TEXT, Var2 INTEGER, Var3 DOUBLE);");
for (int i = 0; i < 5000; i++)
{
System.Diagnostics.Debug.WriteLine($"iteration: {j} Executing INSERT INTO {i + 1}...");
db.ExecuteNonQuery("INSERT INTO Test(Var1, Var2, Var3) VALUES ('Hello, World!', 25, 3.14);");
GHIElectronics.TinyCLR.IO.FileSystem.Flush(sd.Hdc);
}
System.Diagnostics.Debug.WriteLine($"iteration: {j} Executing SELECT... ");
var result1 = db.ExecuteQuery("SELECT Var1 FROM Test;");
System.Diagnostics.Debug.WriteLine($"Item count: {result1.Data.Count}");
}
catch (System.Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
}
}
}
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
}
}
}
From customer: