[sqlite] Sqlite Android Bindings

2018-02-21 Thread Matthew Dumbleton
Hi sqlite users,

Can you help me with this problem?
I have switched a long standing project from using whatever version of sqlite 
is on the device to include the aar file generated by the android bindings 
project. However since the change over I get an 'unknown error (code 14): could 
not open database' and from what I can see that is because the database isn't 
getting created when getReadable/WritableDatabase() is called. Is there a 
different call I should be using in this implementation? To clarify the app 
supports api 14+ so I've had to use the 9+ android bindings project to generate 
the aar and all the db connection stuff worked fine before the switch.

Probably making a rookie mistake but all help appreciated.

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


Re: [sqlite] Android - Occasional Error when closing a database

2013-10-29 Thread Matthew Dumbleton

I insert the data using:

SQLiteStatement myStatement = 
databaseWriter.compileStatement(statementString);

myStatement.executeInsert();

After Richards reply I went back and enclosed all these in try finally 
blocks with myStatement.close(); now in the finally bracket.  Guess I 
missed one somewhere or one wasn't always being called because the 
problem seems to have gone.


Thanks for the replies. (I'm off to hang my head in shame somewhere.)
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Android - Occasional Error when closing a database

2013-10-29 Thread Matthew Dumbleton
I have an android application using sqlite that starts with a database being 
created and then filled with a lot of data.
I have noticed that occasionally, after the data is entered and the transaction 
ended, the close method call produces an error 'unable to close due to 
unfinalised statements' and logCat shows the SQLITE_BUSY error code.
I know this error normally occurs where a Cursor is used and not closed but 
this method doesn't do anything other than insert data.
I managed to work around the problem in two ways, firstly by using the isOpen 
method to loop the close call like so:

finally
{
writer.endTransaction();
while(writer.isOpen())
{
try
{
writer.close();
}
catch(SQLiteException e)
{
if(e.getMessage().contains("unable to close due to 
unfinalised statements"))
{
   //do nothing here, loop to try again
}
else
{
throw e;
}
}
}
and this seems to mean the second time of calling does not error and the 
program continues, but I have been told this is because the second call to 
close doesn't actually do anything.  Is this true?

The second way involves simply adding a thread.sleep after the endTransaction 
and this seems to stop the error ever occuring.  Does this mean the 
endTransaction returns before the actual commit/rollback is complete?/Is there 
another reason why this pause might resolve the issue? (Maybe something to do 
with the way I insert the data?) 

I have already posted this question on stackoverflow under the name 'Android & 
SQLite - Occasional error 'unable to close due to unfinalised statements' if 
anyone wants more explanation or code snippets.

Thanks in advance.
  
___
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 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 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 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 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

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-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-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 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 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-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 <msd...@hotmail.com> 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 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 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 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


[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