System.Data.SQLite

Login
This project makes use of Eagle, provided by Mistachkin Systems.
Eagle: Secure Software Automation
Ticket Hash: 0c5223f102fb0032d5479b6af12a8674dafd9dd7
Title: System.AccessViolationException occurs while using SQLite Wrapper for C#
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: Integration_Via_PInvoke Resolution: Unable_To_Reproduce
Last Modified: 2015-12-09 18:55:23
Version Found In: 1.0.98.0
User Comments:
anonymous added on 2015-12-04 10:27:15:
The code being called within a lock from two different threads

like this:

lock(m_lockObj)
{
      using (var command = m_Connection.CreateCommand())
            using (var reader = command
                .SetText("SELECT T FROM P WHERE T.A='1' UNION SELECT T FROM PP  WHERE T NOT IN (SELECT T FROM P WHERE T.A='0')")
                .ExecuteReader())
            {
                return reader.GetRows(r => r.GetGuid(r.GetOrdinal("T")));
            }
}

The exception is thrown after approximately 20 - 30 hours run

 CALLSTACK:
----------


Source	System.Data.SQLite
Message	Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
HelpLink	 
MethodToken	100664352
MethodName	sqlite3_prepare_interop
Type	System.AccessViolationException
AppDomain	Siemens.Automation.Portal.exe
ThreadName	 
ThreadId	9936
IsExceptionImplicit	True
InnerExceptionMissing	False
-	Stack
-	Frame
Signature	System.Data.SQLite.UnsafeNativeMethods.sqlite3_prepare_interop(IntPtr db, IntPtr pSql, Int32 nBytes, IntPtr& stmt, IntPtr& ptrRemain, Int32& nRemain)
Class	System.Data.SQLite.UnsafeNativeMethods
ClassToken	33554512
MethodName	sqlite3_prepare_interop
MethodAccess	Internal
MethodToken	100664352
FileName	 
LineNumber	0
ColumnNumber	0
ILOffset	 
NativeOffset	0
CallType	Normal
AssemblyName	System.Data.SQLite, Version=1.0.94.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139
Module	System.Data.SQLite.dll
ModuleToken	1
Message	sqlite3_prepare_interop at offset 0 in file:line:column :0:0
-	Frame
Signature	System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String strSql, SQLiteStatement previous, UInt32 timeoutMS, String& strRemain)
Class	System.Data.SQLite.SQLite3
ClassToken	33554439
MethodName	Prepare
MethodAccess	Internal
MethodToken	100663512
FileName	 
LineNumber	0
ColumnNumber	0
ILOffset	0
NativeOffset	2310
CallType	Normal
AssemblyName	System.Data.SQLite, Version=1.0.94.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139
Module	System.Data.SQLite.dll
ModuleToken	1
Message	Prepare at offset 2310 in file:line:column me unknown>:0:0
-	Frame
Signature	System.Data.SQLite.SQLiteCommand.BuildNextCommand()
Class	System.Data.SQLite.SQLiteCommand
ClassToken	33554446
MethodName	BuildNextCommand
MethodAccess	Internal
MethodToken	100663642
FileName	 
LineNumber	0
ColumnNumber	0
ILOffset	0
NativeOffset	283
CallType	Normal
AssemblyName	System.Data.SQLite, Version=1.0.94.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139
Module	System.Data.SQLite.dll
ModuleToken	1
Message	BuildNextCommand at offset 283 in file:line:column :0:0
-	Frame
Signature	System.Data.SQLite.SQLiteDataReader.NextResult()
Class	System.Data.SQLite.SQLiteDataReader
ClassToken	33554484
MethodName	NextResult
MethodAccess	Public
MethodToken	100664083
FileName	 
LineNumber	0
ColumnNumber	0
ILOffset	288
NativeOffset	328
CallType	Normal
AssemblyName	System.Data.SQLite, Version=1.0.94.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139
Module	System.Data.SQLite.dll
ModuleToken	1
Message	NextResult at offset 328 in file:line:column name unknown>:0:0
-	Frame
Signature	System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)
Class	System.Data.SQLite.SQLiteDataReader
ClassToken	33554484
MethodName	.ctor
MethodAccess	Internal
MethodToken	100664042
FileName	 
LineNumber	0
ColumnNumber	0
ILOffset	151
NativeOffset	324
CallType	IntraClass
AssemblyName	System.Data.SQLite, Version=1.0.94.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139
Module	System.Data.SQLite.dll
ModuleToken	1
Message	.ctor at offset 324 in file:line:column unknown>:0:0
-	Frame
Signature	System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
Class	System.Data.SQLite.SQLiteCommand
ClassToken	33554446
MethodName	ExecuteReader
MethodAccess	Public
MethodToken	100663667
FileName	 
LineNumber	0
ColumnNumber	0
ILOffset	20
NativeOffset	60
CallType	Normal
AssemblyName	System.Data.SQLite, Version=1.0.94.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139
Module	System.Data.SQLite.dll
ModuleToken	1
Message	ExecuteReader at offset 60 in file:line:column lename unknown>:0:0

mistachkin added on 2015-12-04 21:01:17:
Are any other native components being used in the process?  This looks like some
kind of heap corruption, which may be unrelated to SQLite.

anonymous added on 2015-12-07 09:13:26:
there is no other unmanaged code used in the process

anonymous added on 2015-12-07 09:44:25:
sometimes the exception is thrown after 2 or three hours, but there is always the same exception after the same operation

mistachkin added on 2015-12-07 19:53:11:
Are any of the controls, components, or libraries being used by the project from
somewhere other than Microsoft, not including System.Data.SQLite?

anonymous added on 2015-12-09 13:49:07:
The issue is solved. The ticket can be closed.

mistachkin added on 2015-12-09 18:55:23:
Thanks for letting us know.