TechnitiumSoftware / DnsServer

Technitium DNS Server
https://technitium.com/dns/
GNU General Public License v3.0
3.83k stars 399 forks source link

'database disk image is malformed' error when using Sqlite DNS App after update to verison 12.0.0 #868

Closed kilbyjmichael closed 4 months ago

kilbyjmichael commented 4 months ago

Error started occurring the day after I upgraded to version 12.0.0 from 11.5.3. Upgrade consisted of making a new LXC container and importing settings from 11.5.3 version. Running on Debian 12 LXC on Proxmox 7.

[2024-02-16 00:53:48 Local] DNS App [Query Logs (Sqlite)]: Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 11: 'database disk image is malformed'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at System.Data.Common.DbCommand.ExecuteNonQueryAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at QueryLogsSqlite.App.BulkInsertLogsAsync() in Z:\Technitium\Projects\DnsServer\Apps\QueryLogsSqliteApp\App.cs:line 252
   at QueryLogsSqlite.App.BulkInsertLogsAsync() in Z:\Technitium\Projects\DnsServer\Apps\QueryLogsSqliteApp\App.cs:line 256
   at QueryLogsSqlite.App.BulkInsertLogsAsync() in Z:\Technitium\Projects\DnsServer\Apps\QueryLogsSqliteApp\App.cs:line 256
   at QueryLogsSqlite.App.BulkInsertLogsAsync() in Z:\Technitium\Projects\DnsServer\Apps\QueryLogsSqliteApp\App.cs:line 256
ShreyasZare commented 4 months ago

Thanks for the post. The error means that the sqlite db file is corrupt and will required to be deleted for the app to work properlt again. Or, you can change the file name in the app's config and it will create and start using a the new file.

The file can get corrupt if the server/container is not stopped gracefully. That is, if the DNS server process is killed while the app is writing the db file then it will get corrupt.

kilbyjmichael commented 4 months ago

Great, thank you, that was an easy fix.