Re: [sqlite] Sqlite Crash in sqlite3DbMallocRawNN.

2018-11-13 Thread Jens Alfke


> On Nov 13, 2018, at 2:18 AM, Hegde, Deepakakumar (D.) 
>  wrote:
> 
> #0  sqlite3DbMallocRawNN (db=db@entry=0x1dea20, n=176093659143 
> ) at 
> /workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:24732

176093659143 = 0x290007

Looks kind of like it was supposed to be 7, but some garbage was left in the 
upper 32 bits of the 64-bit value. What OS and CPU type is this?

Richard — to me this doesn’t smell like heap corruption, just bad input to 
malloc.

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


[sqlite] Sqlite Crash in sqlite3DbMallocRawNN.

2018-11-13 Thread Ramu, Bhavya (B.)
Hi All,

We are facing a problem in which sqlite library function sqlite3DbMallocRawNN() 
is getting crashed inside the sqlite3_prepare_v2() function to prepare the 
statement.

As per the analysis "n" value input to this seems to have a big value causing 
the crash. checked the input value to sqlite3_prepare_v2() and this seems fine. 
input query statement is well within the max size allocated for the buffer.

Sqlite version in use: 3.16.1

Checked the internet for this specific function crash and can see some reported 
this. but could not find any solution particular to this. Please can I know is 
this issue is reported before and is there any counter measure any any of the 
higher version?

Also it will be helpful anyone point out any error in the input causing this 
issue.
Also this issue is seen only once and not able to see the issue again.

coredump back trace:

(gdb) bt
#0  sqlite3DbMallocRawNN (db=db@entry=0x1dea20, n=176093659143) at 
/workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:24732
#1  0xa49ad05a in sqlite3DbStrNDup (db=db@entry=0x1dea20,
z=0x26c981 
"SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
VIDEO UNION SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
IMAGE UNION SELECT ID,SORTID,NAME,OBJECT_FORMAT,8 AS CONTENT_TYPE 
,STRFRMT,PPID,3 as is_invalid,0 AS FILESIZE FROM PLAYLIST) AS TEMP WHERE 
Content_Type &1 AND PPID=2", n=)
at 
/workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:24834
#2  0xa49eceba in sqlite3ExprListSetSpan (pParse=, 
pSpan=, pSpan=, pList=)
at 
/workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:91967
#3  yy_reduce (yyruleno=92, yypParser=0xa0de4b00) at 
/workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:5598
#4  sqlite3Parser (pParse=, yyminor=..., yymajor=7, 
yymajor@entry=-1596044280, yyp=)
at 
/workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:6592
#5  sqlite3RunParser (pParse=pParse@entry=0x9d3fdce4,
zSql=zSql@entry=0x26c8f8 "SELECT COUNT(TEMP.ID) FROM (SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
AUDIO UNION SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
VIDEO UNION SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
IMAGE UNION SELECT ID,SORTID,NAME,OBJECT_FORMAT,8 AS CONTENT_TYPE 
,STRFRMT,PPID,3 as is_invalid,0 AS FILESIZE FROM PLAYLIST) AS TEMP WHERE 
Content_Type &1 AND PPID=2", pzErrMsg=pzErrMsg@entry=0x9d3fdcdc)
at 
/workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:7538
#6  0xa49f08cc in sqlite3Prepare (db=db@entry=0x1dea20,
zSql=zSql@entry=0x26c8f8 "SELECT COUNT(TEMP.ID) FROM (SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
AUDIO UNION SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
VIDEO UNION SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
IMAGE UNION SELECT ID,SORTID,NAME,OBJECT_FORMAT,8 AS CONTENT_TYPE 
,STRFRMT,PPID,3 as is_invalid,0 AS FILESIZE FROM PLAYLIST) AS TEMP WHERE 
Content_Type &1 AND PPID=2", nBytes=nBytes@entry=-1, 
saveSqlFlag=saveSqlFlag@entry=1, pReprepare=pReprepare@entry=0x0,
ppStmt=ppStmt@entry=0x25cf00, pzTail=pzTail@entry=0x0) at 
/workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:115300
#7  0xa49f0bee in sqlite3LockAndPrepare (db=0x1dea20,
zSql=0x26c8f8 "SELECT COUNT(TEMP.ID) FROM (SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
AUDIO UNION SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
VIDEO UNION SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
IMAGE UNION SELECT ID,SORTID,NAME,OBJECT_FORMAT,8 AS CONTENT_TYPE 
,STRFRMT,PPID,3 as is_invalid,0 AS FILESIZE FROM PLAYLIST) AS TEMP WHERE 
Content_Type &1 AND PPID=2", nBytes=-1, saveSqlFlag=1, pOld=0x0, 
ppStmt=0x25cf00, pzTail=0x0)
at 
/workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:115391
#8  0xa49f0db4 in sqlite3_prepare_v2 (db=db@entry=0x1dea20,
zSql=zSql@entry=0x26c8f8 "SELECT COUNT(TEMP.ID) FROM (SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
AUDIO UNION SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
VIDEO UNION SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
IMAGE UNION SELECT ID,SORTID,NAME,OBJECT_FORMAT,8 AS CONTENT_TYPE 
,STRFRMT,PPID,3 as is_invalid,0 AS FILESIZE FROM PLAYLIST) AS TEMP WHERE 
Content_Type &1 AND PPID=2", nBytes=nBytes@entry=-1, 
ppStmt=ppStmt@entry=0x25cf00, 

Re: [sqlite] Sqlite Crash in sqlite3DbMallocRawNN.

2018-11-13 Thread Richard Hipp
On 11/13/18, Hegde, Deepakakumar (D.)  wrote:
> Hi All,
>
>
> We are facing a problem in which sqlite library function
> sqlite3DbMallocRawNN() is getting crashed inside the sqlite3_prepare_v2()
> function to prepare the statement.

This sort of thing is almost always the result of heap corruption
occurring elsewhere in your system.  It is not a problem with SQLite,
but rather SQLite just happened to be the unlucky component to stumble
over the corrupted heap left behind by some other component.

Are you able to run your application using ASAN or Valgrind?  That
will usually pinpoint the problem pretty quickly.

>
>
> As per the analysis "n" value input to this seems to have a big value
> causing the crash. checked the input value to sqlite3_prepare_v2() and this
> seems fine. input query statement is well within the max size allocated for
> the buffer.
>
>
> Sqlite version in use: 3.16.1
>
>
> Checked the internet for this specific function crash and can see some
> reported this. but could not find any solution particular to this. Please
> can I know is this issue is reported before and is there any counter measure
> any any of the higher version?
>
>
> Also it will be helpful anyone point out any error in the input causing this
> issue.
>
> Also this issue is seen only once and not able to see the issue again.
>
>
> coredump back trace:
>
> (gdb) bt
> #0  sqlite3DbMallocRawNN (db=db@entry=0x1dea20, n=176093659143) at
> /workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:24732
> #1  0xa49ad05a in sqlite3DbStrNDup (db=db@entry=0x1dea20,
> z=0x26c981
> "SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE
> FROM VIDEO UNION SELECT
> ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE
> FROM IMAGE UNION SELECT ID,SORTID,NAME,OBJECT_FORMAT,8 AS CONTENT_TYPE
> ,STRFRMT,PPID,3 as is_invalid,0 AS FILESIZE FROM PLAYLIST) AS TEMP WHERE
> Content_Type &1 AND PPID=2", n=)
> at
> /workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:24834
> #2  0xa49eceba in sqlite3ExprListSetSpan (pParse=,
> pSpan=, pSpan=, pList=)
> at
> /workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:91967
> #3  yy_reduce (yyruleno=92, yypParser=0xa0de4b00) at
> /workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:5598
> #4  sqlite3Parser (pParse=, yyminor=..., yymajor=7,
> yymajor@entry=-1596044280, yyp=)
> at
> /workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:6592
> #5  sqlite3RunParser (pParse=pParse@entry=0x9d3fdce4,
> zSql=zSql@entry=0x26c8f8 "SELECT COUNT(TEMP.ID) FROM (SELECT
> ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE
> FROM AUDIO UNION SELECT
> ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE
> FROM VIDEO UNION SELECT
> ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE
> FROM IMAGE UNION SELECT ID,SORTID,NAME,OBJECT_FORMAT,8 AS CONTENT_TYPE
> ,STRFRMT,PPID,3 as is_invalid,0 AS FILESIZE FROM PLAYLIST) AS TEMP WHERE
> Content_Type &1 AND PPID=2", pzErrMsg=pzErrMsg@entry=0x9d3fdcdc)
> at
> /workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:7538
> #6  0xa49f08cc in sqlite3Prepare (db=db@entry=0x1dea20,
> zSql=zSql@entry=0x26c8f8 "SELECT COUNT(TEMP.ID) FROM (SELECT
> ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE
> FROM AUDIO UNION SELECT
> ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE
> FROM VIDEO UNION SELECT
> ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE
> FROM IMAGE UNION SELECT ID,SORTID,NAME,OBJECT_FORMAT,8 AS CONTENT_TYPE
> ,STRFRMT,PPID,3 as is_invalid,0 AS FILESIZE FROM PLAYLIST) AS TEMP WHERE
> Content_Type &1 AND PPID=2", nBytes=nBytes@entry=-1,
> saveSqlFlag=saveSqlFlag@entry=1, pReprepare=pReprepare@entry=0x0,
> ppStmt=ppStmt@entry=0x25cf00, pzTail=pzTail@entry=0x0) at
> /workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:115300
> #7  0xa49f0bee in sqlite3LockAndPrepare (db=0x1dea20,
> zSql=0x26c8f8 "SELECT COUNT(TEMP.ID) FROM (SELECT
> ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE
> FROM AUDIO UNION SELECT
> ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE
> FROM VIDEO UNION SELECT
> ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE
> FROM IMAGE UNION SELECT ID,SORTID,NAME,OBJECT_FORMAT,8 AS CONTENT_TYPE
> ,STRFRMT,PPID,3 as is_invalid,0 AS FILESIZE FROM PLAYLIST) AS TEMP WHERE
> Content_Type &1 AND PPID=2", nBytes=-1, saveSqlFlag=1, pOld=0x0,
> ppStmt=0x25cf00, pzTail=0x0)
> at
> /workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:115391
> #8  0xa49f0db4 in sqlite3_prepare_v2 (db=db@entry=0x1dea20,
> 

[sqlite] Sqlite Crash in sqlite3DbMallocRawNN.

2018-11-13 Thread Hegde, Deepakakumar (D.)
Hi All,


We are facing a problem in which sqlite library function sqlite3DbMallocRawNN() 
is getting crashed inside the sqlite3_prepare_v2() function to prepare the 
statement.


As per the analysis "n" value input to this seems to have a big value causing 
the crash. checked the input value to sqlite3_prepare_v2() and this seems fine. 
input query statement is well within the max size allocated for the buffer.


Sqlite version in use: 3.16.1


Checked the internet for this specific function crash and can see some reported 
this. but could not find any solution particular to this. Please can I know is 
this issue is reported before and is there any counter measure any any of the 
higher version?


Also it will be helpful anyone point out any error in the input causing this 
issue.

Also this issue is seen only once and not able to see the issue again.


coredump back trace:

(gdb) bt
#0  sqlite3DbMallocRawNN (db=db@entry=0x1dea20, n=176093659143) at 
/workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:24732
#1  0xa49ad05a in sqlite3DbStrNDup (db=db@entry=0x1dea20,
z=0x26c981 
"SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
VIDEO UNION SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
IMAGE UNION SELECT ID,SORTID,NAME,OBJECT_FORMAT,8 AS CONTENT_TYPE 
,STRFRMT,PPID,3 as is_invalid,0 AS FILESIZE FROM PLAYLIST) AS TEMP WHERE 
Content_Type &1 AND PPID=2", n=)
at 
/workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:24834
#2  0xa49eceba in sqlite3ExprListSetSpan (pParse=, 
pSpan=, pSpan=, pList=)
at 
/workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:91967
#3  yy_reduce (yyruleno=92, yypParser=0xa0de4b00) at 
/workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:5598
#4  sqlite3Parser (pParse=, yyminor=..., yymajor=7, 
yymajor@entry=-1596044280, yyp=)
at 
/workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:6592
#5  sqlite3RunParser (pParse=pParse@entry=0x9d3fdce4,
zSql=zSql@entry=0x26c8f8 "SELECT COUNT(TEMP.ID) FROM (SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
AUDIO UNION SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
VIDEO UNION SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
IMAGE UNION SELECT ID,SORTID,NAME,OBJECT_FORMAT,8 AS CONTENT_TYPE 
,STRFRMT,PPID,3 as is_invalid,0 AS FILESIZE FROM PLAYLIST) AS TEMP WHERE 
Content_Type &1 AND PPID=2", pzErrMsg=pzErrMsg@entry=0x9d3fdcdc)
at 
/workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:7538
#6  0xa49f08cc in sqlite3Prepare (db=db@entry=0x1dea20,
zSql=zSql@entry=0x26c8f8 "SELECT COUNT(TEMP.ID) FROM (SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
AUDIO UNION SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
VIDEO UNION SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
IMAGE UNION SELECT ID,SORTID,NAME,OBJECT_FORMAT,8 AS CONTENT_TYPE 
,STRFRMT,PPID,3 as is_invalid,0 AS FILESIZE FROM PLAYLIST) AS TEMP WHERE 
Content_Type &1 AND PPID=2", nBytes=nBytes@entry=-1, 
saveSqlFlag=saveSqlFlag@entry=1, pReprepare=pReprepare@entry=0x0,
ppStmt=ppStmt@entry=0x25cf00, pzTail=pzTail@entry=0x0) at 
/workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:115300
#7  0xa49f0bee in sqlite3LockAndPrepare (db=0x1dea20,
zSql=0x26c8f8 "SELECT COUNT(TEMP.ID) FROM (SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
AUDIO UNION SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
VIDEO UNION SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
IMAGE UNION SELECT ID,SORTID,NAME,OBJECT_FORMAT,8 AS CONTENT_TYPE 
,STRFRMT,PPID,3 as is_invalid,0 AS FILESIZE FROM PLAYLIST) AS TEMP WHERE 
Content_Type &1 AND PPID=2", nBytes=-1, saveSqlFlag=1, pOld=0x0, 
ppStmt=0x25cf00, pzTail=0x0)
at 
/workspace/workspace/Trigger-Build-Host_Job/host/yunos6.0/third_party/sqlite/sqlite3.c:115391
#8  0xa49f0db4 in sqlite3_prepare_v2 (db=db@entry=0x1dea20,
zSql=zSql@entry=0x26c8f8 "SELECT COUNT(TEMP.ID) FROM (SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
AUDIO UNION SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
VIDEO UNION SELECT 
ID,SORTID,NAME,Object_Format,Content_Type,STRFRMT,PPID,is_invalid,FILESIZE FROM 
IMAGE UNION SELECT ID,SORTID,NAME,OBJECT_FORMAT,8 AS CONTENT_TYPE 
,STRFRMT,PPID,3 as is_invalid,0 AS FILESIZE FROM PLAYLIST) AS TEMP WHERE 
Content_Type &1 AND PPID=2", nBytes=nBytes@entry=-1, 
ppStmt=ppStmt@entry=0x25cf00, 

Re: [sqlite] SQLIte crash in sqlite3_db_release_memory

2017-03-10 Thread Richard Hipp
On 3/10/17, Anthrathodiyil, Sabeel (S.)  wrote:
> Hi,
> I am facing a crash while invoking "sqlite3_db_release_memory" the crash is
> from pcache1RemoveFromHash.  SQLite 3.7.10 is running on ARM A5 with
> Freescale MQX as OS.
>
> Any probable reasons in term of the SQLite operations that are done wrong or
> out of order?

The usual reason for this is that some other part of your application
has corrupted the heap and SQLite has stumbled over the damage.

I also observe the SQLite 3.7.10 is over 5 years old.  There have been
67 subsequent releases.  Version 3.17.0 use less than half the CPU
cycles as 3.7.10 and is completely backwards compatible.
-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLIte crash in sqlite3_db_release_memory

2017-03-10 Thread Simon Slavin

On 10 Mar 2017, at 2:05pm, Anthrathodiyil, Sabeel (S.)  
wrote:

> Stack trace is as below
> --
> pcache1RemoveFromHash
> pcache1EnforceMaxPage
> pcache1Shrink
> sqlite3PcacheShrink
> 
> The sequence of SQLite operations being followed which lead to crash is in 
> the following order
> prepare_sql
> step_sql
> sqlite3_db_release_memory
> sqlite3_finalize
> 
> Any probable reasons in term of the SQLite operations that are done wrong or 
> out of order?

Please check to see that the parameter you’re passing to 
sqlite3_db_release_memory() is the connection, not the statement.

If that’s not the problem, then for debugging purposes can you try reversing 
the order of the last two steps ?  Finalize the statement before you release 
memory for the connection.

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


[sqlite] SQLIte crash in sqlite3_db_release_memory

2017-03-10 Thread Anthrathodiyil, Sabeel (S.)
Hi,
I am facing a crash while invoking "sqlite3_db_release_memory" the crash is 
from pcache1RemoveFromHash.  SQLite 3.7.10 is running on ARM A5 with Freescale 
MQX as OS.

Stack trace is as below
--
pcache1RemoveFromHash
pcache1EnforceMaxPage
pcache1Shrink
sqlite3PcacheShrink

The sequence of SQLite operations being followed which lead to crash is in the 
following order
prepare_sql
step_sql
sqlite3_db_release_memory
sqlite3_finalize

Any probable reasons in term of the SQLite operations that are done wrong or 
out of order?

Thanks,
Sabeel



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


[sqlite] SQLite crash

2015-08-12 Thread Dan Kennedy
On 08/12/2015 02:15 AM, Robert Weiss wrote:
> The bug seems to be repeatable.  At least, it happened again today.
> I haven't used gdb in a long time.  Here's my first crack at it; what else 
> should I do?
> $ gdb sqliteGNU gdb (GDB) 7.8Copyright (C) 2014 Free Software Foundation, 
> Inc.License GPLv3+: GNU GPL version 3 or later 
> This is free software: you are free to 
> change and redistribute it.There is NO WARRANTY, to the extent permitted by 
> law.  Type "show copying"and "show warranty" for details.This GDB was 
> configured as "i686-pc-cygwin".Type "show configuration" for configuration 
> details.For bug reporting instructions, please 
> see:.Find the GDB manual and other 
> documentation resources online 
> at:.For help, type 
> "help".Type "apropos word" to search for commands related to "word"...Reading 
> symbols from sqlite...done.(gdb) run /cygdrive/r/errd200.dbStarting program: 
> /usr/local/bin/sqlite /cygdrive/r/errd200.db[New Thread 12300.0x294c][New 
> Thread 12300.0x32f0][New Thread 12300.0x3530][New Thread 12300.0x328c][New 
> Thread 12300.0x389c]SQLite version 3.8.11.1 2015-07-29 20:00:57Enter ".help" 
> for usage hints.sqlite> create index d200_on_passport_fn on 
> d200_on_passport(fn);[New Thread 12300.0xa64]gdb: unknown target exception 
> 0x8001 at 0x74d66d61
> Program received signal ?, Unknown signal.[Switching to Thread 
> 12300.0xa64]0x74d66d61 in sysfer!FirstHookFunc () from 
> /cygdrive/c/Windows/SysWOW64/SYSFER.DLL(gdb) bt#0  0x74d66d61 in 
> sysfer!FirstHookFunc () from /cygdrive/c/Windows/SysWOW64/SYSFER.DLL#1  
> 0x in ?? ()

What does typing this command at the (gdb) prompt after the crash output?

   thread apply all where 15

Or, if that doesn't work, just "where 15".

Thanks,
Dan.



>
>
>   On Tuesday, August 11, 2015 1:43 AM, Dan Kennedy  gmail.com> wrote:
> 
>
>   On 08/11/2015 12:23 AM, Robert Weiss wrote:
>> Dan Kennedy--
>> What address, precisely, should I use to send the database to you?  When I 
>> "reply" to your message I get the whole SQLite discussion group, which is 
>> what I want to avoid (no offense intended, guys and gals).
>> BTW, the problem does not seem to occur in version 3.8.10.2.
>> Robert Weiss
> Thanks for the database. We couldn't reproduce the problem here though.
>
> The crash is repeatable, correct? Are you able to capture a stack trace
> from the command line shell with gdb?
>
> Thanks,
> Dan.
>
>
>>
>>On Friday, August 7, 2015 11:31 PM, Dan Kennedy > gmail.com> wrote:
>>  
>>
>>On 08/08/2015 04:11 AM, Robert Weiss wrote:
>>> I observed the sqlite command shell version 3.8.11.1 to crash (exit to the 
>>> OSwithout an error message) while running in a Cygwin shell under Windows 7 
>>> when I tried to create anindex.  The source was compiled by gcc 4.9.2.  The 
>>> same type of crashhappened when I tried the operation from a Lua script 
>>> linked to the same objectlibrary.
>>>
>>>
>>>  
>>> Here are the DDL statements entered previous to the crash:
>>>
>>>
>>>  
>>> CREATE TABLEd200_on_passport(fn,path,size,serial,pid);
>>>
>>> CREATE INDEX d200_on_passport_serial ond200_on_passport(serial);
>>>
>>> CREATE VIEW d200 as select * fromd200_on_passport;
>>>
>>>
>>>  
>>> And here is the statement thatcaused the crash:
>>>
>>> create index d200_on_passport_fn ond200_on_passport(fn);
>>>
>>>
>>>  
>>> The crash didn?t happen when Itried the CREATE INDEX statement on a test 
>>> database with the same ddlstatements but containing no data.
>>>
>>>
>>> The compressed version of the database that illustrates the problem is a 
>>> little smaller than 2 MB.  It contains some semi-personal information (it's 
>>> part of an attempt to organize my photo library; pathnames hint at where 
>>> I've been on vacation and so on, but the database contains no images) and 
>>> I'd prefer not to post it to a list, but I can send it for use by those 
>>> tracking down the bug.
>> Can you send the database to me? Or to drh if that seems more prudent to
>> you.
>>
>> Thanks,
>> Dan.
>>
>>
>>
>>
>>
>>> Robert Weiss
>>> ___
>>> sqlite-users mailing list
>>> sqlite-users at mailinglists.sqlite.org
>>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>> ___
>> sqlite-users mailing list
>> sqlite-users at mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>
>>
>>  
>> ___
>> sqlite-users mailing list
>> sqlite-users at mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> 

[sqlite] SQLite crash

2015-08-11 Thread Robert Weiss
It will take a little while to compile with MSVC. ?In the meantime I removed 
-DSQLITE_DEFAULT_WORKER_THREADS=4 from the compilation flags and the index was 
created successfully. ?Haste makes waste?
Thanks, everyone.Bob Weiss 


 On Tuesday, August 11, 2015 1:55 PM, Joe Mistachkin  wrote:



Robert Weiss wrote:
>
> [continuing from previous gdb output]:(gdb) thread apply all where 15
> Thread 6 (Thread 12300.0xa64):#0 ?0x74d66d61 in sysfer!FirstHookFunc ()
> from /cygdrive/c/Windows/SysWOW64/SYSFER.DLL#1 ?0x in ?? ()
> 

Anyhow, the cause of this appears to be the "sysfer.dll", which belongs to
Symantec Network Threat Protection (NTP):

http://www.symantec.com/connect/forums/weve-found-new-big-one#comment-504141
1

I'm not exactly sure what is causing the bad interaction here; however, it
is possible that Cygwin and Symantec are attempting to hook similar Win32
APIs, with unpredictable results.

Does this issue occur when running a build of SQLite on your machine without
Cygwin (i.e. built using MSVC)?

--
Joe Mistachkin

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




[sqlite] SQLite crash

2015-08-11 Thread Robert Weiss
[continuing from previous gdb output]:(gdb) thread apply all where 15
Thread 6 (Thread 12300.0xa64):#0 ?0x74d66d61 in sysfer!FirstHookFunc () from 
/cygdrive/c/Windows/SysWOW64/SYSFER.DLL#1 ?0x in ?? ()
Thread 5 (Thread 12300.0x389c):#0 ?0x77791f92 in 
ntdll!ZwWaitForWorkViaWorkerFactory () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#1 ?0x77791f92 in 
ntdll!ZwWaitForWorkViaWorkerFactory () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#2 ?0x777c1d63 in 
ntdll!RtlpQueryDefaultUILanguage () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#3 ?0x6100626b in _cygtls::call2(unsigned 
long (*)(void*, void*), void*, void*) () from /usr/bin/cygwin1.dll#4 
?0x61006306 in _cygtls::call(unsigned long (*)(void*, void*), void*) () from 
/usr/bin/cygwin1.dll#5 ?0x610828d8 in threadfunc_fe(void*) () from 
/usr/bin/cygwin1.dll#6 ?0x75c4337a in KERNEL32!BaseThreadInitThunk () from 
/cygdrive/c/Windows/syswow64/kernel32.dll#7 ?0x777a92e2 in 
ntdll!RtlInitializeExceptionChain () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#8 ?0x777a92b5 in 
ntdll!RtlInitializeExceptionChain () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#9 ?0x in ?? ()
Thread 4 (Thread 12300.0x328c):#0 ?0x777901a9 in ntdll!ZwWaitForMultipleObjects 
() from /cygdrive/c/Windows/SysWOW64/ntdll.dll#1 ?0x777901a9 in 
ntdll!ZwWaitForMultipleObjects () from /cygdrive/c/Windows/SysWOW64/ntdll.dll#2 
?0x777b1541 in ntdll!TpIsTimerSet () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#3 ?0x75c4337a in 
KERNEL32!BaseThreadInitThunk () from 
/cygdrive/c/Windows/syswow64/kernel32.dll#4 ?0x777a92e2 in 
ntdll!RtlInitializeExceptionChain () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#5 ?0x777a92b5 in 
ntdll!RtlInitializeExceptionChain () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#6 ?0x in ?? ()
Thread 3 (Thread 12300.0x3530):#0 ?0x7778f951 in ntdll!ZwReadFile () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#1 ?0x7778f951 in ntdll!ZwReadFile () 
from /cygdrive/c/Windows/SysWOW64/ntdll.dll#2 ?0x7549dd62 in ReadFile () from 
/cygdrive/c/Windows/syswow64/KERNELBASE.dll#3 ?0x00a0 in ?? ()#4 
?0x in ?? ()
Thread 2 (Thread 12300.0x32f0):#0 ?0x002c03a3 in ?? ()#1 ?0x6100626b in 
_cygtls::call2(unsigned long (*)(void*, void*), void*, void*) () from 
/usr/bin/cygwin1.dll#2 ?0x61006306 in _cygtls::call(unsigned long (*)(void*, 
void*), void*) () from /usr/bin/cygwin1.dll#3 ?0x610828d8 in 
threadfunc_fe(void*) () from /usr/bin/cygwin1.dll#4 ?0x75c4337a in 
KERNEL32!BaseThreadInitThunk () from 
/cygdrive/c/Windows/syswow64/kernel32.dll#5 ?0x777a92e2 in 
ntdll!RtlInitializeExceptionChain () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#6 ?0x777a92b5 in 
ntdll!RtlInitializeExceptionChain () from 
/cygdrive/c/Windows/SysWOW64/ntdll.dll#7 ?0x in ?? ()
Thread 1 (Thread 12300.0x294c):#0 ?0x7778fc66 in ntdll!ZwQueryInformationThread 
() from /cygdrive/c/Windows/SysWOW64/ntdll.dll#1 ?0x7778fc66 in 
ntdll!ZwQueryInformationThread () from /cygdrive/c/Windows/SysWOW64/ntdll.dll#2 
?0x754a38f6 in KERNELBASE!GetThreadPriority () from 
/cygdrive/c/Windows/syswow64/KERNELBASE.dll#3 ?0x6108dcc4 in yield () from 
/usr/bin/cygwin1.dll#4 ?0x61106585 in pthread::create(void* (*)(void*), 
pthread_attr*, void*) () from /usr/bin/cygwin1.dll#5 ?0x61107d3d in 
pthread::create(pthread**, pthread_attr* const*, void* (*)(void*), void*) () 
from /usr/bin/cygwin1.dll#6 ?0x610e1e15 in _sigfe () from 
/usr/bin/cygwin1.dll#7 ?0x00421070 in vdbeSorterListToPMA ()#8 ?0x8006ae42 in 
?? ()Backtrace stopped: previous frame inner to this frame (corrupt stack?)



 On Tuesday, August 11, 2015 1:03 PM, Dan Kennedy  wrote:


 On 08/12/2015 02:15 AM, Robert Weiss wrote:
> The bug seems to be repeatable.? At least, it happened again today.
> I haven't used gdb in a long time.? Here's my first crack at it; what else 
> should I do?
> $ gdb sqliteGNU gdb (GDB) 7.8Copyright (C) 2014 Free Software Foundation, 
> Inc.License GPLv3+: GNU GPL version 3 or later 
> This is free software: you are free to 
> change and redistribute it.There is NO WARRANTY, to the extent permitted by 
> law.? Type "show copying"and "show warranty" for details.This GDB was 
> configured as "i686-pc-cygwin".Type "show configuration" for configuration 
> details.For bug reporting instructions, please 
> see:.Find the GDB manual and other 
> documentation resources online 
> at:.For help, type 
> "help".Type "apropos word" to search for commands related to "word"...Reading 
> symbols from sqlite...done.(gdb) run /cygdrive/r/errd200.dbStarting program: 
> /usr/local/bin/sqlite /cygdrive/r/errd200.db[New Thread 12300.0x294c][New 
> Thread 12300.0x32f0][New Thread 12300.0x3530][New Thread 12300.0x328c][New 
> Thread 12300.0x389c]SQLite version 3.8.11.1 2015-07-29 20:00:57Enter ".help" 
> for usage hints.sqlite> create index d200_on_passport_fn on 
> d200_on_passport(fn);[New Thread 12300.0xa64]gdb: 

[sqlite] SQLite crash

2015-08-11 Thread Robert Weiss
The bug seems to be repeatable. ?At least, it happened again today.
I haven't used gdb in a long time. ?Here's my first crack at it; what else 
should I do? 
$ gdb sqliteGNU gdb (GDB) 7.8Copyright (C) 2014 Free Software Foundation, 
Inc.License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change 
and redistribute it.There is NO WARRANTY, to the extent permitted by law. ?Type 
"show copying"and "show warranty" for details.This GDB was configured as 
"i686-pc-cygwin".Type "show configuration" for configuration details.For bug 
reporting instructions, please see:.Find 
the GDB manual and other documentation resources online 
at:.For help, type "help".Type 
"apropos word" to search for commands related to "word"...Reading symbols from 
sqlite...done.(gdb) run /cygdrive/r/errd200.dbStarting program: 
/usr/local/bin/sqlite /cygdrive/r/errd200.db[New Thread 12300.0x294c][New 
Thread 12300.0x32f0][New Thread 12300.0x3530][New Thread 12300.0x328c][New 
Thread 12300.0x389c]SQLite version 3.8.11.1 2015-07-29 20:00:57Enter ".help" 
for usage hints.sqlite> create index d200_on_passport_fn on 
d200_on_passport(fn);[New Thread 12300.0xa64]gdb: unknown target exception 
0x8001 at 0x74d66d61
Program received signal ?, Unknown signal.[Switching to Thread 
12300.0xa64]0x74d66d61 in sysfer!FirstHookFunc () from 
/cygdrive/c/Windows/SysWOW64/SYSFER.DLL(gdb) bt#0 ?0x74d66d61 in 
sysfer!FirstHookFunc () from /cygdrive/c/Windows/SysWOW64/SYSFER.DLL#1 
?0x in ?? ()


 On Tuesday, August 11, 2015 1:43 AM, Dan Kennedy  wrote:


 On 08/11/2015 12:23 AM, Robert Weiss wrote:
> Dan Kennedy--
> What address, precisely, should I use to send the database to you?? When I 
> "reply" to your message I get the whole SQLite discussion group, which is 
> what I want to avoid (no offense intended, guys and gals).
> BTW, the problem does not seem to occur in version 3.8.10.2.
> Robert Weiss

Thanks for the database. We couldn't reproduce the problem here though.

The crash is repeatable, correct? Are you able to capture a stack trace 
from the command line shell with gdb?

Thanks,
Dan.


>
>
>? ? ? On Friday, August 7, 2015 11:31 PM, Dan Kennedy gmail.com> wrote:
>? ? 
>
>? On 08/08/2015 04:11 AM, Robert Weiss wrote:
>> I observed the sqlite command shell version 3.8.11.1 to crash (exit to the 
>> OSwithout an error message) while running in a Cygwin shell under Windows 7 
>> when I tried to create anindex.? The source was compiled by gcc 4.9.2.? The 
>> same type of crashhappened when I tried the operation from a Lua script 
>> linked to the same objectlibrary.
>>
>>
>>? ? 
>> Here are the DDL statements entered previous to the crash:
>>
>>
>>? ? 
>> CREATE TABLEd200_on_passport(fn,path,size,serial,pid);
>>
>> CREATE INDEX d200_on_passport_serial ond200_on_passport(serial);
>>
>> CREATE VIEW d200 as select * fromd200_on_passport;
>>
>>
>>? ? 
>> And here is the statement thatcaused the crash:
>>
>> create index d200_on_passport_fn ond200_on_passport(fn);
>>
>>
>>? ? 
>> The crash didn?t happen when Itried the CREATE INDEX statement on a test 
>> database with the same ddlstatements but containing no data.
>>
>>
>> The compressed version of the database that illustrates the problem is a 
>> little smaller than 2 MB.? It contains some semi-personal information (it's 
>> part of an attempt to organize my photo library; pathnames hint at where 
>> I've been on vacation and so on, but the database contains no images) and 
>> I'd prefer not to post it to a list, but I can send it for use by those 
>> tracking down the bug.
>
> Can you send the database to me? Or to drh if that seems more prudent to
> you.
>
> Thanks,
> Dan.
>
>
>
>
>
>> Robert Weiss
>> ___
>> sqlite-users mailing list
>> sqlite-users at mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
>? ? 
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

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





[sqlite] SQLite crash

2015-08-11 Thread Jan Nijtmans
Op 11 aug. 2015 17:06 schreef "Robert Weiss"  het
volgende:
>
> In the meantime I removed -DSQLITE_DEFAULT_WORKER_THREADS=4 from the
compilation flags and the index was created successfully.  Haste makes
waste?
> Thanks, everyone.Bob Weiss

That explains it! Your build of sqlite starts win32 threads, which don't
work well in a cygwin environment. On cygwin you should configure posix
threads.

I have a fix for that, it's included in the cygwin SQLite package. With
that you can use multiple threads as you wish.

Regards,
Jan Nijtmans


[sqlite] SQLite crash

2015-08-11 Thread Dan Kennedy
On 08/11/2015 12:23 AM, Robert Weiss wrote:
> Dan Kennedy--
> What address, precisely, should I use to send the database to you?  When I 
> "reply" to your message I get the whole SQLite discussion group, which is 
> what I want to avoid (no offense intended, guys and gals).
> BTW, the problem does not seem to occur in version 3.8.10.2.
> Robert Weiss

Thanks for the database. We couldn't reproduce the problem here though.

The crash is repeatable, correct? Are you able to capture a stack trace 
from the command line shell with gdb?

Thanks,
Dan.


>
>
>   On Friday, August 7, 2015 11:31 PM, Dan Kennedy  gmail.com> wrote:
> 
>
>   On 08/08/2015 04:11 AM, Robert Weiss wrote:
>> I observed the sqlite command shell version 3.8.11.1 to crash (exit to the 
>> OSwithout an error message) while running in a Cygwin shell under Windows 7 
>> when I tried to create anindex.  The source was compiled by gcc 4.9.2.  The 
>> same type of crashhappened when I tried the operation from a Lua script 
>> linked to the same objectlibrary.
>>
>>
>>
>> Here are the DDL statements entered previous to the crash:
>>
>>
>>
>> CREATE TABLEd200_on_passport(fn,path,size,serial,pid);
>>
>> CREATE INDEX d200_on_passport_serial ond200_on_passport(serial);
>>
>> CREATE VIEW d200 as select * fromd200_on_passport;
>>
>>
>>
>> And here is the statement thatcaused the crash:
>>
>> create index d200_on_passport_fn ond200_on_passport(fn);
>>
>>
>>
>> The crash didn?t happen when Itried the CREATE INDEX statement on a test 
>> database with the same ddlstatements but containing no data.
>>
>>
>> The compressed version of the database that illustrates the problem is a 
>> little smaller than 2 MB.  It contains some semi-personal information (it's 
>> part of an attempt to organize my photo library; pathnames hint at where 
>> I've been on vacation and so on, but the database contains no images) and 
>> I'd prefer not to post it to a list, but I can send it for use by those 
>> tracking down the bug.
>
> Can you send the database to me? Or to drh if that seems more prudent to
> you.
>
> Thanks,
> Dan.
>
>
>
>
>
>> Robert Weiss
>> ___
>> sqlite-users mailing list
>> sqlite-users at mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



[sqlite] SQLite crash

2015-08-11 Thread Joe Mistachkin

Robert Weiss wrote:
>
> [continuing from previous gdb output]:(gdb) thread apply all where 15
> Thread 6 (Thread 12300.0xa64):#0 ?0x74d66d61 in sysfer!FirstHookFunc ()
> from /cygdrive/c/Windows/SysWOW64/SYSFER.DLL#1 ?0x in ?? ()
> 

Anyhow, the cause of this appears to be the "sysfer.dll", which belongs to
Symantec Network Threat Protection (NTP):

http://www.symantec.com/connect/forums/weve-found-new-big-one#comment-504141
1

I'm not exactly sure what is causing the bad interaction here; however, it
is possible that Cygwin and Symantec are attempting to hook similar Win32
APIs, with unpredictable results.

Does this issue occur when running a build of SQLite on your machine without
Cygwin (i.e. built using MSVC)?

--
Joe Mistachkin



[sqlite] SQLite crash

2015-08-10 Thread Robert Weiss
Dan Kennedy--
What address, precisely, should I use to send the database to you? ?When I 
"reply" to your message I get the whole SQLite discussion group, which is what 
I want to avoid (no offense intended, guys and gals).
BTW, the problem does not seem to occur in version 3.8.10.2.
Robert Weiss 


 On Friday, August 7, 2015 11:31 PM, Dan Kennedy  
wrote:


 On 08/08/2015 04:11 AM, Robert Weiss wrote:
> I observed the sqlite command shell version 3.8.11.1 to crash (exit to the 
> OSwithout an error message) while running in a Cygwin shell under Windows 7 
> when I tried to create anindex.? The source was compiled by gcc 4.9.2.? The 
> same type of crashhappened when I tried the operation from a Lua script 
> linked to the same objectlibrary.
>
>
>? 
> Here are the DDL statements entered previous to the crash:
>
>
>? 
> CREATE TABLEd200_on_passport(fn,path,size,serial,pid);
>
> CREATE INDEX d200_on_passport_serial ond200_on_passport(serial);
>
> CREATE VIEW d200 as select * fromd200_on_passport;
>
>
>? 
> And here is the statement thatcaused the crash:
>
> create index d200_on_passport_fn ond200_on_passport(fn);
>
>
>? 
> The crash didn?t happen when Itried the CREATE INDEX statement on a test 
> database with the same ddlstatements but containing no data.
>
>
> The compressed version of the database that illustrates the problem is a 
> little smaller than 2 MB.? It contains some semi-personal information (it's 
> part of an attempt to organize my photo library; pathnames hint at where I've 
> been on vacation and so on, but the database contains no images) and I'd 
> prefer not to post it to a list, but I can send it for use by those tracking 
> down the bug.


Can you send the database to me? Or to drh if that seems more prudent to 
you.

Thanks,
Dan.





>
> Robert Weiss
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

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





[sqlite] SQLite crash

2015-08-08 Thread Dan Kennedy
On 08/08/2015 04:11 AM, Robert Weiss wrote:
> I observed the sqlite command shell version 3.8.11.1 to crash (exit to the 
> OSwithout an error message) while running in a Cygwin shell under Windows 7 
> when I tried to create anindex.  The source was compiled by gcc 4.9.2.  The 
> same type of crashhappened when I tried the operation from a Lua script 
> linked to the same objectlibrary.
>
>
>   
> Here are the DDL statements entered previous to the crash:
>
>
>   
> CREATE TABLEd200_on_passport(fn,path,size,serial,pid);
>
> CREATE INDEX d200_on_passport_serial ond200_on_passport(serial);
>
> CREATE VIEW d200 as select * fromd200_on_passport;
>
>
>   
> And here is the statement thatcaused the crash:
>
> create index d200_on_passport_fn ond200_on_passport(fn);
>
>
>   
> The crash didn?t happen when Itried the CREATE INDEX statement on a test 
> database with the same ddlstatements but containing no data.
>
>
> The compressed version of the database that illustrates the problem is a 
> little smaller than 2 MB.  It contains some semi-personal information (it's 
> part of an attempt to organize my photo library; pathnames hint at where I've 
> been on vacation and so on, but the database contains no images) and I'd 
> prefer not to post it to a list, but I can send it for use by those tracking 
> down the bug.


Can you send the database to me? Or to drh if that seems more prudent to 
you.

Thanks,
Dan.





>
> Robert Weiss
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



[sqlite] SQLite crash

2015-08-08 Thread Jan Nijtmans
Op 7 aug. 2015 16:12 schreef "Robert Weiss"  het
volgende:
>
> I observed the sqlite command shell version 3.8.11.1 to crash (exit to
the OSwithout an error message) while running in a Cygwin shell under
Windows 7.

Does the same crash occur when using cygwin's SQLite 3.8.10.2 package? In
other words, is this a regression or a longstanding problem?

Regards,
 Jan Nijtmans


[sqlite] SQLite crash

2015-08-08 Thread Simon Slavin

On 7 Aug 2015, at 10:11pm, Robert Weiss  wrote:

> And here is the statement thatcaused the crash:
> 
> create index d200_on_passport_fn ond200_on_passport(fn);
> 
> 
>  
> The crash didn?t happen when Itried the CREATE INDEX statement on a test 
> database with the same ddlstatements but containing no data.

Are you up for a little detective work ?  The idea is to work out what part of 
your multi-table many-row database is causing the problem.

First, run "PRAGMA integrity_check()".  I'm going to assume it shows no errors.

Do a VACUUM before creating the index.  Does it still crash ?

Take a copy of the 2 Meg database.  DROP all tables and views except for the 
"ond200_on_passport" table.  Does the command still crash it ?

If so ...

Take another copy of the 2 Meg database and work out a way to DELETE about half 
the rows in "ond200_on_passport" but leave the other half.  Then see if the 
command still crashes.  Then restore the copy and delete the other half of the 
rows, leaving the first half intact.  Does it crash now ?  Both times ?  
Neither time ?  Only on one half of the data ?

Simon.


[sqlite] SQLite crash

2015-08-07 Thread Robert Weiss
I observed the sqlite command shell version 3.8.11.1 to crash (exit to the 
OSwithout an error message) while running in a Cygwin shell under Windows 7 
when I tried to create anindex.? The source was compiled by gcc 4.9.2. ?The 
same type of crashhappened when I tried the operation from a Lua script linked 
to the same objectlibrary.


?
Here are the DDL statements entered previous to the crash:


?
CREATE TABLEd200_on_passport(fn,path,size,serial,pid);

CREATE INDEX d200_on_passport_serial ond200_on_passport(serial);

CREATE VIEW d200 as select * fromd200_on_passport;


?
And here is the statement thatcaused the crash:

create index d200_on_passport_fn ond200_on_passport(fn);


?
The crash didn?t happen when Itried the CREATE INDEX statement on a test 
database with the same ddlstatements but containing no data.


The compressed version of the database that illustrates the problem is a little 
smaller than 2 MB. ?It contains some semi-personal information (it's part of an 
attempt to organize my photo library; pathnames hint at where I've been on 
vacation and so on, but the database contains no images) and I'd prefer not to 
post it to a list, but I can send it for use by those tracking down the bug.

Robert Weiss


[sqlite] sqlite crash with malloc_printerr in sqlite3MemFree

2015-02-25 Thread Zhao Lin
A short while after I submitted the post we checked our log files and found a 
few SQLITE_FULL errors which may have something to do with this. We will 
investigate on that.

Thanks for your reply!

Regards,
Zhao

-Original Message-
From: sqlite-users-bounces at mailinglists.sqlite.org 
[mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Richard Hipp
Sent: Wednesday, February 25, 2015 12:53 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] sqlite crash with malloc_printerr in sqlite3MemFree

On 2/25/15, Zhao Lin  wrote:
> Hi all,
>
> We sometimes, not always reproducible but it does recur from time to 
> time, get the following crash stack with sqlite3 version 3.8.1, we 
> couldn't tell much from our stack, wondering if there are possibly 
> related bugs on sqlite3?

The usual cause of problems inside of malloc() is heap corruption within the 
application.  Have you tried running with Valgrind to see what that shows?

>
> #0  0x7fdd66214925 in raise () from /lib64/libc.so.6
> #1  0x7fdd66216105 in abort () from /lib64/libc.so.6
> #2  0x7fdd66252837 in __libc_message () from /lib64/libc.so.6
> #3  0x7fdd66258166 in malloc_printerr () from /lib64/libc.so.6
> #4  0x7fdd6887d867 in sqlite3MemFree () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #5  0x7fdd6887e66b in sqlite3_free () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #6  0x7fdd6888ab26 in pcache1Free () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #7  0x7fdd6888ac11 in pcache1FreePage () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #8  0x7fdd6888b040 in pcache1TruncateUnsafe () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #9  0x7fdd6888b901 in pcache1Truncate () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #10 0x7fdd6888a4cb in sqlite3PcacheTruncate () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #11 0x7fdd6888a519 in sqlite3PcacheClear () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #12 0x7fdd6888cfec in pager_reset () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #13 0x7fdd6888f58e in sqlite3PagerClose () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #14 0x7fdd688994c1 in sqlite3BtreeClose () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #15 0x7fdd6890729f in sqlite3LeaveMutexAndCloseZombie () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #16 0x7fdd689071bf in sqlite3Close () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #17 0x7fdd689071e3 in sqlite3_close () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #18 0x7fdd680631a5 in dbhandle_close_write (handle=0x7fffa8968d88,
> should_abort=0) at dbhandle.c:1809
> ...
>
> Thanks,
> Zhao
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


--
D. Richard Hipp
drh at sqlite.org
___
sqlite-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] sqlite crash with malloc_printerr in sqlite3MemFree

2015-02-25 Thread Richard Hipp
On 2/25/15, Zhao Lin  wrote:
> Hi all,
>
> We sometimes, not always reproducible but it does recur from time to time,
> get the following crash stack with sqlite3 version 3.8.1, we couldn't tell
> much from our stack, wondering if there are possibly related bugs on
> sqlite3?

The usual cause of problems inside of malloc() is heap corruption
within the application.  Have you tried running with Valgrind to see
what that shows?

>
> #0  0x7fdd66214925 in raise () from /lib64/libc.so.6
> #1  0x7fdd66216105 in abort () from /lib64/libc.so.6
> #2  0x7fdd66252837 in __libc_message () from /lib64/libc.so.6
> #3  0x7fdd66258166 in malloc_printerr () from /lib64/libc.so.6
> #4  0x7fdd6887d867 in sqlite3MemFree () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #5  0x7fdd6887e66b in sqlite3_free () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #6  0x7fdd6888ab26 in pcache1Free () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #7  0x7fdd6888ac11 in pcache1FreePage () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #8  0x7fdd6888b040 in pcache1TruncateUnsafe () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #9  0x7fdd6888b901 in pcache1Truncate () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #10 0x7fdd6888a4cb in sqlite3PcacheTruncate () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #11 0x7fdd6888a519 in sqlite3PcacheClear () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #12 0x7fdd6888cfec in pager_reset () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #13 0x7fdd6888f58e in sqlite3PagerClose () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #14 0x7fdd688994c1 in sqlite3BtreeClose () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #15 0x7fdd6890729f in sqlite3LeaveMutexAndCloseZombie () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #16 0x7fdd689071bf in sqlite3Close () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #17 0x7fdd689071e3 in sqlite3_close () from
> /opt/DataInsight/bin/../lib/libsqlite3.so.0
> #18 0x7fdd680631a5 in dbhandle_close_write (handle=0x7fffa8968d88,
> should_abort=0) at dbhandle.c:1809
> ...
>
> Thanks,
> Zhao
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
D. Richard Hipp
drh at sqlite.org


[sqlite] sqlite crash with malloc_printerr in sqlite3MemFree

2015-02-25 Thread Zhao Lin
Hi all,

We sometimes, not always reproducible but it does recur from time to time, get 
the following crash stack with sqlite3 version 3.8.1, we couldn't tell much 
from our stack, wondering if there are possibly related bugs on sqlite3?

#0  0x7fdd66214925 in raise () from /lib64/libc.so.6
#1  0x7fdd66216105 in abort () from /lib64/libc.so.6
#2  0x7fdd66252837 in __libc_message () from /lib64/libc.so.6
#3  0x7fdd66258166 in malloc_printerr () from /lib64/libc.so.6
#4  0x7fdd6887d867 in sqlite3MemFree () from 
/opt/DataInsight/bin/../lib/libsqlite3.so.0
#5  0x7fdd6887e66b in sqlite3_free () from 
/opt/DataInsight/bin/../lib/libsqlite3.so.0
#6  0x7fdd6888ab26 in pcache1Free () from 
/opt/DataInsight/bin/../lib/libsqlite3.so.0
#7  0x7fdd6888ac11 in pcache1FreePage () from 
/opt/DataInsight/bin/../lib/libsqlite3.so.0
#8  0x7fdd6888b040 in pcache1TruncateUnsafe () from 
/opt/DataInsight/bin/../lib/libsqlite3.so.0
#9  0x7fdd6888b901 in pcache1Truncate () from 
/opt/DataInsight/bin/../lib/libsqlite3.so.0
#10 0x7fdd6888a4cb in sqlite3PcacheTruncate () from 
/opt/DataInsight/bin/../lib/libsqlite3.so.0
#11 0x7fdd6888a519 in sqlite3PcacheClear () from 
/opt/DataInsight/bin/../lib/libsqlite3.so.0
#12 0x7fdd6888cfec in pager_reset () from 
/opt/DataInsight/bin/../lib/libsqlite3.so.0
#13 0x7fdd6888f58e in sqlite3PagerClose () from 
/opt/DataInsight/bin/../lib/libsqlite3.so.0
#14 0x7fdd688994c1 in sqlite3BtreeClose () from 
/opt/DataInsight/bin/../lib/libsqlite3.so.0
#15 0x7fdd6890729f in sqlite3LeaveMutexAndCloseZombie () from 
/opt/DataInsight/bin/../lib/libsqlite3.so.0
#16 0x7fdd689071bf in sqlite3Close () from 
/opt/DataInsight/bin/../lib/libsqlite3.so.0
#17 0x7fdd689071e3 in sqlite3_close () from 
/opt/DataInsight/bin/../lib/libsqlite3.so.0
#18 0x7fdd680631a5 in dbhandle_close_write (handle=0x7fffa8968d88, 
should_abort=0) at dbhandle.c:1809
...

Thanks,
Zhao


Re: [sqlite] sqlite crash when realloc fails

2014-09-09 Thread Richard Hipp
On Tue, Sep 9, 2014 at 10:39 AM, Dominique Devienne 
wrote:

> On Tue, Sep 9, 2014 at 1:50 PM, Sebastien David 
> wrote:
>
> > I have a database with 10million of row in one table (file size is ~5GB)
> > When I execute a query that should return half of this table, sqlite
> fails
> > because at some point there is  no memory (this is normal) [...]
>
>
> Why do you think it's normal?
>

Yes, he shouldn't be using sqlite3_get_table() as the interface is marked
as deprecated.  Sabastien should be using sqlite3_prepare() and
sqlite3_step().

On the other hand, we should fix sqlite3_get_table() so that it works
without integer overflow problems, which are unacceptable even in a
"deprecated" interface.  The problem will be doing that in a way that is
testable on embedded systems



>
> Since your query has no SORTING or GROUPING, there's no reason for SQLite
> to use an inordinate amount of memory beyond it's page cache, unless your
> callback_cache_filter_check(record_id) function call does some
> memory-expensive operation.
>
> That your application code runs out of memory if it stores those 5M rows,
> sure, but I don't see why SQLite itself would use a lot of memory in that
> case. What am I missing? --DD
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



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


Re: [sqlite] sqlite crash when realloc fails

2014-09-09 Thread Dominique Devienne
On Tue, Sep 9, 2014 at 1:50 PM, Sebastien David 
wrote:

> I have a database with 10million of row in one table (file size is ~5GB)
> When I execute a query that should return half of this table, sqlite fails
> because at some point there is  no memory (this is normal) [...]


Why do you think it's normal?

Since your query has no SORTING or GROUPING, there's no reason for SQLite
to use an inordinate amount of memory beyond it's page cache, unless your
callback_cache_filter_check(record_id) function call does some
memory-expensive operation.

That your application code runs out of memory if it stores those 5M rows,
sure, but I don't see why SQLite itself would use a lot of memory in that
case. What am I missing? --DD
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] sqlite crash when realloc fails

2014-09-09 Thread Sebastien David
Hi,

I have a database with 10million of row in one table (file size is ~5GB)
When I execute a query that should return half of this table, sqlite fails
because at some point there is  no memory (this is normal) but instead of
returning an error, it crashes.

sqlite version: 3.7.5

#0  0x0065b70e in sqlite3_get_table (db=0x7fffe0023d08,
zSql=0x7fffc001a6e8 "SELECT * FROM sync_snapdb_table WHERE tobe_deleted
= 0 AND scn_not_visited < 30 AND 1 =
callback_cache_filter_check(record_id);",
pazResult=0x7fffdabfa110, pnRow=0x7fffdabfa16c, pnColumn=0x7fffdabfa168,
pzErrMsg=0x7fffdabfa118)
at /mytest/imports/3rdparty/sqlite/sqlite3.c:92643

After some investigation, i found that sqlite3_get_table_cb is called with
nAlloc equals to ~164856293,  a realloc is requested and nAlloc is now ~325
000 000
So sqlite3_realloc is called with  ~2 630 000 000, this value gives a
negative value because nAlloc is an int. In this case, sqlite3_realloc
releases the pointer.

Afterward in sqlite3_get_table at line 92643, this released pointer is used.

To fix i quickly added this line in sqlite3_get_table_cb before :

  if( p->nData + need > p->nAlloc ){
char **azNew;




* if (p->nAlloc >
(int)(0x3fff/sizeof(char*)-need*sizeof(char*))) {   goto
malloc_failed;  }*

  p->nAlloc = p->nAlloc*2 + need;
  azNew = sqlite3_realloc( p->azResult, sizeof(char*)*p->nAlloc );
...


Do you think this fix is right ?
Is it necessary to apply the same fix in other places?

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


Re: [sqlite] Sqlite Crash In Windows Kernel

2014-05-05 Thread Simon Slavin

On 5 May 2014, at 6:42am, NULL  wrote:

>  the attached files is the code i used,and the code would be cause system 
> crash when call like this,
>   sqlite3_exec(db, "create table hello(one varchar(10), two smallint)", 
> callback, 0, )

You cannot attach files to posts to this list.

SQlite does not have VARCHAR or SMALLINT types.  Your types will be understood 
as TEXT and INTEGER.

Check the values returned by all SQLite calls you make before the one which 
crashes.

Try the SQL commands you execute in the SQLite Shell Tool and see whether it 
executes them successfully or returns errors.

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


[sqlite] Sqlite Crash In Windows Kernel

2014-05-05 Thread NULL
Hi,

  the attached files is the code i used,and the code would be cause system 
crash when call like this,
   sqlite3_exec(db, "create table hello(one varchar(10), two smallint)", 
callback, 0, )





 A snapshot of call stack on crash is attached.




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


Re: [sqlite] sqlite crash info

2012-01-02 Thread Simon Slavin

On 1 Jan 2012, at 3:49pm, Lalitkumar Choudhary wrote:

> I want to know one thing about sqlite crashing, you had mentioned in your 
> document which i had found in your website(www.sqlite.org).
> Sqlite database will crash if you write some garbage value into the file.

Which document on that site did you find this information in ?

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


Re: [sqlite] sqlite crash info

2012-01-02 Thread Richard Hipp
On Sun, Jan 1, 2012 at 10:49 AM, Lalitkumar Choudhary <
lalitkumar.choudh...@lnties.com> wrote:

> Hi,
>
> I want to know one thing about sqlite crashing, you had mentioned in your
> document which i had found in your website(www.sqlite.org).
> Sqlite database will crash if you write some garbage value into the file.
> May i know exactly what is the garbage value? Is it any value different
> from datatype or anything else, can u please give one example?
>

The SQLite database engine will not crash or segfault or otherwise cause
your program to stop running if it encounters garbage data in a file.  But
it will return SQLITE_CORRUPT, indicating that your database is corrupt.


>
> Thanks & Regards
> Lalit Kumar Choudhary
> Software Engineer
> L Integrated Engineering Services
> KIADB, Hebbal Industrial Area
> Hootagalli, Mysore 570018, Karnataka
> Mob +91 9731003527
>
>
>
>
>
>
> Larsen & Toubro Limited
>
> www.larsentoubro.com
>
> This Email may contain confidential or privileged information for the
> intended recipient (s) If you are not the intended recipient, please do not
> use or disseminate the information, notify the sender and delete it from
> your system.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



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


Re: [sqlite] sqlite crash info

2012-01-02 Thread Stephan Beal
On Sun, Jan 1, 2012 at 4:49 PM, Lalitkumar Choudhary <
lalitkumar.choudh...@lnties.com> wrote:

> ...Sqlite database will crash if you write some garbage value into the
> file. May i know exactly what is the garbage value? Is it any value
> different from datatype or anything else, can u please give one example?
>

That wording does not mean a specific value, but is intended to mean
something like "if you modify the database file from outside the sqlite3
API, results are undefined" where "undefined" means "almost certainly
corruption."

For example:

echo "123" >> mydbfile

that could effectively corrupt it even though it doesn't actually modify
any bytes used by the db. (Whether or not that _does_ corrupt it depends
largely on how sqlite3 tracks the logical end-of-file.)

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] sqlite crash info

2012-01-02 Thread Lalitkumar Choudhary
Hi,

I want to know one thing about sqlite crashing, you had mentioned in your 
document which i had found in your website(www.sqlite.org).
Sqlite database will crash if you write some garbage value into the file. May i 
know exactly what is the garbage value? Is it any value different from datatype 
or anything else, can u please give one example?

Thanks & Regards
Lalit Kumar Choudhary
Software Engineer
L Integrated Engineering Services
KIADB, Hebbal Industrial Area
Hootagalli, Mysore 570018, Karnataka
Mob +91 9731003527






Larsen & Toubro Limited

www.larsentoubro.com

This Email may contain confidential or privileged information for the intended 
recipient (s) If you are not the intended recipient, please do not use or 
disseminate the information, notify the sender and delete it from your system.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite crash with "WHERE x in ()" query

2008-11-24 Thread Shane Harrelson
Thanks for the report.  The current test suite has many cases testing
queries of the form you mention.  I added one specifically for the query you
suggested to in4.test.   Everything passes for the current version.   If you
could test with the latest version of SQLite, it might help show where the
problem lies (in SQSLite, the Python bindings, or possibly in your
application code).   Most of the historical versions of SQLite are also
available from the website.  If this was a problem in an older version, but
not with the latest, it might be beneficial for you to try incremental
versions to find where it was fixed.

-Shane



On Fri, Nov 7, 2008 at 6:48 PM, Matt Craighead <
[EMAIL PROTECTED]> wrote:

> Hi all,
>
> I've hit what I believe may be a crash bug in SQLite.  I'm using the
> version
> bundled with Python 2.5.2 on Windows, which is SQLite 3.3.4, it would
> appear.  I know, this isn't the latest version, but this happens to be the
> version bundled with the version of Python my product relies on.  (I
> haven't
> switched to Python 2.6 yet; for one, there are no publicly available
> mod_python Win32 binaries for Apache.)
>
> Originally my query looked something like:
>
> SELECT x FROM table WHERE id IN (SELECT id FROM other_table WHERE y=1)
>
> I assumed this would do the subquery only once, but I found (both from slow
> performance and by using EXPLAIN QUERY PLAN) that in fact it was doing a
> full table scan of "table", and for each element, looking at its id to see
> whether that id could be found in other_table.
>
> On the other hand, if I did two separate queries, and wrote the second
> query
> as follows:
>
> SELECT x FROM table WHERE id IN (1,3,5,7)
>
> ...it would use table's index, which was a lot faster.  Unfortunately if
> the
> list of id's was empty, I'd end up constructing a query with a "WHERE x IN
> ()" clause -- and this would cause a crash deep in the guts of sqlite3.dll.
> Without symbols it wasn't clear where the crash was coming from.
>
> From the grammar diagram at http://www.sqlite.org/lang_expr.html, it would
> appear that using () for an empty list is not legal SQL syntax as
> recognized
> by SQLite.  Is that correct?  Even if so, it still shouldn't crash, right?
> I would think that it should consistently either produce an error, or
> consistently treat () as an empty set.  I don't get an error, and while
> sometimes it appears to be treated as an empty set, sometimes I get a
> crash.
>
> Oddly this crash doesn't happen all the time.  It only seems to happen for
> the following specific query:
>
> SELECT x FROM table
> WHERE id IN ()
> AND x IN (SELECT x FROM table2 WHERE id=)
> Any ideas?  Has this been fixed in a newer version already?  I've already
> worked around this and I no longer issue SQLite any "IN ()" queries, but I
> figured I'd still report the problem.
>
> --
> Matt Craighead
> Founder/CEO, Conifer Systems LLC
> http://www.conifersystems.com
> 512-772-1834
> ___
> 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] sqlite crash with "WHERE x in ()" query

2008-11-08 Thread Matt Craighead
Hi all,

I've hit what I believe may be a crash bug in SQLite.  I'm using the version
bundled with Python 2.5.2 on Windows, which is SQLite 3.3.4, it would
appear.  I know, this isn't the latest version, but this happens to be the
version bundled with the version of Python my product relies on.  (I haven't
switched to Python 2.6 yet; for one, there are no publicly available
mod_python Win32 binaries for Apache.)

Originally my query looked something like:

SELECT x FROM table WHERE id IN (SELECT id FROM other_table WHERE y=1)

I assumed this would do the subquery only once, but I found (both from slow
performance and by using EXPLAIN QUERY PLAN) that in fact it was doing a
full table scan of "table", and for each element, looking at its id to see
whether that id could be found in other_table.

On the other hand, if I did two separate queries, and wrote the second query
as follows:

SELECT x FROM table WHERE id IN (1,3,5,7)

...it would use table's index, which was a lot faster.  Unfortunately if the
list of id's was empty, I'd end up constructing a query with a "WHERE x IN
()" clause -- and this would cause a crash deep in the guts of sqlite3.dll.
Without symbols it wasn't clear where the crash was coming from.

>From the grammar diagram at http://www.sqlite.org/lang_expr.html, it would
appear that using () for an empty list is not legal SQL syntax as recognized
by SQLite.  Is that correct?  Even if so, it still shouldn't crash, right?
I would think that it should consistently either produce an error, or
consistently treat () as an empty set.  I don't get an error, and while
sometimes it appears to be treated as an empty set, sometimes I get a crash.

Oddly this crash doesn't happen all the time.  It only seems to happen for
the following specific query:

SELECT x FROM table
WHERE id IN ()
AND x IN (SELECT x FROM table2 WHERE id=)
Any ideas?  Has this been fixed in a newer version already?  I've already
worked around this and I no longer issue SQLite any "IN ()" queries, but I
figured I'd still report the problem.

-- 
Matt Craighead
Founder/CEO, Conifer Systems LLC
http://www.conifersystems.com
512-772-1834
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Sqlite crash in two lines...

2007-08-15 Thread Christopher J. McKenzie
Ok great - I guess I need to check for upgrades more often.  And as for 
what I was doing - well I have a program that generates queries (not 
very well it appears) and it would occasionally crash - when I tracked 
the bug down I was able to simplify it to two lines. 


Samuel R. Neff wrote:

I get a crash with 3.3.12 but correct syntax error in 3.4.2 on Windows XP
using exe's downloaded from sqlite.org.

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\sam>sqlite3
SQLite version 3.3.12
Enter ".help" for instructions
sqlite> create table test(field text);
sqlite> select * from test group by distinct field;

Crash.  Windows creates a dmp file but I can't copy it or do anything with
it (says in use).  All I can do is send it to Microsoft--think they'd help?
;)

Downloaded newer exe and...


Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\sam>sqlite3
SQLite version 3.4.2
Enter ".help" for instructions
sqlite> create table test(field text);
sqlite> select * from test group by distinct field;
SQL error: near "distinct": syntax error
sqlite>

No crash.

Not sure what the OP is even trying to accomplish though.. it's certainly
not valid SQL.

Sam


---
We're Hiring! Seeking a passionate developer to join our team building
products. Position is in the Washington D.C. metro area. If interested
contact [EMAIL PROTECTED]
 



-
To unsubscribe, send email to [EMAIL PROTECTED]
-

  



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Sqlite crash in two lines...

2007-08-15 Thread Christopher J. McKenzie

I was using sqlite3.exe on windows xp when I discovered it.
Then, for confirmation, I ran the same set of commands on the same 
version of sqlite3 (a version I think I compiled) on a linux machine and 
got the same thing.
Then, for further confirmation, I *also* ran it on a FreeBSD machine 
(where it was compiled from the ports collection) and got the same problem.


I can send you the coredump from each machine if you want.

[EMAIL PROTECTED] wrote:

"Christopher J. McKenzie" <[EMAIL PROTECTED]> wrote:
  

Try this:

$ sqlite3
SQLite version 3.4.0
Enter ".help" for instructions
sqlite> create table test (field text);
sqlite> select * from test group by distinct field;
Segmentation fault
$




I get:

SQLite version 3.4.0
Enter ".help" for instructions
sqlite> create table test(field text);
sqlite> select * from test group by distinct field;
SQL error: near "distinct": syntax error
sqlite> 


So did you compile SQLite yourself or did you use
a prebuilt binary?

--
D. Richard Hipp <[EMAIL PROTECTED]>


-
To unsubscribe, send email to [EMAIL PROTECTED]
-


  



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] Sqlite crash in two lines...

2007-08-15 Thread Christopher J. McKenzie

Try this:

$ sqlite3
SQLite version 3.4.0
Enter ".help" for instructions
sqlite> create table test (field text);
sqlite> select * from test group by distinct field;
Segmentation fault
$

oops... Any idea?

~chris.

-
To unsubscribe, send email to [EMAIL PROTECTED]
-