Re: [sqlite] fulltest *malloc* test failures

2009-01-19 Thread BardzoTajneKonto
 These are simulated malloc() failures.  They are important for embedded  
 devices (which tend to run out of memory) but not so much on Solaris.   
 When was the last time you remember that malloc() really failed on a  
 workstation or a server? 
 
It's very easy to cause malloc failure on 32 bit desktop computer. Especially 
using sqlite configured to use about 800M cache inside jvm with large -Xmx. 
Unfortunaltelly jvm crashes after a malloc failure. Sqlite usually simply 
returns out of memory however I'v experienced several crashes caused by 
sqlite (I'm using old version, problems I'v seen were already corrected long 
time ago). 

---
Promocja w Speak Up. Kwartal angielskiego za darmo. 
3 miesiace nauki gratis. Sprawdz teraz!  http://link.interia.pl/f2019

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


[sqlite] fulltest *malloc* test failures

2009-01-16 Thread Nicolas Williams
Failures on these tests: malloc-1.transient.40 malloc-10.transient.40
 malloc-14.transient.40 malloc-17.transient.41
 malloc-20.transi ent.40 malloc-26.transient.40

malloc-1.transient.40...
Expected: [1 1]
 Got: [0 {1 2.3 4.5 hi there^@ 6 7.0 0.8 hello {out yonder} 1 {out yonder} 
7.0}]
malloc-10.transient.40...
Expected: [1 1]
 Got: [0 {}]
malloc-14.transient.40...
Expected: [1 1]
 Got: [0 {1 2}]
malloc-17.transient.41...
Expected: [1 1]
 Got: [0 0]
malloc-20.transient.40...
Expected: [1 1]
 Got: [0 {}]
malloc-26.transient.40...
Expected: [1 1]
 Got: [0 {}]

What do those mean?  Are these errors a problem?

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


Re: [sqlite] fulltest *malloc* test failures

2009-01-16 Thread D. Richard Hipp

On Jan 16, 2009, at 12:58 PM, Nicolas Williams wrote:

 Failures on these tests: malloc-1.transient.40 malloc-10.transient.40
malloc-14.transient.40 malloc-17.transient.41
 malloc-20.transi ent.40 malloc-26.transient.40

 malloc-1.transient.40...
 Expected: [1 1]
 Got: [0 {1 2.3 4.5 hi there^@ 6 7.0 0.8 hello {out yonder} 1  
 {out yonder} 7.0}]
 malloc-10.transient.40...
 Expected: [1 1]
 Got: [0 {}]
 malloc-14.transient.40...
 Expected: [1 1]
 Got: [0 {1 2}]
 malloc-17.transient.41...
 Expected: [1 1]
 Got: [0 0]
 malloc-20.transient.40...
 Expected: [1 1]
 Got: [0 {}]
 malloc-26.transient.40...
 Expected: [1 1]
 Got: [0 {}]

 What do those mean?  Are these errors a problem?


These are simulated malloc() failures.  They are important for  
embedded devices (which tend to run out of memory) but not so much on  
Solaris.  When was the last time you remember that malloc() really  
failed on a workstation or a server?

The errors you are getting seem to indicate that the memory allocation  
problems are simply not getting reported back up to the top-level.   
SQLite is able to complete whatever it was doing in spite of malloc()  
returning NULL.  I do not know why.  If you want to try to debug the  
problem, set a breakpoint on the routine sqlite3Fault() for the test  
case that is given a problem. The sqlite3Fault() routine is called  
whenever one of the simulated malloc() failures occurs.  Then look at  
the stack to see where the problem is occurring.

D. Richard Hipp
d...@hwaci.com



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


Re: [sqlite] fulltest *malloc* test failures

2009-01-16 Thread Dan

On Jan 17, 2009, at 12:58 AM, Nicolas Williams wrote:

 Failures on these tests: malloc-1.transient.40 malloc-10.transient.40
malloc-14.transient.40 malloc-17.transient.41
 malloc-20.transi ent.40 malloc-26.transient.40

 malloc-1.transient.40...
 Expected: [1 1]
 Got: [0 {1 2.3 4.5 hi there^@ 6 7.0 0.8 hello {out yonder} 1  
 {out yonder} 7.0}]
 malloc-10.transient.40...
 Expected: [1 1]
 Got: [0 {}]
 malloc-14.transient.40...
 Expected: [1 1]
 Got: [0 {1 2}]
 malloc-17.transient.41...
 Expected: [1 1]
 Got: [0 0]
 malloc-20.transient.40...
 Expected: [1 1]
 Got: [0 {}]
 malloc-26.transient.40...
 Expected: [1 1]
 Got: [0 {}]

 What do those mean?  Are these errors a problem?

Are you compiling with SQLITE_ENABLE_FTS3 defined?

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


Re: [sqlite] fulltest *malloc* test failures

2009-01-16 Thread Nicolas Williams
On Fri, Jan 16, 2009 at 01:14:28PM -0500, D. Richard Hipp wrote:
  What do those mean?  Are these errors a problem?
 
 These are simulated malloc() failures.  They are important for  
 embedded devices (which tend to run out of memory) but not so much on  
 Solaris.  When was the last time you remember that malloc() really  
 failed on a workstation or a server?

That's what I expected, but you should know that on Solaris malloc() can
fail with ENOMEM.  On Linux malloc() typically never fails, as Linux
takes the OOM killer approach.

 The errors you are getting seem to indicate that the memory allocation  
 problems are simply not getting reported back up to the top-level.   
 SQLite is able to complete whatever it was doing in spite of malloc()  
 returning NULL.  I do not know why.  If you want to try to debug the  

Is that a problem?

 problem, set a breakpoint on the routine sqlite3Fault() for the test  
 case that is given a problem. The sqlite3Fault() routine is called  
 whenever one of the simulated malloc() failures occurs.  Then look at  
 the stack to see where the problem is occurring.

Using DTrace I see lots of calls to sqlite3Fault(), so I used
speculative tracing to grab the stacktrace of sqlite3Fault() calls that
were followed by writes to stdout of \nExpected: ... and got these
stack traces for those test failures (DTrace script attached):

CPU IDFUNCTION:NAME
  1  61477   sqlite3Fault:entry
  testfixture`sqlite3Fault
  testfixture`faultsimStep+0x27
  testfixture`faultsimMalloc+0xe
  testfixture`mallocWithAlarm+0x5d
  testfixture`sqlite3Malloc+0x42
  testfixture`sqlite3DbMallocRaw+0x70  
  testfixture`sqlite3DbMallocZero+0x14 
  testfixture`sqlite3FindFunction+0xca 
  testfixture`sqlite3CreateFunc+0x13c
  testfixture`sqlite3_create_function+0x31
  testfixture`sqlite3Fts3ExprInitTestInterface+0x22
  testfixture`sqlite3Fts3Init+0x99
  testfixture`openDatabase+0x320
  testfixture`sqlite3_open_v2+0x18
  testfixture`DbMain+0x2b1
  libtcl8.4.so`TclEvalObjvInternal+0x200
  libtcl8.4.so`TclExecuteByteCode+0x1199
  libtcl8.4.so`TclCompEvalObj+0x112
  libtcl8.4.so`Tcl_EvalObjEx+0x69
  libtcl8.4.so`Tcl_CatchObjCmd+0x43

  0  61477   sqlite3Fault:entry
  testfixture`sqlite3Fault
  testfixture`faultsimStep+0x27
  testfixture`faultsimMalloc+0xe
  testfixture`mallocWithAlarm+0x5d
  testfixture`sqlite3Malloc+0x42
  testfixture`sqlite3DbMallocRaw+0x70
  testfixture`sqlite3DbMallocZero+0x14
  testfixture`sqlite3FindFunction+0xca
  testfixture`sqlite3CreateFunc+0x13c
  testfixture`sqlite3_create_function+0x31
  testfixture`sqlite3Fts3ExprInitTestInterface+0x22
  testfixture`sqlite3Fts3Init+0x99
  testfixture`openDatabase+0x320
  testfixture`sqlite3_open_v2+0x18
  testfixture`DbMain+0x2b1
  libtcl8.4.so`TclEvalObjvInternal+0x200
  libtcl8.4.so`TclExecuteByteCode+0x1199
  libtcl8.4.so`TclCompEvalObj+0x112
  libtcl8.4.so`Tcl_EvalObjEx+0x69
  libtcl8.4.so`Tcl_CatchObjCmd+0x43

  0  61477   sqlite3Fault:entry
  testfixture`sqlite3Fault
  testfixture`faultsimStep+0x27
  testfixture`faultsimMalloc+0xe
  testfixture`mallocWithAlarm+0x5d
  testfixture`sqlite3Malloc+0x42
  testfixture`sqlite3DbMallocRaw+0x70
  testfixture`sqlite3DbMallocZero+0x14
  testfixture`sqlite3FindFunction+0xca
  testfixture`sqlite3CreateFunc+0x13c
  testfixture`sqlite3_create_function+0x31
  testfixture`sqlite3Fts3ExprInitTestInterface+0x22
  testfixture`sqlite3Fts3Init+0x99
  testfixture`openDatabase+0x320
  testfixture`sqlite3_open16+0x51
  testfixture`test_open16+0x2e
  libtcl8.4.so`TclEvalObjvInternal+0x200
  libtcl8.4.so`TclExecuteByteCode+0x1199
  libtcl8.4.so`TclCompEvalObj+0x112
  libtcl8.4.so`Tcl_EvalObjEx+0x69
  libtcl8.4.so`Tcl_CatchObjCmd+0x43

  0  61477   sqlite3Fault:entry
  testfixture`sqlite3Fault
  testfixture`faultsimStep+0x27
  testfixture`faultsimMalloc+0xe
  testfixture`mallocWithAlarm+0x5d
  testfixture`sqlite3Malloc+0x42
  testfixture`sqlite3DbMallocRaw+0x70
  testfixture`sqlite3DbMallocZero+0x14
  testfixture`sqlite3FindFunction+0xca
  testfixture`sqlite3CreateFunc+0x13c
  testfixture`sqlite3_create_function+0x31
 

Re: [sqlite] fulltest *malloc* test failures

2009-01-16 Thread Nicolas Williams
On Sat, Jan 17, 2009 at 02:04:47AM +0700, Dan wrote:
  What do those mean?  Are these errors a problem?
 
 Are you compiling with SQLITE_ENABLE_FTS3 defined?

Yes.  Would that make a difference?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] fulltest *malloc* test failures

2009-01-16 Thread D. Richard Hipp

On Jan 16, 2009, at 2:07 PM, Nicolas Williams wrote:

 On Sat, Jan 17, 2009 at 02:04:47AM +0700, Dan wrote:
 What do those mean?  Are these errors a problem?

 Are you compiling with SQLITE_ENABLE_FTS3 defined?

 Yes.  Would that make a difference?

Yes.  FTS3 is not robust against malloc failures.  FTS3 will sometimes  
segfault following a malloc failure.  This is a known issue.  We are  
working on it.

D. Richard Hipp
d...@hwaci.com



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


Re: [sqlite] fulltest *malloc* test failures

2009-01-16 Thread Nicolas Williams
On Fri, Jan 16, 2009 at 02:22:35PM -0500, D. Richard Hipp wrote:
 
 On Jan 16, 2009, at 2:07 PM, Nicolas Williams wrote:
 
  On Sat, Jan 17, 2009 at 02:04:47AM +0700, Dan wrote:
  What do those mean?  Are these errors a problem?
 
  Are you compiling with SQLITE_ENABLE_FTS3 defined?
 
  Yes.  Would that make a difference?
 
 Yes.  FTS3 is not robust against malloc failures.  FTS3 will sometimes  
 segfault following a malloc failure.  This is a known issue.  We are  
 working on it.

Is that true only when one uses FTS3?

Or is it true if FTS3 is compiled in even if one does not use it?

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


Re: [sqlite] fulltest *malloc* test failures

2009-01-16 Thread Nicolas Williams
Is it safe to ship 3.6.10 with FTS3 compiled in?

Oh, I've found ticket #2762, which helps explain what I'm seeing.

Basically, SQLite 3.6.9 (haven't tried 3.6.10 yet, though obviously I
must) and earlier had bugs in FTS3 where FTS3 was using malloc()/
free()/... directly from libc instead of sqlite3_malloc()/
sqlite3_free()/...  When you could this with fault injection during
memory management tests via sqlite3Fault() then bad things happen.

I suppose that just the fix for ticket #2762 may not be enough, but it
sounds like a great start.

BTW, how can I tell which releases have a given check-in?

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


Re: [sqlite] fulltest *malloc* test failures

2009-01-16 Thread D. Richard Hipp

On Jan 16, 2009, at 2:24 PM, Nicolas Williams wrote:

 On Fri, Jan 16, 2009 at 02:22:35PM -0500, D. Richard Hipp wrote:

 On Jan 16, 2009, at 2:07 PM, Nicolas Williams wrote:

 On Sat, Jan 17, 2009 at 02:04:47AM +0700, Dan wrote:
 What do those mean?  Are these errors a problem?

 Are you compiling with SQLITE_ENABLE_FTS3 defined?

 Yes.  Would that make a difference?

 Yes.  FTS3 is not robust against malloc failures.  FTS3 will  
 sometimes
 segfault following a malloc failure.  This is a known issue.  We are
 working on it.

 Is that true only when one uses FTS3?

 Or is it true if FTS3 is compiled in even if one does not use it?


I think FTS3 only mallocs() if you use it.  But I haven't really  
checked, so I don't know for certain.


D. Richard Hipp
d...@hwaci.com



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