Re: [sqlite] Seemingly random Access violation errors

2012-10-12 Thread Joe Mistachkin

Matthew Dumbleton wrote:
>
> I have tried the new version you mentioned (via the ZIP archive) but this
> doesn't seem to have resolved my issue.
>

I'm working on some more changes that might help if the issue is actually
related
to threads being aborted.

>
> I did remove the abort call previously (after your valid comments)  to
test
> and this made no difference so I'm not sure this is the root of the
problem.
>

Very odd.  Are you able to get a more detailed (native & managed) stack
trace?  Is
this still with the debug build?  I'm also very curious why the assert()
failures
indicating a corrupt heap we saw in the previous debug output are no longer
showing
up.

Heap corruption is probably the root cause of the issue you are seeing.  The
question
is, what is causing it?  Even if the Thread.Abort issue was impacting you,
it would
most likely not manifest itself in a corrupted heap, it would probably just
leak
native resources.

Is the latest interop debug output (with my enhanced diagnostics) any more
revealing?
I would like to see it if you have it saved somewhere because it shows the
connection
associated with the statements being finalized.

> 
> I am simply starting the background thread and then flicking between forms
when
> the crash occurs.
> 

Does the processor on the device being tested support more than one thread
executing
simultaneously?

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors

2012-10-11 Thread Joe Mistachkin

Matthew Dumbleton wrote:
> 
> I have managed to get hold of a HTC HD2 device to do testing on and
> have unfortunately found the error still occurs using the small test
> application I sent you a while back.
> 

I've just made some experimental changes (on the "threadAbortProtect"
branch), primarily to test my theory about Thread.Abort() causing the
issues, here:

http://system.data.sqlite.org/index.html/ci/e553cea4a0 

If these changes correct the problem you are seeing, I will add some
additional tests, and then consider including these changes in the
next release.

You can use "fossil update threadAbortProtect" to get these changes
if you have a working checkout of the repository.  Alternatively, you
can use the "ZIP archive" link on the page above to download them.

Please let me know what the results are with these changes.

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors

2012-10-11 Thread Joe Mistachkin
 
Kevin Benson wrote:
> 
> >
> > Matthew Dumbleton wrote:
> > >
> > > I have managed to get hold of a HTC HD2 device to do testing on and
have
> > > unfortunately found the error still occurs using the small test
> > application
> > > I sent you a while back.
> > >
> >
> > Looking at your sample code again, the use of Thread.Abort could be
causing
> > problems. Here is some additional information on this:
> >
> >
> >
http://stackoverflow.com/questions/421389/is-this-thread-abort-normal-and-sa
> > fe
> >
> > This does not directly explain the access violation; however, it is
> > something
> > to think about.
> >
> >
> 
> Another informative explanation resource:
> 
> http://www.albahari.com/threading/part4.aspx#_Aborting_Threads
> 

Looking at the native resource handling code in System.Data.SQLite, it
occurs to
me that it would not respond well to a Thread.Abort call at the wrong time
(e.g. in
the Open method after the native database handle is returned and before it
is assigned
to the SQLite3 object instance).

In theory, all the code in System.Data.SQLite could be modified to be "safe"
when
confronted with Thread.Abort (i.e. wrap all native resource handling in a
finally
blocks); however, that would be a quite a bit of work for something that
should be a
corner case.

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors

2012-10-11 Thread Kevin Benson
On Thu, Oct 11, 2012 at 6:07 AM, Joe Mistachkin wrote:

>
> Matthew Dumbleton wrote:
> >
> > I have managed to get hold of a HTC HD2 device to do testing on and have
> > unfortunately found the error still occurs using the small test
> application
> > I sent you a while back.
> >
>
> Looking at your sample code again, the use of Thread.Abort could be causing
> problems. Here is some additional information on this:
>
>
> http://stackoverflow.com/questions/421389/is-this-thread-abort-normal-and-sa
> fe
>
> This does not directly explain the access violation; however, it is
> something
> to think about.
>
> --
> Joe Mistachkin
>

Another informative explanation resource:

http://www.albahari.com/threading/part4.aspx#_Aborting_Threads
--
   --
  --
 --Ô¿Ô--
K e V i N
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors

2012-10-11 Thread Joe Mistachkin

Matthew Dumbleton wrote:
> 
> I have managed to get hold of a HTC HD2 device to do testing on and have
> unfortunately found the error still occurs using the small test
application
> I sent you a while back.
> 

Looking at your sample code again, the use of Thread.Abort could be causing
problems.  Here is some additional information on this:

http://stackoverflow.com/questions/421389/is-this-thread-abort-normal-and-sa
fe 

This does not directly explain the access violation; however, it is
something
to think about.

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors

2012-10-11 Thread Joe Mistachkin

Matthew Dumbleton wrote:
> 
> I noticed in your testce code that when the code the threads are running
> ('TestThreadStart()') in the multi-thread test do not seem to 'close()'
> their connections once finished.  Is there a reason for this (i.e. should
> close() not be called?) or is it just part of the test? 
> 

Close ends up being called automatically via Dispose when exiting the
containing
'using' block.

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors

2012-10-11 Thread Joe Mistachkin

Matthew Dumbleton wrote:
>
> Just in case it's of any use I have attached a text file with the end
> of the logging from the HD2 crash.
>

Yes, it is useful.

I've noticed something interesting; however, I'm not 100% sure what it means
given that the output appears to be incomplete.

sqlite3_finalize_interop(): sqlite3_finalize(1713588) returned 0.
<... snip ...>
sqlite3_close_interop(): calling sqlite3_close_v2(1713588)...
sqlite3_close_interop(): sqlite3_close_v2(1713588) returned 0.

It appears that a memory block is first used as a statement and then as a
connection.  This should work fine; however, it does seem to stand out in
the
output.

I've enhanced the diagnostics for the interop assembly to give more detailed
information, here:

http://system.data.sqlite.org/index.html/ci/c826898164

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors (resent)

2012-10-09 Thread Joe Mistachkin

Matthew Dumbleton wrote:
> 
> Yes.  Motorola ES400.  Do have any advice/experience with these? (Apart
from 
> 'don't use them' :)  )
> 

I've added threading tests to the Windows CE test project.  Could you try
running
it on your device and see how it behaves?

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors (resent)

2012-10-08 Thread Matthew Dumbleton

Good point.  Also worth a look.

> From: kevin.m.ben...@gmail.com
> Date: Mon, 8 Oct 2012 12:42:09 -0400
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] Seemingly random Access violation errors (resent)
> 
> On Mon, Oct 8, 2012 at 12:32 PM, Matthew Dumbleton <msd...@hotmail.com>wrote:
> 
> >
> > Thanks Kevin.
> > I will see if I can find some sort of registry hack or something to
> > disable this and see if it makes any difference.
> >
> 
> Actually, you might investigate how to access the RTLog Manager to examine
> the log(s) and see what it might reveal ( after all, it appears as if it
> might be for debugging situations just like your experiencing ;-)
> --
>--
>   --
>  --Ô¿Ô--
> K e V i N
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors (resent)

2012-10-08 Thread Kevin Benson
On Mon, Oct 8, 2012 at 12:32 PM, Matthew Dumbleton wrote:

>
> Thanks Kevin.
> I will see if I can find some sort of registry hack or something to
> disable this and see if it makes any difference.
>

Actually, you might investigate how to access the RTLog Manager to examine
the log(s) and see what it might reveal ( after all, it appears as if it
might be for debugging situations just like your experiencing ;-)
--
   --
  --
 --Ô¿Ô--
K e V i N
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors (resent)

2012-10-08 Thread Matthew Dumbleton

Thanks Kevin.
I will see if I can find some sort of registry hack or something to disable 
this and see if it makes any difference.

> From: kevin.m.ben...@gmail.com
> Date: Mon, 8 Oct 2012 12:14:58 -0400
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] Seemingly random Access violation errors (resent)
> 
> On Mon, Oct 8, 2012 at 11:57 AM, Matthew Dumbleton <msd...@hotmail.com>wrote:
> 
> > Joe,
> >
> > > It's worked on every device that I've used in the past.
> >
> > I hope you see the funny side when I say, this doesn't fill me with a
> > great amount of confidence as according to your previous messages you don't
> > have a device to test on, only emulators. :)
> >
> >
> > > I have no idea what the "rtlogshimeng" DLL is. I tried searching for
> > > references to it on the web to no avail. It might be totally harmless;
> > > however, it seems to be implicated by the debug output.
> >
> > I have no doubt that the dll is harmless as even with a complete reflash
> > of the device it exists. My guess would be that it is a Motorola
> > device-specific library since we cannot find any reference to it and given
> > your comment above (despite my tongue in cheek response.)
> > Still the fact that the problem occurs between another threads
> > sqlite3_finalize() calls and that calling GC.Collect before making a
> > database connection seems to hide the issue doesn't suggest that SQLite is
> > completely exonerated.
> >
> > > Does everything work properly when only a single thread is used?The
> > answer is, no if the only thread doing the database accessing is not the
> > foreground (UI) thread. If you mean, there is literally just a UI thread
> > making database connections in amongst user activity, then (I need to do
> > more testing but) certainly the issue becomes a lot less easy to recreate
> > (i.e. in the small amount of time I've had to test it has not reoccured in
> > those conditions). Unfortunately the app I had in mind requires more than a
> > single thread even if only one thread can access the database at once.
> >
> > Please do not interpret my disappointment as criticism, it is more of a
> > compliment to SQLite that I am so frustrated that I will not be able to
> > take advantage of it.
> >
> > Thank you again for all your help, it was and is greatly appreciated. At
> > least now I know.
> >
> 
> Having seen your mention of Motorola confirms my web search bringing up
> Motorola's Debug Tool known as RT Logs (Retail Tools - system driver
> logs).My guess is that the "rtlogshimeng" DLL reference is related to their
> tool:
> 
> http://goo.gl/sF4hU
> 
> 
> --
>--
>   --
>  --Ô¿Ô--
> K e V i N
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors (resent)

2012-10-08 Thread Kevin Benson
On Mon, Oct 8, 2012 at 11:57 AM, Matthew Dumbleton wrote:

> Joe,
>
> > It's worked on every device that I've used in the past.
>
> I hope you see the funny side when I say, this doesn't fill me with a
> great amount of confidence as according to your previous messages you don't
> have a device to test on, only emulators. :)
>
>
> > I have no idea what the "rtlogshimeng" DLL is. I tried searching for
> > references to it on the web to no avail. It might be totally harmless;
> > however, it seems to be implicated by the debug output.
>
> I have no doubt that the dll is harmless as even with a complete reflash
> of the device it exists. My guess would be that it is a Motorola
> device-specific library since we cannot find any reference to it and given
> your comment above (despite my tongue in cheek response.)
> Still the fact that the problem occurs between another threads
> sqlite3_finalize() calls and that calling GC.Collect before making a
> database connection seems to hide the issue doesn't suggest that SQLite is
> completely exonerated.
>
> > Does everything work properly when only a single thread is used?The
> answer is, no if the only thread doing the database accessing is not the
> foreground (UI) thread. If you mean, there is literally just a UI thread
> making database connections in amongst user activity, then (I need to do
> more testing but) certainly the issue becomes a lot less easy to recreate
> (i.e. in the small amount of time I've had to test it has not reoccured in
> those conditions). Unfortunately the app I had in mind requires more than a
> single thread even if only one thread can access the database at once.
>
> Please do not interpret my disappointment as criticism, it is more of a
> compliment to SQLite that I am so frustrated that I will not be able to
> take advantage of it.
>
> Thank you again for all your help, it was and is greatly appreciated. At
> least now I know.
>

Having seen your mention of Motorola confirms my web search bringing up
Motorola's Debug Tool known as RT Logs (Retail Tools - system driver
logs).My guess is that the "rtlogshimeng" DLL reference is related to their
tool:

http://goo.gl/sF4hU


--
   --
  --
 --Ô¿Ô--
K e V i N
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors (resent)

2012-10-08 Thread Black, Michael (IS)
Can you check the difference in stack size between the emulator and the real 
device?

The emulator could well have a larger default stack size and you're getting 
stack overflow on the real device.


Michael D. Black
Senior Scientist
Advanced Analytics Directorate
Advanced GEOINT Solutions Operating Unit
Northrop Grumman Information Systems


From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Matthew Dumbleton [msd...@hotmail.com]
Sent: Monday, October 08, 2012 11:10 AM
To: sqlite-users@sqlite.org
Subject: EXT :Re: [sqlite] Seemingly random Access violation errors (resent)

Simon,

Apologies if it seems like I'm picking on SQLite.  As previously stated I am 
just disappointed that I don't seem to be able to use it in a simple c# app.  
I'm sure it works great on other platforms/devices etc.  just wanted to get in 
on the act. No insult to c, c++ developers and/or any and all contributors to 
sqlite intended.

I can send you the simple c# app I wrote to recreate the problem if you like 
but from what Joe is saying this is just a device/platform issue I will have to 
accept.  Fair enough.


> From: slav...@bigfraud.org
> Date: Mon, 8 Oct 2012 16:54:00 +0100
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] Seemingly random Access violation errors (resent)
>
>
> On 8 Oct 2012, at 3:54pm, Matthew Dumbleton <msd...@hotmail.com> wrote:
>
> > So does this mean therefore SQLite will not currently work on a compact 
> > framework device? (Or at least not on mine.)
>
> SQLite is distributed as C source code.  It's the .c and .h files you find 
> when you download the amalgamation from
>
> <http://www.sqlite.org/download.html>
>
> You're meant to compile these files into your project and call the C routines 
> directly.  If your preferred programming language can call C routines, it can 
> use the SQLite API.
>
> What you're trying to use is a DLL.  You can by all means complain that a DLL 
> doesn't work, but the DLL is not SQLite, it's someone trying to be helpful 
> and package SQLite into the DLLs some people seem to want, to save them 
> compiling their own.
>
> From reading this thread so far, it seems that you have a bug in your 
> application but it's possible that you've found a bug in a .NET wrapper for 
> SQLite.  Neither of these are SQLite.
>
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors (resent)

2012-10-08 Thread Matthew Dumbleton

Simon,

Apologies if it seems like I'm picking on SQLite.  As previously stated I am 
just disappointed that I don't seem to be able to use it in a simple c# app.  
I'm sure it works great on other platforms/devices etc.  just wanted to get in 
on the act. No insult to c, c++ developers and/or any and all contributors to 
sqlite intended.

I can send you the simple c# app I wrote to recreate the problem if you like 
but from what Joe is saying this is just a device/platform issue I will have to 
accept.  Fair enough.


> From: slav...@bigfraud.org
> Date: Mon, 8 Oct 2012 16:54:00 +0100
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] Seemingly random Access violation errors (resent)
> 
> 
> On 8 Oct 2012, at 3:54pm, Matthew Dumbleton <msd...@hotmail.com> wrote:
> 
> > So does this mean therefore SQLite will not currently work on a compact 
> > framework device? (Or at least not on mine.)
> 
> SQLite is distributed as C source code.  It's the .c and .h files you find 
> when you download the amalgamation from
> 
> <http://www.sqlite.org/download.html>
> 
> You're meant to compile these files into your project and call the C routines 
> directly.  If your preferred programming language can call C routines, it can 
> use the SQLite API.
> 
> What you're trying to use is a DLL.  You can by all means complain that a DLL 
> doesn't work, but the DLL is not SQLite, it's someone trying to be helpful 
> and package SQLite into the DLLs some people seem to want, to save them 
> compiling their own.
> 
> From reading this thread so far, it seems that you have a bug in your 
> application but it's possible that you've found a bug in a .NET wrapper for 
> SQLite.  Neither of these are SQLite.
> 
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors (resent)

2012-10-08 Thread Matthew Dumbleton

Yes.  Motorola ES400.  Do have any advice/experience with these? (Apart from 
'don't use them' :)  )

> From: kevin.m.ben...@gmail.com
> Date: Mon, 8 Oct 2012 11:55:57 -0400
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] Seemingly random Access violation errors (resent)
> 
> On Mon, Oct 8, 2012 at 10:54 AM, Matthew Dumbleton <msd...@hotmail.com>wrote:
> 
> > So does this mean therefore SQLite will not currently work on a compact
> > framework device? (Or at least not on mine.)
> > There's nothing else installed or running apart from the test app I sent
> > you using SQLite and the OS itself. That dll is protected inside the
> > windows directory on the device so I cannot even
> > try removing/renaming it.
> > Since the device isn't crashing on it's own it's presumably some sort of
> > inadvertant call being made as part of the application running, which
> > disappears when SQLite is not referenced.
> > And since Microsoft aren't likely to release any updates to the compact
> > framework I'm not sure where to go with this.
> >
> > > From: sql...@mistachkin.com
> > > To: sqlite-users@sqlite.org
> > > Date: Mon, 8 Oct 2012 06:00:50 -0700
> > > Subject: Re: [sqlite] Seemingly random Access violation errors (resent)
> > >
> > >
> > > Matthew Dumbleton wrote:
> > > >
> > > > Sorry about that. Sent you the attachments properly a while ago and
> > have
> > > > also just sent you a .txt file with the last output from the debugger
> > > > before the access violation crash thanks to your new version.
> > > >
> > >
> > > The start of the trouble seems to be here:
> > >
> > > Data Abort: Thread=8aeec800 Proc=81a374c0 'SQLiteDatabaseEngineTest.exe'
> > > AKY=00010001 PC=7b38a890(netcfagl3_5.dll+0xd890)
> > > RA=7b38a7d0(netcfagl3_5.dll+0xd7d0) BVA=1100 FSR=0005
> > > #$# Exception 0xC005 
> > > #$# Thread procedure: rtlogshimeng.dll!0x000744C8 (in dll)
> > > #$# PC: netcfagl3_5.dll!0xD890 (in dll)
> > > #$# Return address: netcfagl3_5.dll!0xD7D0 (in dll)
> > > #$# Call stack top
> > >
> > > This exception appears to be coming from the .NET Compact Framework
> > itself
> > > on a thread calling into the rtlogshimeng DLL (I'm not sure what this DLL
> > > is for).
> > >
> > > Later on in the debugger output, I see:
> > >
> > > *** ASSERTION FAILED in ../core/sqlite3.c(15799):
> > > pInt[nReserve/sizeof(int)]==(int)0xE4676B53
> > >
> > > This type of assertion failure indicates generalized heap corruption.
> > > After this, nothing in the heap can truly be trusted.
> > >
> > > --
> > > Joe Mistachkin
> 
> 
> Are you having this problem with a Motorola device?
> --
>--
>   --
>  --Ô¿Ô--
> K e V i N
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors (resent)

2012-10-08 Thread Matthew Dumbleton







Joe,

> It's worked on every device that I've used in the past.

I hope you see the funny side when I say, this doesn't fill me with a great 
amount of confidence as according to your previous messages you don't have a 
device to test on, only emulators. :)


> I have no idea what the "rtlogshimeng" DLL is.  I tried searching for
> references to it on the web to no avail.  It might be totally harmless;
> however, it seems to be implicated by the debug output.

I have no doubt that the dll is harmless as even with a complete reflash of the 
device it exists.  My guess would be that it is a Motorola device-specific 
library since we cannot find any reference to it and given your comment above 
(despite my tongue in cheek response.)
Still the fact that the problem occurs between another threads 
sqlite3_finalize() calls and that calling GC.Collect before making a database 
connection seems to hide the issue doesn't suggest that SQLite is completely 
exonerated.

> Does everything work properly when only a single thread is used?The answer 
> is, no if the only thread doing the database accessing is not the foreground 
> (UI) thread.  If you mean, there is literally just a UI thread making 
> database connections in amongst user activity, then (I need to do more 
> testing but) certainly the issue becomes a lot less easy to recreate (i.e. in 
> the small amount of time I've had to test it has not reoccured in those 
> conditions).  Unfortunately the app I had in mind requires more than a single 
> thread even if only one thread can access the database at once.

Please do not interpret my disappointment as criticism, it is more of a 
compliment to SQLite that I am so frustrated that I will not be able to take 
advantage of it.

Thank you again for all your help, it was and is greatly appreciated.  At least 
now I know.


  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors (resent)

2012-10-08 Thread Kevin Benson
On Mon, Oct 8, 2012 at 10:54 AM, Matthew Dumbleton <msd...@hotmail.com>wrote:

> So does this mean therefore SQLite will not currently work on a compact
> framework device? (Or at least not on mine.)
> There's nothing else installed or running apart from the test app I sent
> you using SQLite and the OS itself. That dll is protected inside the
> windows directory on the device so I cannot even
> try removing/renaming it.
> Since the device isn't crashing on it's own it's presumably some sort of
> inadvertant call being made as part of the application running, which
> disappears when SQLite is not referenced.
> And since Microsoft aren't likely to release any updates to the compact
> framework I'm not sure where to go with this.
>
> > From: sql...@mistachkin.com
> > To: sqlite-users@sqlite.org
> > Date: Mon, 8 Oct 2012 06:00:50 -0700
> > Subject: Re: [sqlite] Seemingly random Access violation errors (resent)
> >
> >
> > Matthew Dumbleton wrote:
> > >
> > > Sorry about that. Sent you the attachments properly a while ago and
> have
> > > also just sent you a .txt file with the last output from the debugger
> > > before the access violation crash thanks to your new version.
> > >
> >
> > The start of the trouble seems to be here:
> >
> > Data Abort: Thread=8aeec800 Proc=81a374c0 'SQLiteDatabaseEngineTest.exe'
> > AKY=00010001 PC=7b38a890(netcfagl3_5.dll+0xd890)
> > RA=7b38a7d0(netcfagl3_5.dll+0xd7d0) BVA=1100 FSR=0005
> > #$# Exception 0xC005 
> > #$# Thread procedure: rtlogshimeng.dll!0x000744C8 (in dll)
> > #$# PC: netcfagl3_5.dll!0xD890 (in dll)
> > #$# Return address: netcfagl3_5.dll!0xD7D0 (in dll)
> > #$# Call stack top
> >
> > This exception appears to be coming from the .NET Compact Framework
> itself
> > on a thread calling into the rtlogshimeng DLL (I'm not sure what this DLL
> > is for).
> >
> > Later on in the debugger output, I see:
> >
> > *** ASSERTION FAILED in ../core/sqlite3.c(15799):
> > pInt[nReserve/sizeof(int)]==(int)0xE4676B53
> >
> > This type of assertion failure indicates generalized heap corruption.
> > After this, nothing in the heap can truly be trusted.
> >
> > --
> > Joe Mistachkin


Are you having this problem with a Motorola device?
--
   --
  --
 --Ô¿Ô--
K e V i N
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors (resent)

2012-10-08 Thread Simon Slavin

On 8 Oct 2012, at 3:54pm, Matthew Dumbleton  wrote:

> So does this mean therefore SQLite will not currently work on a compact 
> framework device? (Or at least not on mine.)

SQLite is distributed as C source code.  It's the .c and .h files you find when 
you download the amalgamation from



You're meant to compile these files into your project and call the C routines 
directly.  If your preferred programming language can call C routines, it can 
use the SQLite API.

What you're trying to use is a DLL.  You can by all means complain that a DLL 
doesn't work, but the DLL is not SQLite, it's someone trying to be helpful and 
package SQLite into the DLLs some people seem to want, to save them compiling 
their own.

>From reading this thread so far, it seems that you have a bug in your 
>application but it's possible that you've found a bug in a .NET wrapper for 
>SQLite.  Neither of these are SQLite.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors (resent)

2012-10-08 Thread Joe Mistachkin

Matthew Dumbleton wrote:
>
> So does this mean therefore SQLite will not currently work on a
> compact framework device? (Or at least not on mine.)
> 

It's worked on every device that I've used in the past.

>
> That dll is protected inside the windows directory on the device so I
> cannot even try removing/renaming it.
>

I have no idea what the "rtlogshimeng" DLL is.  I tried searching for
references to it on the web to no avail.  It might be totally harmless;
however, it seems to be implicated by the debug output.

>
> Since the device isn't crashing on it's own it's presumably some sort of
> inadvertant call being made as part of the application running, which
> disappears when SQLite is not referenced.  And since Microsoft aren't
> likely to release any updates to the compact framework I'm not sure where
> to go with this.
>

Does everything work properly when only a single thread is used?

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors (resent)

2012-10-08 Thread Matthew Dumbleton







So does this mean therefore SQLite will not currently work on a compact 
framework device? (Or at least not on mine.)
There's nothing else installed or running apart from the test app I sent you 
using SQLite and the OS itself.  That dll is protected inside the windows 
directory on the device so I cannot even
try removing/renaming it.
Since the device isn't crashing on it's own it's presumably some sort of 
inadvertant call being made as part of the application running, which 
disappears when SQLite is not referenced.
And since Microsoft aren't likely to release any updates to the compact 
framework I'm not sure where to go with this.

> From: sql...@mistachkin.com
> To: sqlite-users@sqlite.org
> Date: Mon, 8 Oct 2012 06:00:50 -0700
> Subject: Re: [sqlite] Seemingly random Access violation errors (resent)
> 
> 
> Matthew Dumbleton wrote:
> > 
> > Sorry about that.  Sent you the attachments properly a while ago and have
> > also just sent you a .txt file with the last output from the debugger
> > before the access violation crash thanks to your new version.
> > 
> 
> The start of the trouble seems to be here:
> 
> Data Abort: Thread=8aeec800 Proc=81a374c0 'SQLiteDatabaseEngineTest.exe'
> AKY=00010001 PC=7b38a890(netcfagl3_5.dll+0xd890)
> RA=7b38a7d0(netcfagl3_5.dll+0xd7d0) BVA=1100 FSR=0005
> #$# Exception 0xC005 
> #$# Thread procedure: rtlogshimeng.dll!0x000744C8 (in dll)
> #$# PC: netcfagl3_5.dll!0xD890 (in dll)
> #$# Return address: netcfagl3_5.dll!0xD7D0 (in dll)
> #$# Call stack top
> 
> This exception appears to be coming from the .NET Compact Framework itself
> on a thread calling into the rtlogshimeng DLL (I'm not sure what this DLL
> is for).
> 
> Later on in the debugger output, I see:
> 
>   *** ASSERTION FAILED in ../core/sqlite3.c(15799):
>   pInt[nReserve/sizeof(int)]==(int)0xE4676B53
> 
> This type of assertion failure indicates generalized heap corruption.
> After this, nothing in the heap can truly be trusted.
> 
> --
> Joe Mistachkin
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors (resent)

2012-10-08 Thread Joe Mistachkin

Matthew Dumbleton wrote:
> 
> Sorry about that.  Sent you the attachments properly a while ago and have
> also just sent you a .txt file with the last output from the debugger
> before the access violation crash thanks to your new version.
> 

The start of the trouble seems to be here:

Data Abort: Thread=8aeec800 Proc=81a374c0 'SQLiteDatabaseEngineTest.exe'
AKY=00010001 PC=7b38a890(netcfagl3_5.dll+0xd890)
RA=7b38a7d0(netcfagl3_5.dll+0xd7d0) BVA=1100 FSR=0005
#$# Exception 0xC005 
#$# Thread procedure: rtlogshimeng.dll!0x000744C8 (in dll)
#$# PC: netcfagl3_5.dll!0xD890 (in dll)
#$# Return address: netcfagl3_5.dll!0xD7D0 (in dll)
#$# Call stack top

This exception appears to be coming from the .NET Compact Framework itself
on a thread calling into the rtlogshimeng DLL (I'm not sure what this DLL
is for).

Later on in the debugger output, I see:

*** ASSERTION FAILED in ../core/sqlite3.c(15799):
pInt[nReserve/sizeof(int)]==(int)0xE4676B53

This type of assertion failure indicates generalized heap corruption.
After this, nothing in the heap can truly be trusted.

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors (resent)

2012-10-08 Thread Matthew Dumbleton

Sorry about that.  Sent you the attachments properly a while ago and have also 
just sent you a .txt file with the last output from the debugger before the 
access violation crash thanks to your new version.

> From: sql...@mistachkin.com
> To: sqlite-users@sqlite.org
> Date: Mon, 8 Oct 2012 04:38:37 -0700
> Subject: Re: [sqlite] Seemingly random Access violation errors (resent)
> 
> 
> Matthew Dumbleton wrote:
> > 
> > Have attached the latest .kdmp and pdbs since you last email/source
> > changes.  Hopefully the dump makes more sense to you than it does to
> > me. Builds were debug builds as requested.
> > 
> 
> There were no attachments to your message that I saw.  Also, were you
> able to capture the extra diagnostic output in the debugger?  It should
> be visible in the Debug Output Window.  In order to see it, you may need
> to attach to the target process on the device using the native debugging.
> 
> P.S. Apparently, my SMTP server is now being blocked by Hotmail and I am
> unable to send you direct mail.
> 
> --
> Joe Mistachkin
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access violation errors (resent)

2012-10-08 Thread Joe Mistachkin

Matthew Dumbleton wrote:
> 
> Have attached the latest .kdmp and pdbs since you last email/source
> changes.  Hopefully the dump makes more sense to you than it does to
> me. Builds were debug builds as requested.
> 

There were no attachments to your message that I saw.  Also, were you
able to capture the extra diagnostic output in the debugger?  It should
be visible in the Debug Output Window.  In order to see it, you may need
to attach to the target process on the device using the native debugging.

P.S. Apparently, my SMTP server is now being blocked by Hotmail and I am
unable to send you direct mail.

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-10-08 Thread Matthew Dumbleton


Joe,

Have done as you said and reproduced the issue.  Have sent you direct the 
relevant pdbs and kdmp from the latest crash.


> From: sql...@mistachkin.com
> To: sqlite-users@sqlite.org
> Date: Mon, 8 Oct 2012 02:24:08 -0700
> Subject: Re: [sqlite] Seemingly random Access Violation errors
> 
> 
> I've just added some extra diagnostics to the debug build of the native
> interop assembly ("SQLite.Interop.dll"), could you update your local
> sources, compile everything in the debug build configuration, and then
> try to reproduce the problem?
> 
> --
> Joe Mistachkin
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-10-08 Thread Joe Mistachkin

I've just added some extra diagnostics to the debug build of the native
interop assembly ("SQLite.Interop.dll"), could you update your local
sources, compile everything in the debug build configuration, and then
try to reproduce the problem?

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-10-07 Thread Joe Mistachkin

Matthew Dumbleton wrote:
>
> Currently using version 83.  Is this correct? Started on 82.
>

I assume you are building from the source code in the repository then?

Are you using the included (built from source) "SQLite.Interop.dll" or
a standard Win32 "sqlite3.dll" with the managed assembly?  What command
line and/or options are you using when building the binaries?  Are any
custom extensions to SQLite being used?

>
> Will give the device a factory reset to be sure but manually deleted
> previous copy of dll on the device before compiling the version with
> your last set of changes (managed to find where to download the whole
> of the source code this time.)
>

Resetting the device may "fix" the issue if it resulted from a corrupt
.NET Compact Framework installation or similar issue; however, do you
think that is likely?

>
> Would it help at all if I sent you the .kdmp files produced when the 
> crash occurs? You might be able to make more sense of them than me.
> 

If you send it along with the built binaries and their associated PDB
files I may be able to determine something, yes.

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-10-07 Thread Matthew Dumbleton
Currently using version 83.  Is this correct? Started on 82.  Will give 
the device a factory reset to be sure but manually deleted previous copy 
of dll on the device before compiling the version with your last set of 
changes (managed to find where to download the whole of the source code 
this time.)
Would it help at all if I sent you the .kdmp files produced when the 
crash occurs? You might be able to make more sense of them than me.


On 06/10/2012 07:11, Joe Mistachkin wrote:

Joe Mistachkin wrote:
  
I do not have a real device to test the code on.  Also, the project you

sent is

targeted to a different emulator version than the ones I currently have

available.

I'll try to manually retarget the project tonight and try to reproduce the

issue

in more detail.


I am not able to reproduce the issue by running the sample code you sent in
the
emulator against the latest trunk code.

Are you sure that you are using a System.Data.SQLite DLL compiled from the
latest
code in the source repository and not accidentally using some other DLL that
may be
present on the target system?  One of the reasons I'm asking is because I
noticed
the System.Data.SQLite DLLs you sent were version 82, which they would not
be if
they were compiled from the code in trunk.

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users




___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-10-06 Thread Joe Mistachkin

Joe Mistachkin wrote:
>  
> I do not have a real device to test the code on.  Also, the project you
sent is
> targeted to a different emulator version than the ones I currently have
available.
> I'll try to manually retarget the project tonight and try to reproduce the
issue
> in more detail.
> 

I am not able to reproduce the issue by running the sample code you sent in
the
emulator against the latest trunk code.

Are you sure that you are using a System.Data.SQLite DLL compiled from the
latest
code in the source repository and not accidentally using some other DLL that
may be
present on the target system?  One of the reasons I'm asking is because I
noticed
the System.Data.SQLite DLLs you sent were version 82, which they would not
be if
they were compiled from the code in trunk.

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-10-05 Thread Joe Mistachkin

Matthew Dumbleton wrote:
>
> I'm afraid this doesn't seem to fix the issue.  
> 

Odd, it seemed like a disposal race condition.  I thought the additional
locking
semantics would fix it.  On the desktop versions of the .NET Framework,
there is
an actual CriticalHandle class and the necessary overload of the interlocked
exchange method that may be used to avoid using locks during finalization.

> 
> Just out of interest are you able to run the code I sent on a real device
or in
> an emulator?  I'm testing on a Motorola ES400 and didn't initially think
to try
> switching to the emulator which doesn't seem to throw the error (still
testing
> though.)
> 

I do not have a real device to test the code on.  Also, the project you sent
is
targeted to a different emulator version than the ones I currently have
available.
I'll try to manually retarget the project tonight and try to reproduce the
issue
in more detail.

>
> Don't know if it's relevant but I seem to 'fix' the issue if I call a
GC.Collect
> before every connection to the database.  But of course this could just be
> because it runs slower when doing this and in any case probably not good
practice.
>

It's relevant to the extent that the whole issue seems to be a disposal
and/or
finalization related race condition.  Calling GC.Collect forces all
'unreachable'
objects to be garbage collected immediately.

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-10-05 Thread Matthew Dumbleton

Michael,

Completely agree with your conclusion the GC.Collect is pretty much a plaster 
over a severed limb, it's just hiding the problem rather than solving it.  Just 
mentioned it in case that gave Joe any ideas.
My code is all c# and the link privided I believe is a c++ only feature.  I 
would imagine Joe is already using this.
Hopefully, as I'm using c#, it should be pretty difficult for me to create a 
problem like that you described in a 'high level' language where most memory 
management is out of my hands. But if you know of/could provide any c# examples
of this I'll check my code.

> From: michael.bla...@ngc.com
> To: sqlite-users@sqlite.org
> Date: Fri, 5 Oct 2012 14:04:59 +
> Subject: Re: [sqlite] Seemingly random Access Violation errors
> 
> It would seem to me that if GC.Collect fixes the problem than all you've done 
> is move the problem to someplace else that isn't fatal (at the moment) and 
> could rear its ugly head at most any time.
> 
> The reason your emulator doesn't throw the error would be for the same 
> reason...different memory allocation strategies.
> 
> When you run GC.Collect you're going to reclaim lots of small memory blocks 
> which will separate the locations more.  Without GC.Collect you're probably 
> getting sequential memory blocks which show up as access violations due to 
> adjacent memory abuse.  You're just lucky you see the error at all.
> 
> I believe you have a buffer overwrite occurring somewhere.
> 
> Have you tried the run-time checks to see it they can help pinpoint it?
> http://msdn.microsoft.com/en-us/library/aa290051.aspx#vctchcompilersecuritychecksindepthanchor4
> 
> 
> Michael D. Black
> Senior Scientist
> Advanced Analytics Directorate
> Advanced GEOINT Solutions Operating Unit
> Northrop Grumman Information Systems
> 
> 
> From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
> behalf of Matthew Dumbleton [msd...@hotmail.com]
> Sent: Friday, October 05, 2012 5:46 AM
> To: sqlite-users@sqlite.org
> Subject: EXT :Re: [sqlite] Seemingly random Access Violation errors
> 
> Joe,
> 
> I'm afraid this doesn't seem to fix the issue.
> Just out of interest are you able to run the code I sent on a real device or 
> in an emulator? I'm testing on a Motorola ES400 and didn't initially think to 
> try switching to the emulator which doesn't seem to throw the error (still 
> testing though.)
> Don't know if it's relevant but I seem to 'fix' the issue if I call a 
> GC.Collect before every connection to the database.  But of course this could 
> just be because it runs slower when doing this and in any case probably not 
> good practice.
> Will continue to test.
> 
> > From: sql...@mistachkin.com
> > To: sqlite-users@sqlite.org
> > Date: Thu, 4 Oct 2012 17:20:18 -0700
> > Subject: Re: [sqlite] Seemingly random Access Violation errors
> >
> >
> > Matthew Dumbleton wrote:
> > >
> > > I have tried this change and I'm afraid it hasn't stopped the crashes.
> > >
> >
> > I've further refined the locking semantics for the .NET Compact Framework
> > build here:
> >
> >   https://system.data.sqlite.org/index.html/info/ac5f4cc084
> >
> > I think this should correct the problem, although I'm not actually able to
> > reproduce
> > the problem here.
> >
> > --
> > Joe Mistachkin
> >
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-10-05 Thread Black, Michael (IS)
It would seem to me that if GC.Collect fixes the problem than all you've done 
is move the problem to someplace else that isn't fatal (at the moment) and 
could rear its ugly head at most any time.

The reason your emulator doesn't throw the error would be for the same 
reason...different memory allocation strategies.

When you run GC.Collect you're going to reclaim lots of small memory blocks 
which will separate the locations more.  Without GC.Collect you're probably 
getting sequential memory blocks which show up as access violations due to 
adjacent memory abuse.  You're just lucky you see the error at all.

I believe you have a buffer overwrite occurring somewhere.

Have you tried the run-time checks to see it they can help pinpoint it?
http://msdn.microsoft.com/en-us/library/aa290051.aspx#vctchcompilersecuritychecksindepthanchor4


Michael D. Black
Senior Scientist
Advanced Analytics Directorate
Advanced GEOINT Solutions Operating Unit
Northrop Grumman Information Systems


From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Matthew Dumbleton [msd...@hotmail.com]
Sent: Friday, October 05, 2012 5:46 AM
To: sqlite-users@sqlite.org
Subject: EXT :Re: [sqlite] Seemingly random Access Violation errors

Joe,

I'm afraid this doesn't seem to fix the issue.
Just out of interest are you able to run the code I sent on a real device or in 
an emulator? I'm testing on a Motorola ES400 and didn't initially think to try 
switching to the emulator which doesn't seem to throw the error (still testing 
though.)
Don't know if it's relevant but I seem to 'fix' the issue if I call a 
GC.Collect before every connection to the database.  But of course this could 
just be because it runs slower when doing this and in any case probably not 
good practice.
Will continue to test.

> From: sql...@mistachkin.com
> To: sqlite-users@sqlite.org
> Date: Thu, 4 Oct 2012 17:20:18 -0700
> Subject: Re: [sqlite] Seemingly random Access Violation errors
>
>
> Matthew Dumbleton wrote:
> >
> > I have tried this change and I'm afraid it hasn't stopped the crashes.
> >
>
> I've further refined the locking semantics for the .NET Compact Framework
> build here:
>
>   https://system.data.sqlite.org/index.html/info/ac5f4cc084
>
> I think this should correct the problem, although I'm not actually able to
> reproduce
> the problem here.
>
> --
> Joe Mistachkin
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-10-05 Thread Matthew Dumbleton




Joe,

I'm afraid this doesn't seem to fix the issue.  
Just out of interest are you able to run the code I sent on a real device or in 
an emulator? I'm testing on a Motorola ES400 and didn't initially think to try 
switching to the emulator which doesn't seem to throw the error (still testing 
though.)
Don't know if it's relevant but I seem to 'fix' the issue if I call a 
GC.Collect before every connection to the database.  But of course this could 
just be because it runs slower when doing this and in any case probably not 
good practice.
Will continue to test.

> From: sql...@mistachkin.com
> To: sqlite-users@sqlite.org
> Date: Thu, 4 Oct 2012 17:20:18 -0700
> Subject: Re: [sqlite] Seemingly random Access Violation errors
> 
> 
> Matthew Dumbleton wrote:
> >
> > I have tried this change and I'm afraid it hasn't stopped the crashes.
> >
> 
> I've further refined the locking semantics for the .NET Compact Framework
> build here:
> 
>   https://system.data.sqlite.org/index.html/info/ac5f4cc084
> 
> I think this should correct the problem, although I'm not actually able to
> reproduce
> the problem here.
> 
> --
> Joe Mistachkin
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-10-04 Thread Joe Mistachkin

Matthew Dumbleton wrote:
>
> I have tried this change and I'm afraid it hasn't stopped the crashes.
>

I've further refined the locking semantics for the .NET Compact Framework
build here:

https://system.data.sqlite.org/index.html/info/ac5f4cc084

I think this should correct the problem, although I'm not actually able to
reproduce
the problem here.

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-10-04 Thread Matthew Dumbleton


I have tried this change and I'm afraid it hasn't stopped the crashes.
Just to confirm though, I copied the code changes to 'UnsafeNativeMethods.cs' 
into the 1.0.82.0 project by hand as I couldn't see anywhere to download the 
new source code as a whole.  
Was this correct or did I miss something? (Don't know if there are other 
crucial changes elsewhere in the source code.)


> From: sql...@mistachkin.com
> To: sqlite-users@sqlite.org
> Date: Thu, 4 Oct 2012 04:27:47 -0700
> Subject: Re: [sqlite] Seemingly random Access Violation errors
> 
> 
> Matthew Dumbleton wrote:
> >
> > Attached is a small project that should recreate the issues I'm having. 
> >
> 
> Could you try the following change and let us know if it works for you?
> 
>   http://system.data.sqlite.org/index.html/ci/b8212344a0
> 
> --
> Joe Mistachkin
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-10-04 Thread Joe Mistachkin

Matthew Dumbleton wrote:
>
> Attached is a small project that should recreate the issues I'm having. 
>

Could you try the following change and let us know if it works for you?

http://system.data.sqlite.org/index.html/ci/b8212344a0

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-10-03 Thread Joe Mistachkin

Matthew Dumbleton wrote:
> 
> Joe, I have tried sending the attachment to you direct but I guess 
> otherwise the answer to..
> 

I received the attachment and I'll look into it.

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-10-03 Thread Matthew Dumbleton

Oh.
Joe, I have tried sending the attachment to you direct but I guess 
otherwise the answer to..


'Could you provide some sample C# code that demonstrates the issue?' -- 
Joe Mistachkin


...is, no.

On 03/10/2012 14:25, Simon Slavin wrote:

On 2 Oct 2012, at 7:40pm, Matthew Dumbleton  wrote:


I have attached a small project

Sorry but attachments don't work with posts to this list.  We don't want 
everyone sending us their homework and killing our byte caps.  Could you put 
your work on a server somewhere and post a pointer ?

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users




___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-10-03 Thread Simon Slavin

On 2 Oct 2012, at 7:40pm, Matthew Dumbleton  wrote:

> I have attached a small project

Sorry but attachments don't work with posts to this list.  We don't want 
everyone sending us their homework and killing our byte caps.  Could you put 
your work on a server somewhere and post a pointer ?

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-10-03 Thread Matthew Dumbleton
I have attached a small project with which you should be able to see the 
issue I am having.

Thanks in advance for taking the time to look.


On 26/09/2012 23:47, Joe Mistachkin wrote:

Matthew Dumbleton wrote:

Sorry, should have highlighted this better in my initial message. Started
out using 1.0.56.0 and changed to 1.0.82.0, however problem remains.


I'm unable to reproduce the issue here using the latest version.  Could you
provide some sample C# code that demonstrates the issue?

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users




___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-09-27 Thread Matthew Dumbleton
Ok. Will try and write a simpler version to pass on to you asap.

From: Joe Mistachkin
Sent: 26/09/2012 23:47
To: 'General Discussion of SQLite Database'
Subject: Re: [sqlite] Seemingly random Access Violation errors


Matthew Dumbleton wrote:
>
> Sorry, should have highlighted this better in my initial message. Started
> out using 1.0.56.0 and changed to 1.0.82.0, however problem remains.
>

I'm unable to reproduce the issue here using the latest version.  Could you
provide some sample C# code that demonstrates the issue?

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-09-26 Thread Joe Mistachkin

Matthew Dumbleton wrote:
>
> Sorry, should have highlighted this better in my initial message. Started
> out using 1.0.56.0 and changed to 1.0.82.0, however problem remains.
>

I'm unable to reproduce the issue here using the latest version.  Could you
provide some sample C# code that demonstrates the issue?

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-09-26 Thread Matthew Dumbleton
Sorry, should have highlighted this better in my initial message. Started out 
using 1.0.56.0 and changed to 1.0.82.0, however problem remains.

From: Joe Mistachkin
Sent: 26/09/2012 21:42
To: 'General Discussion of SQLite Database'
Subject: Re: [sqlite] Seemingly random Access Violation errors


Matthew Dumbleton wrote:
>
>  at UnsafeNativeMethods.sqlite3_close_interop(IntPtr db)
>  at SQLiteBase.CloseConnection(SQLiteConnectionHandle db)
>  at SQLiteConnectionHandle.ReleaseHandle()
>  at CriticalHandle.Cleanup()
>  at CriticalHandle.Dispose(Boolean disposing)
>  at CriticalHandle.Dispose()
>  at SQLite3.Close()
>  at SQLiteConnection.Close()
>
> Yes. Each time either thread connects a new sqliteconnection instance is
created.
> I use a mutex protected static method through which both threads do their
database
> connections in order to ensure database is accessed by only one thread at
a time.
>

I just noticed that the method signature for CloseConnection in the above
stack trace
is outdated.  The most recent versions have the following signature:

internal static void CloseConnection(SQLiteConnectionHandle hdl,
IntPtr db)

Could you please try using the latest release version (1.0.82.0) or the
latest code
in trunk and see if that clears the issue.

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-09-26 Thread Joe Mistachkin

Matthew Dumbleton wrote:
>
>  at UnsafeNativeMethods.sqlite3_close_interop(IntPtr db)
>  at SQLiteBase.CloseConnection(SQLiteConnectionHandle db)
>  at SQLiteConnectionHandle.ReleaseHandle()
>  at CriticalHandle.Cleanup()
>  at CriticalHandle.Dispose(Boolean disposing)
>  at CriticalHandle.Dispose()
>  at SQLite3.Close()
>  at SQLiteConnection.Close()
>
> Yes. Each time either thread connects a new sqliteconnection instance is
created.
> I use a mutex protected static method through which both threads do their
database
> connections in order to ensure database is accessed by only one thread at
a time.
>

I just noticed that the method signature for CloseConnection in the above
stack trace
is outdated.  The most recent versions have the following signature:

internal static void CloseConnection(SQLiteConnectionHandle hdl,
IntPtr db)

Could you please try using the latest release version (1.0.82.0) or the
latest code
in trunk and see if that clears the issue.

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-09-26 Thread Matthew Dumbleton
Yes. Each time either thread connects a new sqliteconnection instance is 
created. I use a mutex protected static method through which both threads do 
their database connections in order to ensure database is accessed by only one 
thread at a time.

From: Joe Mistachkin
Sent: 26/09/2012 20:54
To: 'General Discussion of SQLite Database'
Subject: Re: [sqlite] Seemingly random Access Violation errors


Matthew Dumbleton wrote:
>
>  at UnsafeNativeMethods.sqlite3_close_interop(IntPtr db)
>  at SQLiteBase.CloseConnection(SQLiteConnectionHandle db)
>  at SQLiteConnectionHandle.ReleaseHandle()
>  at CriticalHandle.Cleanup()
>  at CriticalHandle.Dispose(Boolean disposing)
>  at CriticalHandle.Dispose()
>  at SQLite3.Close()
>  at SQLiteConnection.Close()
>
>

Are you using a new SQLiteConnection object instance on each thread?

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Seemingly random Access Violation errors

2012-09-26 Thread Joe Mistachkin

Matthew Dumbleton wrote:
>
>  at UnsafeNativeMethods.sqlite3_close_interop(IntPtr db)
>  at SQLiteBase.CloseConnection(SQLiteConnectionHandle db)
>  at SQLiteConnectionHandle.ReleaseHandle()
>  at CriticalHandle.Cleanup()
>  at CriticalHandle.Dispose(Boolean disposing)
>  at CriticalHandle.Dispose()
>  at SQLite3.Close()
>  at SQLiteConnection.Close()
>   
>

Are you using a new SQLiteConnection object instance on each thread?

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Seemingly random Access Violation errors

2012-09-26 Thread Matthew Dumbleton

I'm currently trying to write an app for the compact framework (3.5) using an 
sqlite database in c#.
The application is occasionally throwing up odd Access Violation errors, 
crashing the application.  
Getting precious little from the crash dumps produced but from experimentation 
it seems that the error occurs when the background thread accesses the database 
while the foreground thread switches between forms. (Increasing the speed of 
the background thread and continually opening and closing forms in the 
foreground make the crash more frequent).  
Does anyone know of any issues with sqlite/garbage collection/the compact 
framework that could cause this?  Any common coding mistakes I could be making 
in declaring the connections that could cause this?
Have tried two versions of SQLite. 1.0.56.0 and 1.0.82.0 but both have same 
results.
Switching the database to sqlce seems to fix the issue but really don't want to 
do that if possible.
Also read one old comment on a support site that suggested it was essential to 
keep sqliteconnections in using blocks to avoid a similar issue but this has 
had no effect in this case.

Don't know if the following helps:

ExceptionCode: 0xc005
ExceptionAddress: 0x03f6bba8
Reading: 0x0010
Faulting module: coredll.dll
Offset: 0x00022ba8

   at UnsafeNativeMethods.sqlite3_close_interop(IntPtr db)
   at SQLiteBase.CloseConnection(SQLiteConnectionHandle db)
   at SQLiteConnectionHandle.ReleaseHandle()
   at CriticalHandle.Cleanup()
   at CriticalHandle.Dispose(Boolean disposing)
   at CriticalHandle.Dispose()
   at SQLite3.Close()
   at SQLiteConnection.Close()

Any input welcome.
  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users