Hello,
I have a problem with using SQLite 3 in the Hurtworld plugin (it's possible that in other types the problem also occurs). Namely: several times reloading the plugin (inserting subsequent versions while creating the plugin) very often crashes the server / connection to the SQLite 3 database ceases to work.
An example of the simplest plugin that causes this problem for me:
This applies to servers built on Windows and Linux. Error log:
Hurtworld legacy, Oxide 2.0.3893.
What could be the reason for problems with breaking the connection with SQLite3?
I have a problem with using SQLite 3 in the Hurtworld plugin (it's possible that in other types the problem also occurs). Namely: several times reloading the plugin (inserting subsequent versions while creating the plugin) very often crashes the server / connection to the SQLite 3 database ceases to work.
An example of the simplest plugin that causes this problem for me:
using Oxide.Core;
using System;
using Oxide.Core.Database;
namespace Oxide.Plugins
{
[Info("TestSQLite3", "!Dark!", "1.0.0")]
[Description("Test Hurtworld SQLite 3")]
class TestSQLite3 : HurtworldPlugin
{
Core.SQLite.Libraries.SQLite sqlLibrary = Interface.Oxide.GetLibrary<Core.SQLite.Libraries.SQLite>();
Connection sqlConnection;
private void Loaded()
{
Puts("Loading...");
sqlConnection = sqlLibrary.OpenDb("test.sqlite", this, true);
sqlLibrary.ExecuteNonQuery(Sql.Builder.Append(
@"CREATE TABLE IF NOT EXISTS `example_table` (
`time` CHAR ( 50 ),
PRIMARY KEY(`time`)
) WITHOUT ROWID;"), sqlConnection);
Insert();
}
private void Unload()
{
Puts("Unloading...");
Insert();
//sqlLibrary.CloseDb(sqlConnection);
}
private void Insert()
{
string sqlQuery = "INSERT INTO example_table (`time`) VALUES (@0);";
Sql insertCommand = Oxide.Core.Database.Sql.Builder.Append(sqlQuery, DateTime.UtcNow);
sqlLibrary.Insert(insertCommand, sqlConnection, rowsAffected =>
{
if (rowsAffected > 0)
{
Puts("New record inserted");
}
});
}
}
}
This applies to servers built on Windows and Linux. Error log:
Unity Player [version: Unity 5.3.4f1_fdbb5133b820]
sqlite3.dll caused an Access Violation (0xc0000005)
in module sqlite3.dll at 0033:017320ca.
Error occurred at 2018-10-28_110210.
E:\server\Hurtworld.exe, run by xxx.
59% memory in use.
16308 MB physical memory [6686 MB free].
18740 MB paging file [5631 MB free].
134217728 MB user address space [134211794 MB free].
Read from location 00000030 caused an access violation.
Hurtworld legacy, Oxide 2.0.3893.
What could be the reason for problems with breaking the connection with SQLite3?