DETACHing database after sqlite3_step, but before sqlite3_finalize causes crash in btree.c

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

DETACHing database after sqlite3_step, but before sqlite3_finalize causes crash in btree.c

Damian Slee

Hi,
Don't know yet if this is fixed in the latest version, but I thought I would bring it up anyway.

We are using 3.2.2 library on windows.

Open a database
If you then attach another database
- sqlite3_exec()

Then step a select query, combining some info from tables from both database
- sqlite3_prepare()
- sqlite3_step()
sqlite3_step()
...
But do not keep going till EOF.  Ie. stop before sqlite3_step() returns SQLITE_DONE.  Eg do 3 rows out of 10.

Then detach the database
- sqlite3_exec()

It will crash here in at line 2218 in btree.c:

    pCur->pPrev->pNext = pCur->pNext;


Work arounds are to call sqlite3_finalize on the query (to cleanup) before detaching, or only selecting the top N in the first place.

I don't know the internals well enough to fix it myself..

Regards,

Damian

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.18/86 - Release Date: 31/08/2005
 
Reply | Threaded
Open this post in threaded view
|

Some benchmarks

Robert Simpson
I was quite curious how SQLite stacked up against Firebird and Microsoft's
brand-new Sql Mobile for Windows CE, so I ran some simple
insert/iterate/update tests in C# using VS2005 beta 2 and the ADO.NET 2.0
data provider for SQLite.  SQLite pretty much smoked them, and by smoked I
mean "utter devastation" in all categories.

http://sqlite.phxsoftware.com/forums/9/ShowForum.aspx

Robert


Reply | Threaded
Open this post in threaded view
|

Re: DETACHing database after sqlite3_step, but before sqlite3_finalize causes crash in btree.c

Jay Sprenkle
In reply to this post by Damian Slee
On 9/1/05, Damian Slee <[hidden email]> wrote:
>
>
> Work arounds are to call sqlite3_finalize on the query (to cleanup) before
> detaching, or only selecting the top N in the first place.
>
> I don't know the internals well enough to fix it myself..


Sounds like you found your answers already ;)



---
The Castles of Dereth Calendar: a tour of the art and architecture of
Asheron's Call
http://www.lulu.com/content/77264
Reply | Threaded
Open this post in threaded view
|

RE: DETACHing database after sqlite3_step, but before sqlite3_finalize causes crash in btree.c

Damian Slee
In reply to this post by Damian Slee
Yea, but it should have returned an error code or something, not an access violation.

-----Original Message-----
From: Jay Sprenkle [mailto:[hidden email]]
Sent: Friday, September 02, 2005 9:54 PM
To: [hidden email]
Subject: Re: [sqlite] DETACHing database after sqlite3_step, but before sqlite3_finalize causes crash in btree.c

On 9/1/05, Damian Slee <[hidden email]> wrote:
>
>
> Work arounds are to call sqlite3_finalize on the query (to cleanup)
> before detaching, or only selecting the top N in the first place.
>
> I don't know the internals well enough to fix it myself..


Sounds like you found your answers already ;)



---
The Castles of Dereth Calendar: a tour of the art and architecture of Asheron's Call
http://www.lulu.com/content/77264

--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.18/86 - Release Date: 31/08/2005
 

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.18/86 - Release Date: 31/08/2005