System.Data.SQLite
View Ticket
Not logged in
Ticket UUID: 5363fd4af6a7c17a780547b5e860341a2b4825c4
Title: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Status: Closed Type: Incident
Severity: Important Priority: Low
Subsystem: Data_Reader Resolution: Unable_To_Reproduce
Last Modified: 2014-01-23 01:59:48
Version Found In: 1.0.86.0
User Comments:
anonymous added on 2013-06-05 10:44:30:
Please tell me this Error fix version.



Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at System.Runtime.InteropServices.Marshal.CopyToManaged(IntPtr source, Object destination, Int32 startIndex, Int32 length)
   at System.Data.SQLite.SQLiteConvert.UTF8ToString(IntPtr nativestring, Int32 nativestringlen)
   at System.Data.SQLite.SQLite3.GetText(SQLiteStatement stmt, Int32 index)
   at System.Data.SQLite.SQLite3.GetValue(SQLiteStatement stmt, Int32 index, SQLiteType typ)
   at System.Data.SQLite.SQLiteDataReader.get_Item(String name)


Program source is like this...


private static bool Check(SQLiteDataReader reader) {
	while (reader.Read()) {

		string kind = reader["KIND"].ToString();
		:
		:
		:
	}
	return false;
}

mistachkin added on 2013-06-05 18:40:07:
Does the issue occur with the latest released version (i.e. 1.0.86.0)?

anonymous added on 2013-06-07 02:53:11:
This issue has been resolved in version 1.0.86.0.
Thank you very much.

anonymous added on 2013-07-04 11:15:09:
I am a questioner.

Version 1.0.86.0
This problem returns.

To contact you via surveys to conduct research.

anonymous added on 2013-07-04 12:12:36:
Do you think you can do a little research on this problem?

mistachkin added on 2013-07-04 20:34:23:
I'm unable to reproduce this issue here locally.  Do you have any additional
information, such as an isolated C# example and/or the schema of the table
involved?

anonymous added on 2013-07-05 13:12:18:
----------------------------------- 
CREATE TABLE TBL(
  "NAME" "TEXT",
  "ID" "INTEGER",
  "KIND" "TEXT"
  )

CREATE INDEX 
  INDEX_TBL_ID ON TBL(ID)

SELECT * 
  FROM TBL 
  WHERE ID = ?
----------------------------------- 
? is variable

This problem occurs rarely. 
The result of SELECT is SQLiteDataReader. 
SELECT is performed frequently.

mistachkin added on 2013-07-05 20:04:54:
Some additional questions:

1. What is the operating system version (e.g. Windows 7 32-bit, etc)?

2. What is the .NET Framework version (e.g. 2.0, 4.0, etc)?

3. Could some other component in the process be corrupting the heap?

4. Is it possible to save a memory dump from the process?

mistachkin added on 2013-07-05 20:50:51:
The current test case for this ticket can be seen here:

[/artifact?ci=strictStatement&filename=Tests/tkt-5363fd4af6.eagle]

anonymous added on 2013-07-12 07:34:16:
> 1. What is the operating system version (e.g. Windows 7 32-bit, etc)?
Windows Server 2008 R2 Standard
Service Pack 1

> 2. What is the .NET Framework version (e.g. 2.0, 4.0, etc)?
.NET Framework 3.5 Service Pack 1

> 3. Could some other component in the process be corrupting the heap?
It's unlikely.
Because

It is thought that the possibility is low. 
It is from the following reasons. 
- Language is C#. 
- The pointer is not used. 
- Offered DLL is only SQLite. 
However, this program is using many memories. 
16GB of physical memory is used almost all, and swap occurs.

> 4. Is it possible to save a memory dump from the process?
It is difficult to offer memory dump. because it's poorly-reproducible.

mistachkin added on 2013-07-15 04:18:11:
It sounds like this issue is only reproducible when system memory is extremely
low?

Are in-memory databases being used at the time?

mistachkin added on 2013-07-16 22:36:28:
Also, it would be useful to try and reproduce this using a debug build of
System.Data.SQLite and the SQLite core library itself in order to see any
possible assert() that may be happening.

mistachkin added on 2013-07-17 02:49:54:
Are multiple threads in use in the application?  Are the SQLiteConnection and/or
SQLiteDataReader object instances being shared among threads?

anonymous added on 2013-07-23 06:32:10:
>It sounds like this issue is only reproducible when system memory is extremely low? 
 
A system memory is not low When an error occurs. 

------------------------------------------------------------------------------------------------------- 
>Are in-memory databases being used at the time? 
 
No, in-memory databases didn't use. 

------------------------------------------------------------------------------------------------------- 
>Also, it would be useful to try and reproduce this using a debug build of 
>System.Data.SQLite and the SQLite core library itself in order to see any 
>possible assert() that may be happening. 
 
Debug build of System.Data.SQLite and the SQLite core library is not possible to use due to business reasons. 
 
------------------------------------------------------------------------------------------------------- 
>Are multiple threads in use in the application? Are the SQLiteConnection >and/or 
>SQLiteDataReader object instances being shared among threads? 
 
No, single thread is in use in the application.

mistachkin added on 2013-07-26 08:53:29:
I've never seen this particular method throw an exception before and I'm
still unable to reproduce this issue.

Is there anything special about your environment?

Does this issue reproduce on any other operating system version (i.e.
other than Windows Server 2008 R2 Standard Service Pack 1)?

Is there a possibility that UTF-8 characters are involved that require more
than two bytes to represent?

anonymous added on 2013-08-30 06:56:46:
> I've never seen this particular method throw an exception before and I'm
> still unable to reproduce this issue.
> Is there anything special about your environment?
I think that it is not special environment. 
The reproducibility of this problem is low. It is not yet reproduce. 

> Does this issue reproduce on any other operating system version (i.e.
> other than Windows Server 2008 R2 Standard Service Pack 1)?
Although the exception of the same message has occurred in Windows7 Professional Standard Service Pack 1, 
it is unknown whether it is the same cause. 

> Is there a possibility that UTF-8 characters are involved that require more
> than two bytes to represent? 
It is not. 
The field of relevance is about four characters of a hexadecimal number (0-F). 

I have a question.
Is there a possibility that occurs when memory pressure?

mistachkin added on 2013-08-31 00:00:56:
In theory, memory pressure could cause an out-of-memory condition.  However, in
that case, I would think a different exception would be thrown (e.g.
OutOfMemoryException), if any.