AccessViolation in sqlite3_finalize

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for SQLite
Post Reply
steved
Posts: 9
Joined: Mon 15 Jun 2015 14:49

AccessViolation in sqlite3_finalize

Post by steved » Mon 15 Jun 2015 14:51

I am using SQLite 5.2.422.0 in a C# application (.NET v4.0.30319) and getting an access violation exception after running for 8+ hours. I was previously using SQLite 5.1 and getting the same exception.
----------------------------------------------------------------------------------------------------
This is the ".NET Runtime" Windows event log entry:

Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
at Devart.Data.SQLite.bt.sqlite3_finalize(IntPtr)
at Devart.Data.SQLite.a5.a(Devart.Data.SQLite.v)
at Devart.Data.SQLite.af.a(Boolean)
at Devart.Data.SQLite.SQLiteDataReader.Close()
at System.Data.Common.DbDataReader.Dispose(Boolean)
at Devart.Data.SQLite.SQLiteDataReader.Finalize()
----------------------------------------------------------------------------------------------------
This is the "Application Error" Windows event log entry:

Faulting module name: sqlite3.DLL, version 0.0.0.0, time stamp: 0x55659985
Exception code: 0xc0000005
Fault offset: 0x00027e96
Faulting process id: 0x1618
Faulting application start time: 0x01 d0a5491255d8a1
----------------------------------------------------------------------------------------------------
I used ProcDump to take a snapshot of the process before dismissing the error dialog and it appears to be occurring on the .NET garbage collection thread:

ChildEBP RetAddr
00f8ecd0 750015f7 ntdll!NtWaitForMultipleObjects+0x15
00f8ed6c 753a1a0c KERNELBASE!WaitForMultipleObjectsEx+0x100
00f8edb4 753a41f0 kernel32!WaitForMultipleObjectsExImplementation+0xe0
00f8edd0 753c80a4 kernel32!WaitForMultipleObjects+0x18
00f8ee3c 753c7f63 kernel32!WerpReportFaultInternal+0x186
00f8ee50 753c7858 kernel32!WerpReportFault+0x70
00f8ee60 753c77d7 kernel32!BasepReportFault+0x20
00f8eeec 775f1d17 kernel32!UnhandledExceptionFilter+0x1af
00f8eef4 775f1bf4 ntdll!__RtlUserThreadStart+0x62
00f8ef08 775f1a91 ntdll!_EH4_CallFilterFunc+0x12
00f8ef30 775db6ad ntdll!_except_handler4+0x8e
00f8ef54 775db67f ntdll!ExecuteHandler2+0x26
00f8ef78 775db620 ntdll!ExecuteHandler+0x24
00f8f004 77590163 ntdll!RtlDispatchException+0x127
00f8f004 10024937 ntdll!KiUserExceptionDispatcher+0xf
WARNING: Stack unwind information not available. Following frames may be wrong.
00f8f4dc 0b874a3a sqlite3!sqlite3_finalize+0x47
00f8f560 7006cb33 0xb874a3a
00f8f57c 753a14bd System_Data_ni!_load_config_used+0xd794b
00f8f590 00f8f7d8 kernel32!HeapFree+0x14
00f8f5a8 74616b15 0xf8f7d8
00f8f64c 74ff9037 clr!MethodTable::GetSlot+0x10
00f8f668 746da319 KERNELBASE!GetTickCount64+0x42
00f8f6bc 746da624 clr!WKS::ProcessProfilerAttachIfNecessary+0x90
00f8f704 74614306 clr!WKS::GCHeap::FinalizerThreadWorker+0x2b0
00f8f718 74614374 clr!ManagedThreadBase_DispatchInner+0x67
00f8f7bc 74614441 clr!ManagedThreadBase_DispatchMiddle+0x82
00f8f818 74722089 clr!ManagedThreadBase_DispatchOuter+0x5b
00f8f894 7479a909 clr!WKS::GCHeap::FinalizerThreadStart+0x198
00f8f930 753a337a clr!Thread::intermediateThreadProc+0x4d
00f8f93c 775b92e2 kernel32!BaseThreadInitThunk+0xe
00f8f97c 775b92b5 ntdll!__RtlUserThreadStart+0x70
00f8f994 00000000 ntdll!_RtlUserThreadStart+0x1b
----------------------------------------------------------------------------------------------------
The application is designed to use 8 worker processes to scan files from a network share and update a shared database that is local to the machine. The process that is terminating is the main application which also updates the same database. Occasionally, the database will be locked; however, this has been resolved by adding retry logic to the SQL statements. Do you have any suggestions on how to resolve this crashing?

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: AccessViolation in sqlite3_finalize

Post by Pinturiccio » Tue 16 Jun 2015 16:32

We have fixed the bug with the AccessViolationException when working with a database for a long time. This bug should fix described issue. We will post here when the corresponding build of dotConnect for SQLite is available for download.

steved
Posts: 9
Joined: Mon 15 Jun 2015 14:49

Re: AccessViolation in sqlite3_finalize

Post by steved » Tue 16 Jun 2015 16:39

That is great news. Do you have a ballpark estimate of when the build might be available?

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: AccessViolation in sqlite3_finalize

Post by Pinturiccio » Tue 16 Jun 2015 16:53

We are planning to release the next public build of dotConnect for SQLite at the end of the week.

steved
Posts: 9
Joined: Mon 15 Jun 2015 14:49

Re: AccessViolation in sqlite3_finalize

Post by steved » Tue 16 Jun 2015 17:23

Is there a temporary workaround that we could implement to prevent the error?

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: AccessViolation in sqlite3_finalize

Post by Pinturiccio » Wed 17 Jun 2015 14:38

There is no workaround, and you will need to wait a couple of days.

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: AccessViolation in sqlite3_finalize

Post by Pinturiccio » Fri 19 Jun 2015 10:45

New build of dotConnect for PostgreSQL 7.3.437 is available for download now!
It can be downloaded from http://www.devart.com/dotconnect/postgr ... nload.html (trial version) or from Registered Users' Area (for users with valid subscription only).

Please post here if the issue is not reproduced with this build.

steved
Posts: 9
Joined: Mon 15 Jun 2015 14:49

Re: AccessViolation in sqlite3_finalize

Post by steved » Fri 19 Jun 2015 13:35

I'm using SQLite, not PostgreSQL.

steved
Posts: 9
Joined: Mon 15 Jun 2015 14:49

Re: AccessViolation in sqlite3_finalize

Post by steved » Fri 19 Jun 2015 13:43

I see there is a new version for SQLite too so I will try that. Thanks.

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: AccessViolation in sqlite3_finalize

Post by Pinturiccio » Fri 19 Jun 2015 13:50

Sorry for the misprint.

New build of dotConnect for SQLite 5.2.437 is available for download now!
It can be downloaded from http://www.devart.com/dotconnect/sqlite/download.html (trial version) or from Registered Users' Area (for users with valid subscription only).

Post Reply