/ Check-in [a9d1d931]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make the benign-fault setting recursive. Make all malloc failures during a rollback benign since there is nothing we can do about them. (CVS 5128)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a9d1d931358637a6f039723a053098f65530de4b
User & Date: drh 2008-05-13 13:27:34
Context
2008-05-13
16:41
Do a slow-path in GetVarint32() for varints that do not fit in 32 bits. This will only happen when trying to interpret a corrupt database file so speed is not critical. (CVS 5129) check-in: 6a6b9437 user: drh tags: trunk
13:27
Make the benign-fault setting recursive. Make all malloc failures during a rollback benign since there is nothing we can do about them. (CVS 5128) check-in: a9d1d931 user: drh tags: trunk
00:58
Update the pager so that it does not try to commit a transaction if there have been no changes to the database. (CVS 5127) check-in: f1ed3689 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/bitvec.c.

    28     28   ** Clear operations are exceedingly rare.  There are usually between
    29     29   ** 5 and 500 set operations per Bitvec object, though the number of sets can
    30     30   ** sometimes grow into tens of thousands or larger.  The size of the
    31     31   ** Bitvec object is the number of pages in the database file at the
    32     32   ** start of a transaction, and is thus usually less than a few thousand,
    33     33   ** but can be as large as 2 billion for a really big database.
    34     34   **
    35         -** @(#) $Id: bitvec.c,v 1.4 2008/04/14 01:00:58 drh Exp $
           35  +** @(#) $Id: bitvec.c,v 1.5 2008/05/13 13:27:34 drh Exp $
    36     36   */
    37     37   #include "sqliteInt.h"
    38     38   
    39     39   #define BITVEC_SZ        512
    40     40   /* Round the union size down to the nearest pointer boundary, since that's how 
    41     41   ** it will be aligned within the Bitvec struct. */
    42     42   #define BITVEC_USIZE     (((BITVEC_SZ-12)/sizeof(Bitvec*))*sizeof(Bitvec*))
................................................................................
   136    136       p->u.aBitmap[i/8] |= 1 << (i&7);
   137    137       return SQLITE_OK;
   138    138     }
   139    139     if( p->iDivisor ){
   140    140       u32 bin = (i-1)/p->iDivisor;
   141    141       i = (i-1)%p->iDivisor + 1;
   142    142       if( p->u.apSub[bin]==0 ){
   143         -      sqlite3FaultBenign(SQLITE_FAULTINJECTOR_MALLOC, 1);
          143  +      sqlite3FaultBeginBenign(SQLITE_FAULTINJECTOR_MALLOC);
   144    144         p->u.apSub[bin] = sqlite3BitvecCreate( p->iDivisor );
   145         -      sqlite3FaultBenign(SQLITE_FAULTINJECTOR_MALLOC, 0);
          145  +      sqlite3FaultEndBenign(SQLITE_FAULTINJECTOR_MALLOC);
   146    146         if( p->u.apSub[bin]==0 ) return SQLITE_NOMEM;
   147    147       }
   148    148       return sqlite3BitvecSet(p->u.apSub[bin], i);
   149    149     }
   150    150     h = BITVEC_HASH(i);
   151    151     while( p->u.aHash[h] ){
   152    152       if( p->u.aHash[h]==i ) return SQLITE_OK;

Changes to src/fault.c.

    38     38   */
    39     39   static struct FaultInjector {
    40     40     int iCountdown;   /* Number of pending successes before we hit a failure */
    41     41     int nRepeat;      /* Number of times to repeat the failure */
    42     42     int nBenign;      /* Number of benign failures seen since last config */
    43     43     int nFail;        /* Number of failures seen since last config */
    44     44     u8 enable;        /* True if enabled */
    45         -  u8 benign;        /* True if next failure will be benign */
           45  +  i16 benign;       /* Positive if next failure will be benign */
    46     46   } aFault[SQLITE_FAULTINJECTOR_COUNT];
    47     47   
    48     48   /*
    49     49   ** This routine configures and enables a fault injector.  After
    50     50   ** calling this routine, aFaultStep() will return false (zero)
    51     51   ** nDelay times, then it will return true nRepeat times,
    52     52   ** then it will again begin returning false.
................................................................................
   100    100   ** an error to be propagated back up to the application interface.
   101    101   ** However, sometimes a fault is easily recoverable.  For example,
   102    102   ** if a malloc fails while resizing a hash table, this is completely
   103    103   ** recoverable simply by not carrying out the resize.  The hash table
   104    104   ** will continue to function normally.  So a malloc failure during
   105    105   ** a hash table resize is a benign fault.  
   106    106   */
   107         -void sqlite3FaultBenign(int id, int enable){
          107  +void sqlite3FaultBeginBenign(int id){
          108  +  if( id<0 ){
          109  +    for(id=0; id<SQLITE_FAULTINJECTOR_COUNT; id++){
          110  +      aFault[id].benign++;
          111  +    }
          112  +  }else{
          113  +    assert( id>=0 && id<SQLITE_FAULTINJECTOR_COUNT );
          114  +    aFault[id].benign++;
          115  +  }
          116  +}
          117  +void sqlite3FaultEndBenign(int id){
   108    118     if( id<0 ){
   109    119       for(id=0; id<SQLITE_FAULTINJECTOR_COUNT; id++){
   110         -      aFault[id].benign = enable;
          120  +      assert( aFault[id].benign>0 );
          121  +      aFault[id].benign--;
   111    122       }
   112    123     }else{
   113    124       assert( id>=0 && id<SQLITE_FAULTINJECTOR_COUNT );
   114         -    aFault[id].benign = enable;
          125  +    assert( aFault[id].benign>0 );
          126  +    aFault[id].benign--;
   115    127     }
   116    128   }
   117    129   
   118    130   /*
   119    131   ** This routine exists as a place to set a breakpoint that will
   120    132   ** fire on any simulated fault.
   121    133   */
................................................................................
   136    148     }
   137    149     if( aFault[id].iCountdown>0 ){
   138    150       aFault[id].iCountdown--;
   139    151       return 0;
   140    152     }
   141    153     sqlite3Fault();
   142    154     aFault[id].nFail++;
   143         -  if( aFault[id].benign ){
          155  +  if( aFault[id].benign>0 ){
   144    156       aFault[id].nBenign++;
   145    157     }
   146    158     aFault[id].nRepeat--;
   147    159     if( aFault[id].nRepeat<=0 ){
   148    160       aFault[id].enable = 0;
   149    161     }
   150    162     return 1;  
   151    163   }
   152    164   
   153    165   #endif /* SQLITE_OMIT_BUILTIN_TEST */

Changes to src/hash.c.

     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This is the implementation of generic hash-tables
    13     13   ** used in SQLite.
    14     14   **
    15         -** $Id: hash.c,v 1.27 2008/04/02 18:33:08 drh Exp $
           15  +** $Id: hash.c,v 1.28 2008/05/13 13:27:34 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   #include <assert.h>
    19     19   
    20     20   /* Turn bulk memory into a hash table object by initializing the
    21     21   ** fields of the Hash structure.
    22     22   **
................................................................................
   229    229   #endif
   230    230   
   231    231     /* There is a call to sqlite3_malloc() inside rehash(). If there is
   232    232     ** already an allocation at pH->ht, then if this malloc() fails it
   233    233     ** is benign (since failing to resize a hash table is a performance
   234    234     ** hit only, not a fatal error).
   235    235     */
   236         -  sqlite3FaultBenign(SQLITE_FAULTINJECTOR_MALLOC, pH->htsize>0);
          236  +  if( pH->htsize>0 ) sqlite3FaultBeginBenign(SQLITE_FAULTINJECTOR_MALLOC);
   237    237     new_ht = (struct _ht *)sqlite3MallocZero( new_size*sizeof(struct _ht) );
   238         -  sqlite3FaultBenign(SQLITE_FAULTINJECTOR_MALLOC, 0);
          238  +  if( pH->htsize>0 ) sqlite3FaultEndBenign(SQLITE_FAULTINJECTOR_MALLOC);
   239    239   
   240    240     if( new_ht==0 ) return;
   241    241     sqlite3_free(pH->ht);
   242    242     pH->ht = new_ht;
   243    243     pH->htsize = new_size;
   244    244     xHash = hashFunction(pH->keyClass);
   245    245     for(elem=pH->first, pH->first=0; elem; elem = next_elem){

Changes to src/main.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** Main file for the SQLite library.  The routines in this file
    13     13   ** implement the programmer interface to the library.  Routines in
    14     14   ** other files are for internal use by SQLite and should not be
    15     15   ** accessed by users of the library.
    16     16   **
    17         -** $Id: main.c,v 1.438 2008/05/05 16:56:35 drh Exp $
           17  +** $Id: main.c,v 1.439 2008/05/13 13:27:34 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include <ctype.h>
    21     21   #ifdef SQLITE_ENABLE_FTS3
    22     22   # include "fts3.h"
    23     23   #endif
    24     24   
................................................................................
   250    250   /*
   251    251   ** Rollback all database files.
   252    252   */
   253    253   void sqlite3RollbackAll(sqlite3 *db){
   254    254     int i;
   255    255     int inTrans = 0;
   256    256     assert( sqlite3_mutex_held(db->mutex) );
   257         -  sqlite3FaultBenign(SQLITE_FAULTINJECTOR_MALLOC, 1);
          257  +  sqlite3FaultBeginBenign(SQLITE_FAULTINJECTOR_MALLOC);
   258    258     for(i=0; i<db->nDb; i++){
   259    259       if( db->aDb[i].pBt ){
   260    260         if( sqlite3BtreeIsInTrans(db->aDb[i].pBt) ){
   261    261           inTrans = 1;
   262    262         }
   263    263         sqlite3BtreeRollback(db->aDb[i].pBt);
   264    264         db->aDb[i].inTrans = 0;
   265    265       }
   266    266     }
   267    267     sqlite3VtabRollback(db);
   268         -  sqlite3FaultBenign(SQLITE_FAULTINJECTOR_MALLOC, 0);
          268  +  sqlite3FaultEndBenign(SQLITE_FAULTINJECTOR_MALLOC);
   269    269   
   270    270     if( db->flags&SQLITE_InternChanges ){
   271    271       sqlite3ExpirePreparedStatements(db);
   272    272       sqlite3ResetInternalSchema(db, 0);
   273    273     }
   274    274   
   275    275     /* If one has been configured, invoke the rollback-hook callback */

Changes to src/pager.c.

    14     14   ** The pager is used to access a database disk file.  It implements
    15     15   ** atomic commit and rollback through the use of a journal file that
    16     16   ** is separate from the database file.  The pager also implements file
    17     17   ** locking to prevent two processes from writing the same database
    18     18   ** file simultaneously, or one process from reading the database while
    19     19   ** another is writing.
    20     20   **
    21         -** @(#) $Id: pager.c,v 1.445 2008/05/13 00:58:18 drh Exp $
           21  +** @(#) $Id: pager.c,v 1.446 2008/05/13 13:27:34 drh Exp $
    22     22   */
    23     23   #ifndef SQLITE_OMIT_DISKIO
    24     24   #include "sqliteInt.h"
    25     25   #include <assert.h>
    26     26   #include <string.h>
    27     27   
    28     28   /*
................................................................................
   684    684   #ifdef SQLITE_MALLOC_SOFT_LIMIT
   685    685     if( N*sizeof(aHash[0])>SQLITE_MALLOC_SOFT_LIMIT ){
   686    686       N = SQLITE_MALLOC_SOFT_LIMIT/sizeof(aHash[0]);
   687    687     }
   688    688     if( N==pPager->nHash ) return;
   689    689   #endif
   690    690     pagerLeave(pPager);
   691         -  sqlite3FaultBenign(SQLITE_FAULTINJECTOR_MALLOC, pPager->aHash!=0);
          691  +  if( pPager->aHash!=0 ) sqlite3FaultBeginBenign(SQLITE_FAULTINJECTOR_MALLOC);
   692    692     aHash = sqlite3MallocZero( sizeof(aHash[0])*N );
   693         -  sqlite3FaultBenign(SQLITE_FAULTINJECTOR_MALLOC, 0);
          693  +  if( pPager->aHash!=0 ) sqlite3FaultEndBenign(SQLITE_FAULTINJECTOR_MALLOC);
   694    694     pagerEnter(pPager);
   695    695     if( aHash==0 ){
   696    696       /* Failure to rehash is not an error.  It is only a performance hit. */
   697    697       return;
   698    698     }
   699    699     sqlite3_free(pPager->aHash);
   700    700     pPager->nHash = N;
................................................................................
  1354   1354   ** Execute a rollback if a transaction is active and unlock the 
  1355   1355   ** database file. If the pager has already entered the error state, 
  1356   1356   ** do not attempt the rollback.
  1357   1357   */
  1358   1358   static void pagerUnlockAndRollback(Pager *p){
  1359   1359     /* assert( p->state>=PAGER_RESERVED || p->journalOpen==0 ); */
  1360   1360     if( p->errCode==SQLITE_OK && p->state>=PAGER_RESERVED ){
         1361  +    sqlite3FaultBeginBenign(-1);
  1361   1362       sqlite3PagerRollback(p);
         1363  +    sqlite3FaultEndBenign(-1);
  1362   1364     }
  1363   1365     pager_unlock(p);
  1364   1366   #if 0
  1365   1367     assert( p->errCode || !p->journalOpen || (p->exclusiveMode&&!p->journalOff) );
  1366   1368     assert( p->errCode || !p->stmtOpen || p->exclusiveMode );
  1367   1369   #endif
  1368   1370   }
................................................................................
  2757   2759         pPager->pNext->pPrev = pPager->pPrev;
  2758   2760       }
  2759   2761       sqlite3_mutex_leave(mutex);
  2760   2762     }
  2761   2763   #endif
  2762   2764   
  2763   2765     disable_simulated_io_errors();
  2764         -  sqlite3FaultBenign(-1, 1);
         2766  +  sqlite3FaultBeginBenign(-1);
  2765   2767     pPager->errCode = 0;
  2766   2768     pPager->exclusiveMode = 0;
  2767   2769     pager_reset(pPager);
  2768   2770     pagerUnlockAndRollback(pPager);
  2769   2771     enable_simulated_io_errors();
  2770         -  sqlite3FaultBenign(-1, 0);
         2772  +  sqlite3FaultEndBenign(-1);
  2771   2773     PAGERTRACE2("CLOSE %d\n", PAGERID(pPager));
  2772   2774     IOTRACE(("CLOSE %p\n", pPager))
  2773   2775     if( pPager->journalOpen ){
  2774   2776       sqlite3OsClose(pPager->jfd);
  2775   2777     }
  2776   2778     sqlite3BitvecDestroy(pPager->pInJournal);
  2777   2779     if( pPager->stmtOpen ){

Changes to src/sqliteInt.h.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** Internal interface definitions for SQLite.
    13     13   **
    14         -** @(#) $Id: sqliteInt.h,v 1.703 2008/05/09 18:03:14 drh Exp $
           14  +** @(#) $Id: sqliteInt.h,v 1.704 2008/05/13 13:27:34 drh Exp $
    15     15   */
    16     16   #ifndef _SQLITEINT_H_
    17     17   #define _SQLITEINT_H_
    18     18   
    19     19   /*
    20     20   ** Include the configuration header output by 'configure' if we're using the
    21     21   ** autoconf-based build
................................................................................
  2166   2166   ** unnecessary code is generated.
  2167   2167   */
  2168   2168   #ifndef SQLITE_OMIT_BUILTIN_TEST
  2169   2169     void sqlite3FaultConfig(int,int,int);
  2170   2170     int sqlite3FaultFailures(int);
  2171   2171     int sqlite3FaultBenignFailures(int);
  2172   2172     int sqlite3FaultPending(int);
  2173         -  void sqlite3FaultBenign(int,int);
         2173  +  void sqlite3FaultBeginBenign(int);
         2174  +  void sqlite3FaultEndBenign(int);
  2174   2175     int sqlite3FaultStep(int);
  2175   2176   #else
  2176   2177   # define sqlite3FaultConfig(A,B,C)
  2177   2178   # define sqlite3FaultFailures(A)         0
  2178   2179   # define sqlite3FaultBenignFailures(A)   0
  2179   2180   # define sqlite3FaultPending(A)          (-1)
  2180         -# define sqlite3FaultBenign(A,B)
         2181  +# define sqlite3FaultBeginBenign(A)
         2182  +# define sqlite3FaultEndBenign(A)
  2181   2183   # define sqlite3FaultStep(A)             0
  2182   2184   #endif
  2183   2185     
  2184   2186     
  2185   2187   
  2186   2188   #define IN_INDEX_ROWID           1
  2187   2189   #define IN_INDEX_EPH             2

Changes to src/test8.c.

     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** Code for testing the virtual table interfaces.  This code
    13     13   ** is not included in the SQLite library.  It is used for automated
    14     14   ** testing of the SQLite library.
    15     15   **
    16         -** $Id: test8.c,v 1.63 2008/05/05 13:23:04 drh Exp $
           16  +** $Id: test8.c,v 1.64 2008/05/13 13:27:34 drh Exp $
    17     17   */
    18     18   #include "sqliteInt.h"
    19     19   #include "tcl.h"
    20     20   #include <stdlib.h>
    21     21   #include <string.h>
    22     22   
    23     23   #ifndef SQLITE_OMIT_VIRTUALTABLE
................................................................................
  1061   1061     echo_vtab *pVtab = (echo_vtab*)tab;
  1062   1062     int rc;
  1063   1063   
  1064   1064     /* Ticket #3083 - Only call xCommit if we have previously started
  1065   1065     ** a transaction */
  1066   1066     assert( pVtab->inTransaction );
  1067   1067   
  1068         -  sqlite3FaultBenign(SQLITE_FAULTINJECTOR_MALLOC, 1);
         1068  +  sqlite3FaultBeginBenign(SQLITE_FAULTINJECTOR_MALLOC);
  1069   1069     rc = echoTransactionCall(tab, "xCommit");
  1070         -  sqlite3FaultBenign(SQLITE_FAULTINJECTOR_MALLOC, 0);
         1070  +  sqlite3FaultEndBenign(SQLITE_FAULTINJECTOR_MALLOC);
  1071   1071     pVtab->inTransaction = 0;
  1072   1072     return rc;
  1073   1073   }
  1074   1074   static int echoRollback(sqlite3_vtab *tab){
  1075   1075     int rc;
  1076   1076     echo_vtab *pVtab = (echo_vtab*)tab;
  1077   1077   

Changes to src/vdbe.c.

    39     39   **
    40     40   ** Various scripts scan this source file in order to generate HTML
    41     41   ** documentation, headers files, or other derived files.  The formatting
    42     42   ** of the code in this file is, therefore, important.  See other comments
    43     43   ** in this file for details.  If in doubt, do not deviate from existing
    44     44   ** commenting and indentation practices when changing or adding code.
    45     45   **
    46         -** $Id: vdbe.c,v 1.739 2008/05/09 18:03:14 drh Exp $
           46  +** $Id: vdbe.c,v 1.740 2008/05/13 13:27:34 drh Exp $
    47     47   */
    48     48   #include "sqliteInt.h"
    49     49   #include <ctype.h>
    50     50   #include "vdbeInt.h"
    51     51   
    52     52   /*
    53     53   ** The following global variable is incremented every time a cursor
................................................................................
   555    555     p->rc = SQLITE_OK;
   556    556     assert( p->explain==0 );
   557    557     p->pResultSet = 0;
   558    558     db->busyHandler.nBusy = 0;
   559    559     CHECK_FOR_INTERRUPT;
   560    560     sqlite3VdbeIOTraceSql(p);
   561    561   #ifdef SQLITE_DEBUG
   562         -  sqlite3FaultBenign(-1, 1);
          562  +  sqlite3FaultBeginBenign(-1);
   563    563     if( p->pc==0 && ((p->db->flags & SQLITE_VdbeListing)!=0
   564    564       || sqlite3OsAccess(db->pVfs, "vdbe_explain", SQLITE_ACCESS_EXISTS)==1 )
   565    565     ){
   566    566       int i;
   567    567       printf("VDBE Program Listing:\n");
   568    568       sqlite3VdbePrintSql(p);
   569    569       for(i=0; i<p->nOp; i++){
   570    570         sqlite3VdbePrintOp(stdout, i, &p->aOp[i]);
   571    571       }
   572    572     }
   573    573     if( sqlite3OsAccess(db->pVfs, "vdbe_trace", SQLITE_ACCESS_EXISTS)==1 ){
   574    574       p->trace = stdout;
   575    575     }
   576         -  sqlite3FaultBenign(-1, 0);
          576  +  sqlite3FaultEndBenign(-1);
   577    577   #endif
   578    578     for(pc=p->pc; rc==SQLITE_OK; pc++){
   579    579       assert( pc>=0 && pc<p->nOp );
   580    580       if( db->mallocFailed ) goto no_mem;
   581    581   #ifdef VDBE_PROFILE
   582    582       origPc = pc;
   583    583       start = hwtime();
................................................................................
   591    591         if( pc==0 ){
   592    592           printf("VDBE Execution Trace:\n");
   593    593           sqlite3VdbePrintSql(p);
   594    594         }
   595    595         sqlite3VdbePrintOp(p->trace, pc, pOp);
   596    596       }
   597    597       if( p->trace==0 && pc==0 ){
   598         -      sqlite3FaultBenign(-1, 1);
          598  +      sqlite3FaultBeginBenign(-1);
   599    599         if( sqlite3OsAccess(db->pVfs, "vdbe_sqltrace", SQLITE_ACCESS_EXISTS)==1 ){
   600    600           sqlite3VdbePrintSql(p);
   601    601         }
   602         -      sqlite3FaultBenign(-1, 0);
          602  +      sqlite3FaultEndBenign(-1);
   603    603       }
   604    604   #endif
   605    605         
   606    606   
   607    607       /* Check to see if we need to simulate an interrupt.  This only happens
   608    608       ** if we have a special test build.
   609    609       */

Changes to src/vdbeaux.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains code used for creating, destroying, and populating
    13     13   ** a VDBE (or an "sqlite3_stmt" as it is known to the outside world.)  Prior
    14     14   ** to version 2.8.7, all this code was combined into the vdbe.c source file.
    15     15   ** But that file was getting too big so this subroutines were split out.
    16     16   **
    17         -** $Id: vdbeaux.c,v 1.382 2008/05/08 15:18:10 drh Exp $
           17  +** $Id: vdbeaux.c,v 1.383 2008/05/13 13:27:34 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include <ctype.h>
    21     21   #include "vdbeInt.h"
    22     22   
    23     23   
    24     24   
................................................................................
  1388   1388       ** calls to sqlite3BtreeCommitPhaseTwo() are only closing files and
  1389   1389       ** deleting or truncating journals. If something goes wrong while
  1390   1390       ** this is happening we don't really care. The integrity of the
  1391   1391       ** transaction is already guaranteed, but some stray 'cold' journals
  1392   1392       ** may be lying around. Returning an error code won't help matters.
  1393   1393       */
  1394   1394       disable_simulated_io_errors();
  1395         -    sqlite3FaultBenign(SQLITE_FAULTINJECTOR_MALLOC, 1);
         1395  +    sqlite3FaultBeginBenign(SQLITE_FAULTINJECTOR_MALLOC);
  1396   1396       for(i=0; i<db->nDb; i++){ 
  1397   1397         Btree *pBt = db->aDb[i].pBt;
  1398   1398         if( pBt ){
  1399   1399           sqlite3BtreeCommitPhaseTwo(pBt);
  1400   1400         }
  1401   1401       }
  1402         -    sqlite3FaultBenign(SQLITE_FAULTINJECTOR_MALLOC, 0);
         1402  +    sqlite3FaultEndBenign(SQLITE_FAULTINJECTOR_MALLOC);
  1403   1403       enable_simulated_io_errors();
  1404   1404   
  1405   1405       sqlite3VtabCommit(db);
  1406   1406     }
  1407   1407   #endif
  1408   1408   
  1409   1409     return rc;

Changes to test/malloc3.test.

     9      9   #
    10     10   #***********************************************************************
    11     11   #
    12     12   # This file contains tests to ensure that the library handles malloc() failures
    13     13   # correctly. The emphasis of these tests are the _prepare(), _step() and
    14     14   # _finalize() calls.
    15     15   #
    16         -# $Id: malloc3.test,v 1.21 2008/05/13 00:58:18 drh Exp $
           16  +# $Id: malloc3.test,v 1.22 2008/05/13 13:27:34 drh Exp $
    17     17   
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
    20     20   source $testdir/malloc_common.tcl
    21     21   
    22     22   # Only run these tests if memory debugging is turned on.
    23     23   #
................................................................................
   582    582           set nFail [sqlite3_memdebug_fail -1 -benigncnt nBenign]
   583    583           if {$rc == 0} {
   584    584               # Successful execution of sql. The number of failed malloc()
   585    585               # calls should be equal to the number of benign failures.
   586    586               # Otherwise a malloc() failed and the error was not reported.
   587    587               # 
   588    588               if {$nFail!=$nBenign} {
   589         -#              error "Unreported malloc() failure"
          589  +              error "Unreported malloc() failure"
   590    590               }
   591    591   
   592    592               if {$ac && !$nac} {
   593    593                 # Before the [db eval] the auto-commit flag was set, now it
   594    594                 # is clear. We can deduce that a "BEGIN" statement has just
   595    595                 # been successfully executed.
   596    596                 set begin_pc $pc