SQLite Forum

Possible freeze in the progress loop

When I insert a comparatively large dataset into a table (about 600 millions records) I encounter a "freeze" at some time during the insert. Since I have a progress callback, the "freeze" does not make the program unresponsive, only nothing happens with the VFS traffic (I have a vfs read/write numbers constantly showing the data) and with memory allocations. Windows process info also shows "freezing" for different I/O numbers.  

When I made some debugging, the code that waits "forever" is probably this ( from SQLITE_PRIVATE int sqlite3VdbeExec )


  while( nVmStep>=nProgressLimit && db->xProgress!=0 ){
    assert( db->nProgressOps!=0 );
    nProgressLimit += db->nProgressOps;
    if( db->xProgress(db->pProgressArg) ){
      nProgressLimit = 0xffffffff;
      goto abort_due_to_error;

In my case I see that 

  *  nVmStep = 0xFFFFFFFE
  *  nProgressLimit is increasing by db->nProgressOps = 0xA. 

Looking at the condition and taking the 32-bit wrapping logic into account, nProgressLimit will probably never be greater than the current nVmStep value (the only greater value is the odd 0xFFFFFFFF and no even to even wrapping (+0xA) will lead to it)