On Thu, May 28, 2009 at 04:38:50PM -0400, D. Richard Hipp wrote:
> >> To debug, set a breakpoint on sqlite3Fault().  That routine is
> >> called whenever an OOM fault is simulated.  Run to the point of the
> >> OOM  fault that is causing the problem.  Figure out which malloc()
> >> is falling  and why the problem is not being reported back up to
> >> the top level.

The stack trace when sqlite3Fault() is called is this:

14671:  ./testfixture test/a.test                                               
                                                    
-----------------  lwp# 1 / thread# 1  --------------------                     
                                                    
 0807a065 sqlite3Fault (8139018, 1e8, 8043e1c, 8086a7f, 1e8, 1e4) + 1           
                                                    
 0807a0de faultsimMalloc (1e8, 1e4, 8043e1c, 80866aa) + e                       
                                                    
 08086a7f mallocWithAlarm (1e4) + 63                                            
                                                    
 08086b1f sqlite3Malloc (1e4, 81451b8, 8043e78, fef5e6ad) + 4b                  
                                                    
 08087029 sqlite3MallocZero (1e4, 8130d00, 8043eac, 80d3d9f) + 11               
                                                    
 080d3e54 openDatabase (8043ef0) + cc                                           
                                                    
 08083802 DbMain   (0, 8115090, 3, 8120fa8) + 32a                               
                                                    
 fef17834 TclEvalObjvInternal (8115090, 3, 8120fa8, 0, 0, 0) + 200              
                                                    
 fef3bf35 TclExecuteByteCode (8115090, 8161ed0) + 1199                          
                                                    
 fef3ad06 TclCompEvalObj (8115090, 8144e88) + 112                               
                                                    
 fef18661 Tcl_EvalObjEx (8115090, 8144e88, 0) + 69                              
                                                    
...
 fef52d07 Tcl_EvalFile (8115090, 8046e16, 80e890c, 1) + 2f                      
                                                    
 08083c9d main     (2, 8046c98, 8046ca4, 8046c8c) + 231                         
                                                    
 08068a9d _start   (2, 8046e08, 8046e16, 0, 8046e22, 8046e35) + 7d              
                                                    
-----------------  lwp# 2 / thread# 2  --------------------                     
                                                    
 fed1cd07 pollsys  (fec2ed30, 1, 0, 0)                                          
                                                    
 fecd337e pselect  (4, fec2ee10, fec2ee90, fec2ef10, 0, 0) + 19e                
                                                    
 fecd368e select   (4, fec2ee10, fec2ee90, fec2ef10, 0) + 7e                    
                                                    
 fef7e521 NotifierThreadProc (0) + 279                                          
                                                    
 fed190a0 _thrp_setup (feb20200) + 70                                           
                                                    
 fed19300 _lwp_start (feb20200, 0, 0, 0, 0, 0)                                  
                                                    

Tracing function entry/return from that point I see this:

  1  <- sqlite3Fault                                          0                 
                                                    
  1  <- faultsimStep                                          1                 
                                                    
  1  <- faultsimMalloc                                        0                 
                                                    
  1  <- mallocWithAlarm                                     488                 
                                                    
  1  -> sqlite3_mutex_leave                    13270897144254570                
                                                    
  1    -> pthreadMutexLeave                    13270897144257718                
                                                    
  1    <- pthreadMutexLeave                           135264012                 
                                                    
  1    -> mutex_unlock                         13270897144264723                
                                                    
  1      -> mutex_unlock_queue                 13270897144269040                
                                                    
  1        -> clear_lockbyte                   13270897144272919                
                                                    
  1        <- clear_lockbyte                           16777216                 
                                                    
  1      <- mutex_unlock_queue                                0                 
                                                    
  1    <- mutex_unlock                                        0                 
                                                    
  1  <- sqlite3Malloc                                         0                 
                                                    
  1  <- sqlite3MallocZero                                     0                 
                                                    
  1  -> sqlite3_errcode                        13270897144288592                
                                                    
  1  <- sqlite3_errcode                                       7                 
                                                    
  1  -> sqlite3_close                          13270897144294292                
                                                    
  1  <- sqlite3_close                                         0                 
                                                    
  1  <- openDatabase                                          0                 
                                                    
  1  -> sqlite3ApiExit                         13270897144301787                
                                                    
  1  <- sqlite3ApiExit                                        7                 
                                                    
  1  -> Tcl_DStringFree                        13270897144307842                
                                                    
  1  <- Tcl_DStringFree                                       0                 
                                                    

(The number on entry is the current time, the number on return is the
return value.)

So sqlite3Malloc() does return 0 (NULL), and sqlite3_errcode() does
return 7 (SQLITE_NOMEM).  Where else should I look?

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

Reply via email to