On 5/27/15, Techno Magos <technomagos at googlemail.com> wrote: > [ > This is observed on SQLite v 3.8.10.2 but seems to occur in previous > versions too) > Hits under windows, 64-bit, VS 2012. Not sure about Linux, could be > windows only. > ] > > > We are seeing crashes under windows in this usage pattern:
Please try the trunk version of SQLite (you can download a snapshot from https://www.sqlite.org/download.html) and let us know if it clears your problem. > > Process A opens up sqlite file / WAL mode, in READ-ONLY > (SQLITE_OPEN_READONLY ) and issues this pragma: PRAGMA mmap_size=N (N being > far larger than the sqlite file opened). It then does a couple of reads. > > A few msecs later, process B opens up the same sqlite file / WAL mode in > READ-WRITE mode (SQLITE_OPEN_READWRITE) without issuing the pragam for > mmap_size and writes a little small data into a table of it. The wal file > grows (as process A is opening the same file RO), then closes the file and > exits cleanly. > > When process A tries to close the file, it crashes: it finds a WAL file is > available and tries to roll it but ends up doing a memcpy into memory area > which is page mapped as READ ONLY. > The crash does NOT happen if "PRAGMA mmap_size=N" is not issued in process > A. > Or if the file is opened read-write by both processes. > > But we can do neither of these: the former improves read performance > significantly (and we do not want to lose this); on the latter, we need > certain processes to open the file read only, as they do not intend to > write any data to it. > > This looks to be a bug but could also be incorrect usage; but incorrect > usage should not cause a crash though. > > Any suggestion welcome. I am sure someone will request exact code to repro; > that would be v hard to rip out of a large app code. Hopefully, the above > description reveals some logical issue in the code? > > Many thanks ! > _______________________________________________ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > -- D. Richard Hipp drh at sqlite.org