System.Data.SQLite

Login
This project makes use of Eagle, provided by Mistachkin Systems.
Eagle: Secure Software Automation
Ticket Hash: f1c6e80ac94d7ac071e9105094c49e9b3eebb239
Title: Crash in sqlite3_blob_read
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: Integration_Via_PInvoke Resolution: Unable_To_Reproduce
Last Modified: 2020-10-29 02:32:27
Version Found In: 1.0.112
User Comments:
anonymous added on 2020-07-02 14:24:50:

We intermittently experience an AccessViolationException while acessing an open reader in our .NET Core 3.1 based windows service. Basically we use a single shared SQLite connction accross many TPL Dataflow tasks which works fine. The database is operated in WAL mode and the serialized isolation mode is implicitly used. However, after several hours of operation and millions of data rows written into the database an access violation occurs in SQLite.Interop.dll.

Unhandled exception at 0x00007FF8CCC54618 (SQLite.Interop.dll) in Service__PID__4772__Date__06_29_2020__Time_02_42_55PM__613__First Chance Access Violation.dmp: 0xC0000005: Access violation reading location 0x0000000000000011. occurred

DebugDiag Log: ....


  • EXCEPTION DETAILS * ***********************

DetailID = 1 Count: 1 Exception #: 0XC0000005 Stack:
0x00007ff8702c5d64 e entries e entries e entries coreclr!GetCLRRuntimeHost+0x31d7a0 e entries e entries e entries 0x00007ff8702c5cc7 e entries

DetailID = 2 Count: 1 Exception #: 0XC0000005 Stack:
KERNELBASE!RaiseException+0x68 coreclr!coreclr_shutdown_2+0xba49 coreclr!coreclr_shutdown_2+0xba7b e entries e entries coreclr!coreclr_shutdown_2+0xba85 e entries e entries e entries 0x00007ff8702c5d64 e entries e entries e entries coreclr!GetCLRRuntimeHost+0x31d7a0 e entries e entries e entries 0x00007ff8702c5cc7 e entries

DetailID = 3 Count: 10 Type: NOT_FOUND Message:
Stack:

DetailID = 4 Count: 21062 Type: NOT_FOUND Message:
Stack:
(omitted)

DetailID = 5 Count: 1 Exception #: 0XC0000005 Stack:
SQLite_Interop!sqlite3_blob_read+0xd8 e entries e entries SQLite_Interop!sqlite3_blob_read+0x15 e entries e entries e entries 0x00007ff870ab0f79 e entries 0xa7eae1 0x0000028a00000001 0x0000028a4be09030 0x1 0x00008ff0a2f3c1c0 coreclr!GetCLRRuntimeHost+0x249148 0x000000ae1227fa90 0x00007ff870444328 0x00007ff870444328 e entries e entries 0x000000ae1227f030 e entries e entries e entries 0x00007ff870ab0f79 e entries 0x000000ae1227f0e0 0x000000ae1227f710 0x00007ff870444328 0x0000028a51a19998 0x0000028a4d0f3928 0x0000028a51a19970 0x0000028a51a19998 0x000000ae1227f710 0x000000ae1227f870 0x1 0x0000028a51872390 e entries e entries 0x000000ae1227f150 e entries e entries e entries 0x00007ff8`70924471 e entries


  • EXCEPTION SUMMARY *


    -----------------------
    Count Exception
    -----------------------
    21072 CLR Exception
    3 0XC0000005
    -----------------------

**** Some exception details were omitted due to the following reasons The maximum number of stacks (MAX_CLR_EXCEPTION_STACKS_PER_EXCEPTION_TYPE = 10) for this CLR exception type have been collected: 'NOT_FOUND'

Debugging Overhead Cost: Total Elapsed Ticks = 25495703 (100%) Total Ticks Spent in Debugger Engine = 1923 (0%) Total Ticks Spent in Crash Rule Script = 124536 (0%)


Since still unable to reproduce this error in an isolated environment I only can provide a scarse amount of information. Any help would be highly appreciated.


mistachkin added on 2020-09-24 01:08:51:

The stack traces do not really contain enough information to pin this issue down.

However, given your description of the issue, I'm wondering if you are using System.Data.SQLite objects (SQLiteConnection, SQLiteCommand, and SQLiteDataReader) from multiple threads. In general, this is not a good idea as those objects are not thread-safe, even if the underlying native SQLite library is configured for full thread safety (which it is).