Access Violation exception on connection close

634 views
Skip to first unread message

Habib

unread,
Mar 19, 2012, 7:22:52 AM3/19/12
to SpatiaLite Users
I am using latest stable release (3.0.1) downloaded from the following
link : http://www.gaia-gis.it/gaia-sins/windows-bin-x86/spatialite-3.0.1-DLL-win-x86.zip

I am using it with C# 4.0 on Windows 7 Enterprise. The exception I am
getting is :
{System.AccessViolationException: Attempted to read or write protected
memory. This is often an indication that other memory is corrupt.
at
System.Data.SQLite.UnsafeNativeMethods.sqlite3_close_interop(IntPtr
db)
at
System.Data.SQLite.SQLiteBase.CloseConnection(SQLiteConnectionHandle
db)
at System.Data.SQLite.SQLiteConnectionHandle.ReleaseHandle()
at System.Runtime.InteropServices.CriticalHandle.Cleanup()
at System.Runtime.InteropServices.CriticalHandle.Dispose(Boolean
disposing)
at System.Runtime.InteropServices.CriticalHandle.Dispose()
at System.Data.SQLite.SQLite3.Close()
at System.Data.SQLite.SQLiteConnection.Close()

I have seen other post regarding the same problem, but no solution was
mentioned. Any help is appreciated
Message has been deleted

Habib

unread,
Mar 19, 2012, 8:22:08 AM3/19/12
to SpatiaLite Users
Just figured it out. I was using the SQLite dll from http://sqlite.phxsoftware.com/
, the dll System.Data.Sqlite was of older version. Found a new
version
of System.Data.Sqlite on : http://system.data.sqlite.org/index.html/doc/trunk/www/index.wiki
- Downloaded the .Net framework 4 binaries and added Two files :
System.Data.Sqlite.dll and System.Interop.dll
Since then I am not getting any exception on application close.

On Mar 19, 4:22 pm, Habib <habibw...@gmail.com> wrote:
> I am using latest stable release (3.0.1) downloaded from the following
> link :http://www.gaia-gis.it/gaia-sins/windows-bin-x86/spatialite-3.0.1-DLL...

a.furieri

unread,
Mar 19, 2012, 8:23:20 AM3/19/12
to SpatiaLite Users
Hi Abib,

this one is well known problem affecting the .NET connector,
and we have a still unresolved ticket about this issue:
https://www.gaia-gis.it/fossil/libspatialite/tktview?name=eba55ae574

I'm sorry, but I can say nothing about this, because I'm not a .NET
user, I have not the slightest idea about this environment, and I'm
absolutely unable to perform any check/test.

Anyway, I strongly suspect that this issue is strictly related
to other similar issues reported for Java and Python connectors
on Windows:
- the current libspatialite.dll is based on the amalgamation, thus
including a statically-linked "private internal copy" of libsqlite;
please note, any linker symbol is carefully remapped so to avoid
any possible harmful name collision.
- anyway, as Pepijn reported many and many times, this layout is
no at all good (because a different libsqlite instance is probably
used by the connector itself).
- a further possible suspect: any libspatialite.dll made available
on the www.gaia-gis.it download site has been built using the
MinGW compiler (standard GNU gcc for Windows): I'm not really
sure about this, but may well be that some incompatibility in malloc/
free
could arise when using other sw compiled using the MSVC compiler
and/or caused by different versions of the platform C runtime
(msvcrt)

Conclusion: the next to come v.3.1.0 will definitively abandon
the "amalgamation" for any Windows binary distribution, simply
relying on some "system-wide" libsqlite.dll
Hoping well, this should definitively resolve all these issues.

bye Sandro

a.furieri

unread,
Mar 19, 2012, 8:27:02 AM3/19/12
to SpatiaLite Users
Just crossing on mid-air ;-)

ok, thanks for this lates clarification
it's really useful, because it seems to confirm that the problem is
probably caused by mixing two different versions of libsqlite

bye Sandro
Reply all
Reply to author
Forward
0 new messages