System.Data.SQLite
View Ticket
Not logged in
Ticket UUID: 2e39e8e60183ca2274ccf6d2d1c5289dff8ceac8
Title: System.AccessViolationException
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: Integration_Via_PInvoke Resolution: Need_More_Info
Last Modified: 2015-12-05 01:01:07
Version Found In: 1.0.91.0
User Comments:
anonymous added on 2015-08-03 16:17:45:
Hi,

When i start my window services with sqlite, the service randomly stops/crash, when i check the event viewer i found always the same problem at the same sqlite's internal function.
"System.Data.SQLite.UnsafeNativeMethods.sqlite3_column_int64(IntPtr, Int32)"

I'm improving my code to have on each function the "try/catch", but when i modify one function, then the services crash at another one,but always the problem is at the "unsafeNativeMethods.

Event viewer registry:
---------------------------------------------
Nombre de registro:Application
Origen:        .NET Runtime
Fecha:         03/08/2015 14:22:58
Id. del evento:1026
Categoría de la tarea:Ninguno
Nivel:         Error
Palabras clave:Clásico
Usuario:       No disponible
Equipo:        NOX
Descripción:
Aplicación: WIS_FILEMAINTENANCE.exe
Versión de Framework: v4.0.30319
Descripción: el proceso terminó debido a una excepción no controlada.
Información de la excepción: System.AccessViolationException
Pila:
   en System.Data.SQLite.UnsafeNativeMethods.sqlite3_column_int64(IntPtr, Int32)
   en System.Data.SQLite.SQLite3.GetInt64(System.Data.SQLite.SQLiteStatement, Int32)
   en System.Data.SQLite.SQLite3.GetValue(System.Data.SQLite.SQLiteStatement, System.Data.SQLite.SQLiteConnectionFlags, Int32, System.Data.SQLite.SQLiteType)
   en System.Data.SQLite.SQLiteDataReader.GetValue(Int32)
   en System.Data.SQLite.SQLiteDataReader.GetValues(System.Object[])
   en System.Data.ProviderBase.DataReaderContainer+CommonLanguageSubsetDataReader.GetValues(System.Object[])
   en System.Data.ProviderBase.SchemaMapping.LoadDataRow()
   en System.Data.Common.DataAdapter.FillLoadDataRow(System.Data.ProviderBase.SchemaMapping)
   en System.Data.Common.DataAdapter.FillFromReader(System.Data.DataSet, System.Data.DataTable, System.String, System.Data.ProviderBase.DataReaderContainer, Int32, Int32, System.Data.DataColumn, System.Object)
   en System.Data.Common.DataAdapter.Fill(System.Data.DataTable[], System.Data.IDataReader, Int32, Int32)
   en System.Data.Common.DbDataAdapter.FillInternal(System.Data.DataSet, System.Data.DataTable[], Int32, Int32, System.String, System.Data.IDbCommand, System.Data.CommandBehavior)
   en System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable[], Int32, Int32, System.Data.IDbCommand, System.Data.CommandBehavior)
   en System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable)
   en GMS.LIB.DataAccess.clsDataAccessDBSQLLite.EjecutaSP(System.Data.SQLite.SQLiteCommand, System.Data.DataTable ByRef, System.String ByRef)
   en DLL.SQL_CORE.DLL_SQL_CORE.fnSQLite_SELECT_SERVICE_STATUS_IDByMachineServiceName(System.String, System.String, System.String ByRef)
   en WIS.FILEMAINTENANCE.WIS_FILEMAINTENANCE.fnUpdateServiceState(System.String, System.String, System.String)
   en WIS.FILEMAINTENANCE.WIS_FILEMAINTENANCE.objTimerServiceState_Elapsed(System.Object, System.Timers.ElapsedEventArgs)
   en System.Timers.Timer.MyTimerCallback(System.Object)
   en System.Threading.TimerQueueTimer.CallCallbackInContext(System.Object)
   en System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   en System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   en System.Threading.TimerQueueTimer.CallCallback()
   en System.Threading.TimerQueueTimer.Fire()
   en System.Threading.TimerQueue.FireNextTimers()
   en System.Threading.TimerQueue.AppDomainTimerCallback()

XML de evento:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name=".NET Runtime" />
    <EventID Qualifiers="0">1026</EventID>
    <Level>2</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2015-08-03T12:22:58.000000000Z" />
    <EventRecordID>13293</EventRecordID>
    <Channel>Application</Channel>
    <Computer>NOX</Computer>
    <Security />
  </System>
  <EventData>
    <Data>Aplicación: WIS_FILEMAINTENANCE.exe
Versión de Framework: v4.0.30319
Descripción: el proceso terminó debido a una excepción no controlada.
Información de la excepción: System.AccessViolationException
Pila:
   en System.Data.SQLite.UnsafeNativeMethods.sqlite3_column_int64(IntPtr, Int32)
   en System.Data.SQLite.SQLite3.GetInt64(System.Data.SQLite.SQLiteStatement, Int32)
   en System.Data.SQLite.SQLite3.GetValue(System.Data.SQLite.SQLiteStatement, System.Data.SQLite.SQLiteConnectionFlags, Int32, System.Data.SQLite.SQLiteType)
   en System.Data.SQLite.SQLiteDataReader.GetValue(Int32)
   en System.Data.SQLite.SQLiteDataReader.GetValues(System.Object[])
   en System.Data.ProviderBase.DataReaderContainer+CommonLanguageSubsetDataReader.GetValues(System.Object[])
   en System.Data.ProviderBase.SchemaMapping.LoadDataRow()
   en System.Data.Common.DataAdapter.FillLoadDataRow(System.Data.ProviderBase.SchemaMapping)
   en System.Data.Common.DataAdapter.FillFromReader(System.Data.DataSet, System.Data.DataTable, System.String, System.Data.ProviderBase.DataReaderContainer, Int32, Int32, System.Data.DataColumn, System.Object)
   en System.Data.Common.DataAdapter.Fill(System.Data.DataTable[], System.Data.IDataReader, Int32, Int32)
   en System.Data.Common.DbDataAdapter.FillInternal(System.Data.DataSet, System.Data.DataTable[], Int32, Int32, System.String, System.Data.IDbCommand, System.Data.CommandBehavior)
   en System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable[], Int32, Int32, System.Data.IDbCommand, System.Data.CommandBehavior)
   en System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable)
   en GMS.LIB.DataAccess.clsDataAccessDBSQLLite.EjecutaSP(System.Data.SQLite.SQLiteCommand, System.Data.DataTable ByRef, System.String ByRef)
   en DLL.SQL_CORE.DLL_SQL_CORE.fnSQLite_SELECT_SERVICE_STATUS_IDByMachineServiceName(System.String, System.String, System.String ByRef)
   en WIS.FILEMAINTENANCE.WIS_FILEMAINTENANCE.fnUpdateServiceState(System.String, System.String, System.String)
   en WIS.FILEMAINTENANCE.WIS_FILEMAINTENANCE.objTimerServiceState_Elapsed(System.Object, System.Timers.ElapsedEventArgs)
   en System.Timers.Timer.MyTimerCallback(System.Object)
   en System.Threading.TimerQueueTimer.CallCallbackInContext(System.Object)
   en System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   en System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   en System.Threading.TimerQueueTimer.CallCallback()
   en System.Threading.TimerQueueTimer.Fire()
   en System.Threading.TimerQueue.FireNextTimers()
   en System.Threading.TimerQueue.AppDomainTimerCallback()
</Data>
  </EventData>
</Event>

mistachkin added on 2015-08-03 16:48:42:
Is more than one thread using the associated SQLiteConnection object?

Are the resources (SQLiteCommand, SQLiteDataReader, etc) associated with
the connection being cleaned up (i.e. via a "using block" or Dispose)?

anonymous added on 2015-08-03 18:12:38:
My System.Data.SQLite is wrapped by another dll and it always open and close connections and free all the stuff.

anonymous added on 2015-08-03 19:06:43:
i will continue writting the new about this problem.

Best Regards,
Luis.

mistachkin added on 2015-08-04 02:23:08:
Any further details you could provide would be useful.  It would be especially
useful if you could provide:

1. A short example C# program that demonstrates the problem.
2. An example database schema that goes along with #1.