[sqlite] sqlite3DbMallocRaw problem

2012-09-09 Thread David Levinson
All,

In the sqlite3DbMallocRaw() function I just encountered a failure where pBuf is 
undefined and causes a crash on db-lookaside.pFree = pBuf-pNext.  I see 
that pBuf is created (not initialized) and then later a check is made for pBuf 
(null) - pNext and poof my app crashes. I have no idea how to replicate this 
issue but it happens randomly why creating prepared statements over and over 
very quickly for many hours but that may just be dumb luck.

LookasideSlot *pBuf;
if( db-mallocFailed ){
  return 0;
}
if( db-lookaside.bEnabled ){
  if( ndb-lookaside.sz ){
db-lookaside.anStat[1]++;
  }else if( (pBuf = db-lookaside.pFree)==0 ){
db-lookaside.anStat[2]++;
  }else{
db-lookaside.pFree = pBuf-pNext;

should I recompile with the SQLITE_OMIT_LOOKASIDE enabled?

Thanks,

Dave.



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


Re: [sqlite] sqlite3DbMallocRaw problem

2012-09-09 Thread David Levinson
All,

I wanted to revise my last email regarding the failure within 
sqlite3DbMallocRaw() ... The point of failure is  db-lookaside.pFree = 
pBuf-pNext; and it appears that pBuf points to an invalid memory location 
since Windows report a memory access violation.  Does anyone know how to 
correct this?

LookasideSlot *pBuf;
if( db-mallocFailed ){
  return 0;
}
if( db-lookaside.bEnabled ){
  if( ndb-lookaside.sz ){
db-lookaside.anStat[1]++;
  }else if( (pBuf = db-lookaside.pFree)==0 ){
db-lookaside.anStat[2]++;
  }else{
db-lookaside.pFree = pBuf-pNext;

should I recompile with the SQLITE_OMIT_LOOKASIDE enabled?

Thanks,

Dave.



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


[sqlite] SQLite Locking Issue From Another Process

2011-11-23 Thread David Levinson
We have Process A which writes constantly to our SQLite database and we
have Process B which occasionally reads from this same database. When
Process B opens the database for read-only access and performs a select
statement on the database it causes Process A to get SQLITE_BUSY errors
when executing the insert statements and will continue to return busy
until Process B closes the connection to the database. 

 

So my basic question is why is Process B locking the database when it is
opening the file for read-only access and not performing any writes on
the database being written to by Process A. 

 

Is it possible that a select statement can lock a table?

 

Thanks,

 

Dave.

 

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


Re: [sqlite] SQLITE3 - sqlite3_step bug?

2010-11-13 Thread David Levinson
Richard,,

 

I don't know if this helps but here is a stack track while the code
appears to be stuck in a loop...

 

winRead(sqlite3_file * id=0x04418048, void *
pBuf=0x0487d10c, int amt=1024, __int64 offset=3043618816)  Line 27073 +
0x1c bytes  C

sqlite3OsRead(sqlite3_file * id=0x04418048, void *
pBuf=0x0487d10c, int amt=1024, __int64 offset=3043618816)  Line 11852 +
0x20 bytes C

readDbPage(PgHdr * pPg=0x0487d098)  Line 34007 + 0x21
bytes   C

sqlite3PagerAcquire(Pager * pPager=0x04417f68, unsigned
int pgno=2972285, PgHdr * * ppPage=0x0012e720, int noContent=0)  Line
34403 + 0x9 bytesC

sqlite3BtreeGetPage(BtShared * pBt=0x04417c78, unsigned
int pgno=2972285, MemPage * * ppPage=0x0012e920, int noContent=0)  Line
38145 + 0x17 bytesC

getAndInitPage(BtShared * pBt=0x04417c78, unsigned int
pgno=2972285, MemPage * * ppPage=0x0012e920)  Line 38211 + 0x13 bytes
C

moveToChild(BtCursor * pCur=0x0482f1c8, unsigned int
newPgno=2972285)  Line 40616 + 0x11 bytes C

moveToLeftmost(BtCursor * pCur=0x0482f1c8)  Line 40747 +
0xd bytes C

sqlite3BtreeNext(BtCursor * pCur=0x0482f1c8, int *
pRes=0x0012ed98)  Line 41151 + 0x9 bytes C

sqlite3BtreeNext(BtCursor * pCur=0x0482f1c8, int *
pRes=0x0012ed98)  Line 41141 + 0xd bytes C

sqlite3VdbeExec(Vdbe * p=0x0482f7c8)  Line 54960 + 0x1e
bytes  C

sqlite3Step(Vdbe * p=0x0482f7c8)  Line 49388 + 0x9 bytes
C

sqlite3_step(sqlite3_stmt * pStmt=0x0482f7c8)  Line
49449 + 0x9 bytes C

 

From: drhsql...@gmail.com [mailto:drhsql...@gmail.com] On Behalf Of
Richard Hipp
Sent: Friday, November 12, 2010 1:17 PM
To: David Levinson; sqlite-users@sqlite.org
Subject: Re: SQLITE3 - sqlite3_step bug?

 

 

On Fri, Nov 12, 2010 at 1:06 PM, David Levinson dlevin...@worldnow.com
wrote:

I have an 11GB database and when I attempt to query the database for the
max(column) value the code within sqlite3_step() gets stuck in a loop
for hours and hours and never seems to return. 

 

Do you know why this is the case and how it can be resolved? I stepped
into the code and all I see page allocations getting created over and
over and over. I just updated to the latest sqlite3 updates and the
issue continues. 

 

My sense is that this is something related to 64 bit indexes. Could this
be?


If column is not indexed, then SQLite has to loop through all 11GB of
your database file looking for the maximum value.  That can take time
(though measured in 10s of seconds, not hours).

What does it say if you prepend EXPLAIN QUERY PLAN to the beginning of
your query?






-- 
D. Richard Hipp
d...@sqlite.org

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