Filip Navara | 10 Nov 19:00 2011
Picon

Critical bug in Windows VFS retry logic

Hi,

we found a rather serious bug in the retry logic in Windows VFS in
SQLite 3.7.9. The function winAccess has roughly the following
structure:

    while( !(rc = GetFileAttributesExW((WCHAR*)zConverted,
                             GetFileExInfoStandard,
                             &sAttrData)) && retryIoerr(&cnt) ){}
    if( rc ){
      ...
    }else{
      logIoerr(cnt);
      if( GetLastError()!=ERROR_FILE_NOT_FOUND ){
        winLogError(SQLITE_IOERR_ACCESS, "winAccess", zFilename);
        free(zConverted);
        return SQLITE_IOERR_ACCESS;
      }else{
        attr = INVALID_FILE_ATTRIBUTES;
      }
    }

Note the logIoerr line. It internally calls sqlite3_log, which in turn
can change the "last error" that is checked on the next line.

This results in this totally useless log:

11/10/2011 17:23:46 10 delayed 25ms for lock/sharing conflict
11/10/2011 17:23:46 3338 os_win.c:34346: (0) winAccess(C:\Users\Filip
Navara\AppData\Roaming\eM Client\event_data.dat-journal) - The
(Continue reading)

Filip Navara | 10 Nov 21:16 2011
Picon

Re: Critical bug in Windows VFS retry logic

On Thu, Nov 10, 2011 at 7:00 PM, Filip Navara <filip.navara@...> wrote:
[snip]

The bug has been present since this check-in on 2011-07-28:

http://sqlite.org/src/info/8a145863d1a8711953ae72d706404fb96f6fec06

F.
Joe Mistachkin | 10 Nov 22:35 2011

Re: Critical bug in Windows VFS retry logic


Filip Navara wrote:
>
> The bug has been present since this check-in on 2011-07-28:
>
> http://sqlite.org/src/info/8a145863d1a8711953ae72d706404fb96f6fec06
>

Thanks for the report.  This issue has been fixed here:

https://www.sqlite.org/src/ci/32ab365715?sbs=0

--
Joe Mistachkin

Gmane