Segfault after loading SpatiaLite extension in some Linux distros
Status:
Closed
Type:
Incident
Severity:
Important
Priority:
Medium
Subsystem:
Integration_Via_PInvoke
Resolution:
External
Last Modified:
2020-09-24 01:21:51 4.78 years ago
Created:
2020-08-08 18:23:07 4.91 years ago
Version Found In:
1.0.113.1
User Comments:
anonymous added on 2020-08-08 18:23:07:
After loading the SpatiaLite extension, the application segfaults during the next query execution.
I have observed this only in Ubuntu 20 and Debian 10; but not in Ubuntu 18. In Ubuntu 18, everything works correctly.
Reproduction code (C#)
// <PackageReference Include="System.Data.SQLite.Core" Version="1.0.113.1" />
using System.Data.SQLite;
public class Test {
public static void Main() {
var connection = new SQLiteConnection(@"Data Source=:memory:; Version=3; Read Only=True;");
connection.Open();
connection.EnableExtensions(true);
// Pre-Requisite package:
// sudo apt install libsqlite3-mod-spatialite
connection.LoadExtension("mod_spatialite"); // NO ERROR; extension loaded successfully
// Create SQL query that doesn't use SpatiaLite;
// though results are the same if the query does.
// Example: spatialite_version() AS spatialite_version
using SQLiteCommand fmd = connection.CreateCommand();
fmd.CommandText = @"SELECT sqlite_version() AS sqlite_version";
fmd.CommandType = System.Data.CommandType.Text;
using SQLiteDataReader r = fmd.ExecuteReader(); // SEGFAULT happens here
// Works correctly in Ubuntu 18
// If LoadExtension("mod_spatialite") is removed, runs correctly in Ubuntu 20 and Debian 10.
// libsqlite3-mod-spatialite works correctly outside of C#.
}
}
anonymous added on 2020-08-24 20:35:02:
This may be an obvious answer, however I hate when issues are left hanging.
I've boiled down the likely issue to an ABI incompatibility between the System.Data.SQLite binaries and Ubuntu 20.04 LTS.
It seems that a resolution here would need an updated package with support for the ABI used in Ubuntu 20.04 LTS. I've made an attempt to build the libraries myself for Ubuntu 20.04 LTS, but have sadly been unable to successfully compile it. =/
mistachkin added on 2020-09-24 01:21:51:
From the sound of it, this may be an issue with the SpatiaLite extension.
Since other extensions are able to load and work without issue, I'm closing
this ticket as "External".