[sqlite] Segmentation faults when calling sqlite3_step

2015-06-30 Thread Leroy Klompenhouwer
Eric,

We don't use text or blob fields only double, int and int64 types. Can we 
assume that all the other binds besides the text and blob are directly copied?

Leroy


-Oorspronkelijk bericht-
Van: sqlite-users-bounces at mailinglists.sqlite.org 
[mailto:sqlite-users-bounces at mailinglists.sqlite.org] Namens Eric Hill
Verzonden: dinsdag 30 juni 2015 16:10
Aan: General Discussion of SQLite Database
Onderwerp: Re: [sqlite] Segmentation faults when calling sqlite3_step

If you are calling sqlite3_bind_ to bind parameters, what are you passing 
as the last parameter? Try SQLITE_TRANSIENT to force SQLite to make a copy of 
the value right away.  Maybe currently you have values going out of scope 
before step is called.

Eric

From: Leroy Klompenhouwer<mailto:l.klompenhou...@tmx.nl>
Sent: ?6/?30/?2015 9:18 AM
To: sqlite-users at mailinglists.sqlite.org<mailto:sqlite-users at 
mailinglists.sqlite.org>
Subject: [sqlite] Segmentation faults when calling sqlite3_step

We are experiencing random segmentation faults when calling the function 
sqlite3_step(). We use prepared statements in a transaction to insert records 
in the database.

We have the following setup:

- SQLite3.8.9
- Linux 32bit
- Armv6
- SDCard with ext3 to store the database


Can anyone explain what is happening?


Leroy


Coredump output

#0  0x407ddfb8 in pcache1RemoveFromHash (pPage=pPage at entry=0x5408a100) at 
sqlite3.c:40329

#1  0x407ef850 in pcache1FetchStage2 (pCache=pCache at entry=0x534ebca0, 
iKey=iKey at entry=78573, createFlag=createFlag at entry=2) at sqlite3.c:40569

#2  0x407efa80 in pcache1Fetch (p=0x534ebca0, iKey=78573, createFlag=2) at 
sqlite3.c:40694

#3  0x40816690 in sqlite3PcacheFetchStress (ppPage=, 
pgno=78573, pCache=0x5391f120) at sqlite3.c:39495

#4  sqlite3PagerAcquire (pPager=0x5391f048, pgno=pgno at entry=78573, 
ppPage=0x4ab31474, ppPage at entry=0x4ab3146c, flags=0) at sqlite3.c:46910

#5  0x40816a28 in btreeGetPage (pBt=0x43c00b50, pgno=78573, ppPage=ppPage at 
entry=0x4ab31544, flags=) at sqlite3.c:54735

#6  0x40816a7c in getAndInitPage (pBt=, pgno=, 
ppPage=0x4ab31544, bReadonly=) at sqlite3.c:54790

#7  0x4081a9e0 in balance_nonroot (bBulk=, isRoot=0, 
aOvflSpace=0x54174710 "\310.\234SP\v\300C\320E\027T", iParentIdx=, pParent=0x53a436e8) at sqlite3.c:59731

#8  balance (pCur=0x0, pCur at entry=0x4080e1b0 ) at 
sqlite3.c:60469

#9  0x4081da60 in sqlite3BtreeInsert (pCur=0x4080e1b0 , 
pKey=, nKey=, pData=0x4086d778, nData=nData at 
entry=0, nZero=nZero at entry=0, appendBias=appendBias at entry=0,

seekResult=0) at sqlite3.c:60655

#10 0x4083adb4 in sqlite3VdbeExec (p=0x3, p at entry=0x53ffb940) at 
sqlite3.c:75444

#11 0x4083e828 in sqlite3Step (p=0x53ffb940) at sqlite3.c:69347

#12 sqlite3_step (pStmt=) at sqlite3.c:3877

#13 sqlite3_step (pStmt=) at sqlite3.c:3864


Detailed output:

#0  0x407ddfb8 in pcache1RemoveFromHash (pPage=pPage at entry=0x5408a100) at 
sqlite3.c:40329

h = 

pCache = 0x534ebca0

pp = 0x7df

#1  0x407ef850 in pcache1FetchStage2 (pCache=pCache at entry=0x534ebca0, 
iKey=iKey at entry=78573, createFlag=createFlag at entry=2) at sqlite3.c:40569

pOther = 

nPinned = 

pGroup = 0x534ebcd0

pPage = 0x5408a100

#2  0x407efa80 in pcache1Fetch (p=0x534ebca0, iKey=78573, createFlag=2) at 
sqlite3.c:40694

pCache = 0x534ebca0

pPage = 0x0

#3  0x40816690 in sqlite3PcacheFetchStress (ppPage=, 
pgno=78573, pCache=0x5391f120) at sqlite3.c:39495

pPg = 

#4  sqlite3PagerAcquire (pPager=0x5391f048, pgno=pgno at entry=78573, 
ppPage=0x4ab31474, ppPage at entry=0x4ab3146c, flags=0) at sqlite3.c:46910

pBase = 

rc = 0

pPg = 0x0

iFrame = 1082188208

noContent = 0

bMmapOk = 

#5  0x40816a28 in btreeGetPage (pBt=0x43c00b50, pgno=78573, ppPage=ppPage at 
entry=0x4ab31544, flags=) at sqlite3.c:54735

rc = 1399798980

pDbPage = 0x40816a28 <btreeGetPage+32>

#6  0x40816a7c in getAndInitPage (pBt=, pgno=, 
ppPage=0x4ab31544, bReadonly=) at sqlite3.c:54790

rc = 

#7  0x4081a9e0 in balance_nonroot (bBulk=, isRoot=0, 
aOvflSpace=0x54174710 "\310.\234SP\v\300C\320E\027T", iParentIdx=, pParent=0x53a436e8) at sqlite3.c:59731

leafCorrection = 

leafData = 

pageFlags = 

apOld = {0x, 0x53bc8de8, 0x533c2520}

aSpace1 = 

pBt = 0x43c00b50

nMaxCells = 1403269792

subtotal = 

szScratch = 

pRight = 0x2 

nNew = 0

nxDiv = 0

iOvflSpace = 0

cntOld = {80464896, 0, 0, 78580, 1403366712}

apCell = 0x0

i = 0

apNew = {0x5391f048, 0x4cbcc00, 0x0, 0x0, 0x53a5ad38}

abDone = "\000\000\000\000"

aPgno = {1402073376, 78580, 1402073376, 1715, 6}

aPgOrder = {1087295488, 0, 124, 0, 1136659280}

 

[sqlite] Segmentation faults when calling sqlite3_step

2015-06-30 Thread Leroy Klompenhouwer
We are experiencing random segmentation faults when calling the function 
sqlite3_step(). We use prepared statements in a transaction to insert records 
in the database. 

We have the following setup: 

- SQLite3.8.9
- Linux 32bit
- Armv6
- SDCard with ext3 to store the database

?
Can anyone explain what is happening?

?
Leroy 

?
Coredump output

#0? 0x407ddfb8 in pcache1RemoveFromHash (pPage=pPage at entry=0x5408a100) at 
sqlite3.c:40329

#1? 0x407ef850 in pcache1FetchStage2 (pCache=pCache at entry=0x534ebca0, 
iKey=iKey at entry=78573, createFlag=createFlag at entry=2) at sqlite3.c:40569

#2? 0x407efa80 in pcache1Fetch (p=0x534ebca0, iKey=78573, createFlag=2) at 
sqlite3.c:40694

#3? 0x40816690 in sqlite3PcacheFetchStress (ppPage=, 
pgno=78573, pCache=0x5391f120) at sqlite3.c:39495

#4? sqlite3PagerAcquire (pPager=0x5391f048, pgno=pgno at entry=78573, 
ppPage=0x4ab31474, ppPage at entry=0x4ab3146c, flags=0) at sqlite3.c:46910

#5? 0x40816a28 in btreeGetPage (pBt=0x43c00b50, pgno=78573, ppPage=ppPage at 
entry=0x4ab31544, flags=) at sqlite3.c:54735

#6? 0x40816a7c in getAndInitPage (pBt=, pgno=, 
ppPage=0x4ab31544, bReadonly=) at sqlite3.c:54790

#7? 0x4081a9e0 in balance_nonroot (bBulk=, isRoot=0, 
aOvflSpace=0x54174710 "\310.\234SP\v\300C\320E\027T", iParentIdx=, pParent=0x53a436e8) at sqlite3.c:59731

#8? balance (pCur=0x0, pCur at entry=0x4080e1b0 ) at 
sqlite3.c:60469

#9? 0x4081da60 in sqlite3BtreeInsert (pCur=0x4080e1b0 , 
pKey=, nKey=, pData=0x4086d778, nData=nData at 
entry=0, nZero=nZero at entry=0, appendBias=appendBias at entry=0, 

seekResult=0) at sqlite3.c:60655

#10 0x4083adb4 in sqlite3VdbeExec (p=0x3, p at entry=0x53ffb940) at 
sqlite3.c:75444

#11 0x4083e828 in sqlite3Step (p=0x53ffb940) at sqlite3.c:69347

#12 sqlite3_step (pStmt=) at sqlite3.c:3877

#13 sqlite3_step (pStmt=) at sqlite3.c:3864

?
Detailed output:

#0? 0x407ddfb8 in pcache1RemoveFromHash (pPage=pPage at entry=0x5408a100) at 
sqlite3.c:40329

??? h = 

??? pCache = 0x534ebca0

??? pp = 0x7df

#1? 0x407ef850 in pcache1FetchStage2 (pCache=pCache at entry=0x534ebca0, 
iKey=iKey at entry=78573, createFlag=createFlag at entry=2) at sqlite3.c:40569

??? pOther = 

??? nPinned = 

??? pGroup = 0x534ebcd0

??? pPage = 0x5408a100

#2? 0x407efa80 in pcache1Fetch (p=0x534ebca0, iKey=78573, createFlag=2) at 
sqlite3.c:40694

??? pCache = 0x534ebca0

??? pPage = 0x0

#3? 0x40816690 in sqlite3PcacheFetchStress (ppPage=, 
pgno=78573, pCache=0x5391f120) at sqlite3.c:39495

??? pPg = 

#4? sqlite3PagerAcquire (pPager=0x5391f048, pgno=pgno at entry=78573, 
ppPage=0x4ab31474, ppPage at entry=0x4ab3146c, flags=0) at sqlite3.c:46910

??? pBase = 

??? rc = 0

??? pPg = 0x0

??? iFrame = 1082188208

??? noContent = 0

??? bMmapOk = 

#5? 0x40816a28 in btreeGetPage (pBt=0x43c00b50, pgno=78573, ppPage=ppPage at 
entry=0x4ab31544, flags=) at sqlite3.c:54735

??? rc = 1399798980

??? pDbPage = 0x40816a28 

#6? 0x40816a7c in getAndInitPage (pBt=, pgno=, 
ppPage=0x4ab31544, bReadonly=) at sqlite3.c:54790

??? rc = 

#7? 0x4081a9e0 in balance_nonroot (bBulk=, isRoot=0, 
aOvflSpace=0x54174710 "\310.\234SP\v\300C\320E\027T", iParentIdx=, pParent=0x53a436e8) at sqlite3.c:59731

??? leafCorrection = 

??? leafData = 

??? pageFlags = 

??? apOld = {0x, 0x53bc8de8, 0x533c2520}

??? aSpace1 = 

??? pBt = 0x43c00b50

??? nMaxCells = 1403269792

??? subtotal = 

??? szScratch = 

??? pRight = 0x2 

??? nNew = 0

??? nxDiv = 0

??? iOvflSpace = 0

??? cntOld = {80464896, 0, 0, 78580, 1403366712}

??? apCell = 0x0

??? i = 0

??? apNew = {0x5391f048, 0x4cbcc00, 0x0, 0x0, 0x53a5ad38}

??? abDone = "\000\000\000\000"

??? aPgno = {1402073376, 78580, 1402073376, 1715, 6}

??? aPgOrder = {1087295488, 0, 124, 0, 1136659280}

??? j = 

??? rc = 0

??? iSpace1 = 0

??? szNew = {17, 17, 1082063336, 78580, 1402073160}

??? pgno = 1403366712

??? k = 

??? apDiv = {0x5418e14f "", 0x5418e13e ""}

??? cntNew = {1404621896, 746250, 0, 65540, 1082010372}

??? szCell = 

??? nCell = 0

??? nOld = 1403269800

??? usableSpace = 

??? aPgFlags = {46552, 21503, 2, 0, 5456}

#8? balance (pCur=0x0, pCur at entry=0x4080e1b0 ) at 
sqlite3.c:60469

??? pSpace = 0x5418def8 "\350\336\030T\350\336\030Tl"

??? pParent = 0x53a436e8

??? iIdx = 

??? iPage = 1253250376

??? pPage = 0x18

??? rc = 

??? nMin = 3

??? aBalanceQuickSpace = "\210h\266 at N\001\000\000\004\000\001@("

??? pFree = 0x17 

#9? 0x4081da60 in sqlite3BtreeInsert (pCur=0x4080e1b0 , 
pKey=, nKey=, pData=0x4086d778, nData=nData at 
entry=0, nZero=nZero at entry=0, appendBias=appendBias at entry=0, 

seekResult=0) at sqlite3.c:60655

??? rc = 13

??? loc = 1082629864

??? szNew = 1410121556

??? idx = 

??? pPage = 0x0