Re: [sqlite] Assertion failure in SQLite 3.7.3 (new vs. 3.6.23.1)

2010-12-04 Thread Philip Graham Willoughby
On 4 Dec 2010, at 10:42, Dan Kennedy wrote:

> On 12/04/2010 12:54 AM, Philip Graham Willoughby wrote:
>> On 2 Dec 2010, at 20:43, Sylvain Pointeau wrote:
>> 
>>> Hi,
>>> 
>>> I am on macosx sqlite 3.7.3
>>> 
>>> $ /usr/local/bin/sqlite3 test.db3
>>> SQLite version 3.7.3
>>> Enter ".help" for instructions
>>> Enter SQL statements terminated with a ";"
>>> sqlite>  .read ./testSchema.sql
>>> sqlite>  .read ./TestValues.sql
>>> sqlite>  .read ./TestQuery.sql
>>> Otterbourne Golf Course|Jane Doe|Assumed Name
>>> 
>>> it works for me.
>> 
>> By default, assertions are not built - did you build with SQLITE_DEBUG? 
>> Assuming you did, what were your other build flags and which compiler did 
>> you use?
> 
> Thanks for following up on this - your post on the 26th of last
> month slipped through a crack...
> 
> Turns out the bug is in the assert(), not the production code, so
> there is no problem in non-SQLITE_DEBUG builds. It's now fixed for
> 3.7.4.

Brilliant news, thank you for looking into it.

Best Regards,

Phil Willoughby
-- 
Managing Director, StrawberryCat Limited

StrawberryCat Limited is registered in England and Wales with Company No. 
7234809.

The registered office address of StrawberryCat Limited is:

107 Morgan Le Fay Drive
Eastleigh
SO53 4JH

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


Re: [sqlite] Assertion failure in SQLite 3.7.3 (new vs. 3.6.23.1)

2010-12-04 Thread Dan Kennedy
On 12/04/2010 12:54 AM, Philip Graham Willoughby wrote:
> On 2 Dec 2010, at 20:43, Sylvain Pointeau wrote:
>
>> Hi,
>>
>> I am on macosx sqlite 3.7.3
>>
>> $ /usr/local/bin/sqlite3 test.db3
>> SQLite version 3.7.3
>> Enter ".help" for instructions
>> Enter SQL statements terminated with a ";"
>> sqlite>  .read ./testSchema.sql
>> sqlite>  .read ./TestValues.sql
>> sqlite>  .read ./TestQuery.sql
>> Otterbourne Golf Course|Jane Doe|Assumed Name
>>
>> it works for me.
>
> By default, assertions are not built - did you build with SQLITE_DEBUG? 
> Assuming you did, what were your other build flags and which compiler did you 
> use?

Thanks for following up on this - your post on the 26th of last
month slipped through a crack...

Turns out the bug is in the assert(), not the production code, so
there is no problem in non-SQLITE_DEBUG builds. It's now fixed for
3.7.4.


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


Re: [sqlite] Assertion failure in SQLite 3.7.3 (new vs. 3.6.23.1)

2010-12-04 Thread Sylvain Pointeau
sorry yes I didn't compile with SQLITE_DEBUG
I just did it, and I have the same error:

$ /usr/local/bin/sqlite3 tst.db3
SQLite version 3.7.3
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .read ./testSchema.sql
sqlite> .read ./TestValues.sql
sqlite> .read ./TestQuery.sql
Assertion failed: (memIsValid(&u.bq.r.aMem[i])), function sqlite3VdbeExec,
file sqlite3.c, line 64507.
Abort trap


On Sat, Dec 4, 2010 at 11:20 AM, Sylvain Pointeau <
sylvain.point...@gmail.com> wrote:

> I used:
> CFLAGS='-arch i686 -arch x86_64' LDFLAGS='-arch i686 -arch x86_64'
> ./configure --disable-dependency-tracking
>
> my compiler is:
> $ gcc --version
> i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)
> Copyright (C) 2007 Free Software Foundation, Inc.
>
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Assertion failure in SQLite 3.7.3 (new vs. 3.6.23.1)

2010-12-04 Thread Sylvain Pointeau
I used:
CFLAGS='-arch i686 -arch x86_64' LDFLAGS='-arch i686 -arch x86_64'
./configure --disable-dependency-tracking

my compiler is:
$ gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)
Copyright (C) 2007 Free Software Foundation, Inc.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Assertion failure in SQLite 3.7.3 (new vs. 3.6.23.1)

2010-12-03 Thread Philip Graham Willoughby
On 2 Dec 2010, at 20:43, Sylvain Pointeau wrote:

> Hi,
> 
> I am on macosx sqlite 3.7.3
> 
> $ /usr/local/bin/sqlite3 test.db3
> SQLite version 3.7.3
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite> .read ./testSchema.sql
> sqlite> .read ./TestValues.sql
> sqlite> .read ./TestQuery.sql
> Otterbourne Golf Course|Jane Doe|Assumed Name
> 
> it works for me.

By default, assertions are not built - did you build with SQLITE_DEBUG? 
Assuming you did, what were your other build flags and which compiler did you 
use?

Best Regards,

Phil Willoughby
-- 
Managing Director, StrawberryCat Limited

StrawberryCat Limited is registered in England and Wales with Company No. 
7234809.

The registered office address of StrawberryCat Limited is:

107 Morgan Le Fay Drive
Eastleigh
SO53 4JH

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


Re: [sqlite] Assertion failure in SQLite 3.7.3 (new vs. 3.6.23.1)

2010-12-02 Thread Sylvain Pointeau
Hi,

I am on macosx sqlite 3.7.3

$ /usr/local/bin/sqlite3 test.db3
SQLite version 3.7.3
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .read ./testSchema.sql
sqlite> .read ./TestValues.sql
sqlite> .read ./TestQuery.sql
Otterbourne Golf Course|Jane Doe|Assumed Name

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


Re: [sqlite] Assertion failure in SQLite 3.7.3 (new vs. 3.6.23.1)

2010-12-02 Thread Philip Graham Willoughby
On 26 Nov 2010, at 10:28, Philip Graham Willoughby wrote:

> On 25 Nov 2010, at 14:06, Dan Kennedy wrote:
> 
>> On 11/25/2010 03:45 PM, Philip Graham Willoughby wrote:
>>> Hi all,
>>> 
>>> I'm noticing a new failure with SQLite 3.7.3 as compared to the previous 
>>> version I was using, 3.6.23.1.
>> 
>> Are you able to share the database and the query that causes
>> the assert() to fail?
> 
> Here is a database and the query which causes the assert to fail:
> 
> Database:   http://dl.dropbox.com/u/10341475/SQLiteAssertionFailure/Test.base
> Query SQL:  
> http://dl.dropbox.com/u/10341475/SQLiteAssertionFailure/TestQuery.sql
> 
> If for any reason you wanted to recreate the DB the SQL to do so are these:
> 
> Schema SQL: 
> http://dl.dropbox.com/u/10341475/SQLiteAssertionFailure/testSchema.sql
> Data SQL:   
> http://dl.dropbox.com/u/10341475/SQLiteAssertionFailure/TestValues.sql
> 
> My original schema is somewhat more complex so I have cut out some parts 
> which are not relevant to this problem. In attempting to create a cut-down 
> version I also tried removing players 2 and 3 from the CardsPlayers and 
> CardsPlayer[AB] tables, which caused the query to run successfully. I cannot 
> tell from that whether the problem is triggered by the presence of any values 
> in those tables or by the presence of relevant values in those tables.
> 
> With a new empty database and these SQL statements with SQLite version 3.6.12 
> (or 3.7.3 without SQLITE_DEBUG) I see this:
> 
> SQLite version 3.6.12
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite> .read ./testSchema.sql
> sqlite> .read ./TestValues.sql
> sqlite> .read ./TestQuery.sql
> Otterbourne Golf Course|Jane Doe|Assumed Name
> sqlite> 
> 
> With a new empty database and these SQL statements with SQLite version 3.7.3 
> (with SQLITE_DEBUG) I see this:
> 
> SQLite version 3.7.3
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite> .read ./testSchema.sql
> sqlite> .read ./TestValues.sql
> sqlite> .read ./TestQuery.sql
> Assertion failed: (memIsValid(&u.bq.r.aMem[i])), function sqlite3VdbeExec, 
> file sqlite3.c, line 64507.
> Abort
> 
> SQLite 3.7.3 fails in that manner when I run just the query on the 3.6.12 
> database; similarly SQLite 3.6.12 gets the right answer when it queries the 
> 3.7.3 database. I infer from this that the data stored is fine it's just a 
> problem at query-time.

I apologise for repeating my earlier message (above), but I didn't see any 
responses to it on the list so I'm beginning to wonder if it actually made it 
out of my email client.

I'd appreciate any feedback; even knowing whether it is or is not reproducible 
by others would be very helpful.

If this is a reproducible bug, is there anything else I need to do to report it?

Best Regards,

Phil Willoughby
-- 
Managing Director, StrawberryCat Limited

StrawberryCat Limited is registered in England and Wales with Company No. 
7234809.

The registered office address of StrawberryCat Limited is:

107 Morgan Le Fay Drive
Eastleigh
SO53 4JH

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


Re: [sqlite] Assertion failure in SQLite 3.7.3 (new vs. 3.6.23.1)

2010-11-26 Thread Philip Graham Willoughby
On 25 Nov 2010, at 14:06, Dan Kennedy wrote:

> On 11/25/2010 03:45 PM, Philip Graham Willoughby wrote:
>> Hi all,
>> 
>> I'm noticing a new failure with SQLite 3.7.3 as compared to the previous 
>> version I was using, 3.6.23.1.
> 
> Are you able to share the database and the query that causes
> the assert() to fail?

Here is a database and the query which causes the assert to fail:

Database:   http://dl.dropbox.com/u/10341475/SQLiteAssertionFailure/Test.base
Query SQL:  
http://dl.dropbox.com/u/10341475/SQLiteAssertionFailure/TestQuery.sql

If for any reason you wanted to recreate the DB the SQL to do so are these:

Schema SQL: 
http://dl.dropbox.com/u/10341475/SQLiteAssertionFailure/testSchema.sql
Data SQL:   
http://dl.dropbox.com/u/10341475/SQLiteAssertionFailure/TestValues.sql

My original schema is somewhat more complex so I have cut out some parts which 
are not relevant to this problem. In attempting to create a cut-down version I 
also tried removing players 2 and 3 from the CardsPlayers and CardsPlayer[AB] 
tables, which caused the query to run successfully. I cannot tell from that 
whether the problem is triggered by the presence of any values in those tables 
or by the presence of relevant values in those tables.

With a new empty database and these SQL statements with SQLite version 3.6.12 
(or 3.7.3 without SQLITE_DEBUG) I see this:

SQLite version 3.6.12
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .read ./testSchema.sql
sqlite> .read ./TestValues.sql
sqlite> .read ./TestQuery.sql
Otterbourne Golf Course|Jane Doe|Assumed Name
sqlite> 

With a new empty database and these SQL statements with SQLite version 3.7.3 
(with SQLITE_DEBUG) I see this:

SQLite version 3.7.3
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .read ./testSchema.sql
sqlite> .read ./TestValues.sql
sqlite> .read ./TestQuery.sql
Assertion failed: (memIsValid(&u.bq.r.aMem[i])), function sqlite3VdbeExec, file 
sqlite3.c, line 64507.
Abort

SQLite 3.7.3 fails in that manner when I run just the query on the 3.6.12 
database; similarly SQLite 3.6.12 gets the right answer when it queries the 
3.7.3 database. I infer from this that the data stored is fine it's just a 
problem at query-time.

Best Regards,

Phil Willoughby
-- 
Managing Director, StrawberryCat Limited

StrawberryCat Limited is registered in England and Wales with Company No. 
7234809.

The registered office address of StrawberryCat Limited is:

107 Morgan Le Fay Drive
Eastleigh
SO53 4JH

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


Re: [sqlite] Assertion failure in SQLite 3.7.3 (new vs. 3.6.23.1)

2010-11-25 Thread Dan Kennedy
On 11/25/2010 03:45 PM, Philip Graham Willoughby wrote:
> Hi all,
>
> I'm noticing a new failure with SQLite 3.7.3 as compared to the previous 
> version I was using, 3.6.23.1.

Are you able to share the database and the query that causes
the assert() to fail?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Assertion failure in SQLite 3.7.3 (new vs. 3.6.23.1)

2010-11-25 Thread Philip Graham Willoughby
Hi all,

I'm noticing a new failure with SQLite 3.7.3 as compared to the previous 
version I was using, 3.6.23.1.

Error message:
--
Assertion failed: (memIsValid(&u.bq.r.aMem[i])), function sqlite3VdbeExec, file 
.../sqlite3.c, line 64507.

Information from the time of error:
---
(gdb) print i
0
(gdb) print *u.bq.r.aMem
{
  u = {
i = 1, 
nZero = 1, 
pDef = 0x1, 
pRowSet = 0x1, 
pFrame = 0x1
  }, 
  r = 0, 
  db = 0x83a218, 
  z = 0x0, 
  n = 0, 
  flags = 4228, 
  type = 0 '\0', 
  enc = 0 '\0', 
  pScopyFrom = 0x0, 
  pFiller = 0x0, 
  xDel = 0, 
  zMalloc = 0x0
}
(gdb) print pc
31
(gdb) print u.bq
{
  pC = 0x2714e8, 
  res = 2561376, 
  r = {
pKeyInfo = 0x1fbb58, 
nField = 2, 
flags = 12, 
rowid = 343597383684, 
aMem = 0xa052d8
  }
}

Repeatability:
--
Every time. u.bq.r.aMem->flags is always 4228 (==0x1084), u.bq.r.aMem->u.i is 
always 1, u.bq.r.aMem->db varies as expected and all other fields of 
u.bq.r.aMem are zeroes.

Background:
---
I am using SQLite in an iPhone application I'm developing.  I am using the 
amalgamation from sqlite.org so that I know what I have; I am not using the 
version of SQLite supplied by Apple in their SDK. The previous version I had 
was 3.6.23.1; I updated to 3.7.3 because I wanted the very useful 
sqlite3_register_function_v2() API which is new in that release.

The same assertion fires when I run my app in the iPhone simulator or execute 
the same query on the same database from the sqlite3 shell program.

I am compiling sqlite3.c with GCC 4.2.

Obviously when I execute the same query on a version of sqlite built without 
the -DSQLITE_DEBUG it cannot fail the assertion since the assertion is not 
built. I can confirm however that it executes without any detected memory 
access violation and the result set is what I would expect.

It is important for me to understand if this is an assertion mis-fire in the 
debug case (and not a real problem) or a lucky escape in the release case (and 
therefore a real problem, unless I can guarantee my customers are all similarly 
lucky).

The failing query is explained as follows:

addr  opcode p1p2p3p4 p5  comment  
  -        -  --  -
0 Trace  0 0 000   
1 OpenEphemeral  9 3 0 keyinfo(1,-BINARY)  00   
2 Integer1 1 000   
3 Variable   1 2 0 :row   00   
4 MustBeInt  2 0 000   
5 IfPos  2 7 000   
6 Integer0 2 000   
7 Add1 2 300   
8 IfPos  1 10000   
9 Integer-13 000   
10Goto   0 118   000   
11OpenRead   0 310 0  00   
12OpenRead   1 210 3  00   
13OpenRead   2 270 3  00   
14OpenRead   10300 keyinfo(2,BINARY,BINARY)  00 
  
15OpenRead   3 130 4  00   
16OpenRead   4 8 0 2  00   
17OpenRead   5 240 2  00   
18OpenRead   6 2 0 3  00   
19OpenRead   7 250 2  00   
20OpenRead   8 2 0 3  00   
21Rewind 0 95000   
22Rowid  0 4 000   
23MustBeInt  4 94000   
24NotExists  1 94400   
25SCopy  4 5 000   
26IsNull 5 94000   
27Column 1 2 600   
28IsNull 6 94000   
29Affinity   6 1 0 d  00   
30SeekGe 10945 2  00   
31IdxGE  10945 2  01   
32IdxRowid   107 000   
33Seek   2 7 000   
34Column 2 2 800   
35MustBeInt  8 93000   
36NotExists  3 938