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     ID                    FUNCTION: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
              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

#!/usr/sbin/dtrace -s

pid$1::sqlite3Fault:entry
/!self->spec/
{
        self->spec = speculation();
}

pid$1::sqlite3Fault:entry
/self->spec/
{
        speculate(self->spec);
        ustack();
}

syscall::write:entry
/pid == $1 && arg0 == 1 && arg2 > 3/
{
        self->str1 = stringof(copyin(arg1, 3));
}

syscall::write:entry
/pid == $1 && arg0 == 1 && arg2 > 3/
{
        self->str2 = stringof(copyin(arg1, arg2));
}

syscall::write:entry
/self->str1 == " Ok"/
{
        discard(self->spec);
        self->spec = 0;
}

syscall::write:entry
/self->str1 == "\nEx"/
{
        speculate(self->spec);
        trace(self->str2);
}

syscall::write:entry
/self->str1 == "\nEx"/
{
        commit(self->spec);
        self->spec = 0;
}

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

Reply via email to