Hi,

I took your advice and now I am setting only once the journal_mode=WAL,
also locking_mode=EXCLUSIVE and temp_store=MEMORY. But still it doesn't
work, and I get DB locks immediately. I enabled SQLite traces, and I also
added some supplementary traces when the WAL is set. Even if the
journal_mode=WAL pragma seems to be successful, I don't think that the WAL
works because I see no wal file on the disk, also I should have some WAL
related traces, which are not present.

Below are the SQLite traces, and it can be seen that 3.x locking model it
is used, instead of WAL. Somewhere a thread tries to get a READ SHARED
lock, but on the database there is already an EXCLUSIVE lock. Normally this
should not occur, because the reader should be able to use the database and
WAL file. The auto-checkpoint for the WAL failed is 1000 pages, so it
should not be immediately.


OPENX   11  /mnt/share/testApp/myDB.db 0402
fcntl unknown pid=233565 tid=20 11 1 0
fcntl unknown pid=233565 tid=20 11 2 0
OPEN    11  /mnt/share/testApp/myDB.db
OPEN 139631224 /mnt/share/testApp/myDB.db
OPEN 139631856 /mnt/share/testApp/myDB.db
OPENX   12  /mnt/share/testApp/myDB.db 02
fcntl unknown pid=233565 tid=20 12 1 0
fcntl unknown pid=233565 tid=20 12 2 0
OPEN    12  /mnt/share/testApp/myDB.db
OPEN 139746432 /mnt/share/testApp/myDB.db
OPEN 139627904 /mnt/share/testApp/myDB.db
OPENX   13  /mnt/share/testApp/myDB.db 02
fcntl unknown pid=233565 tid=20 13 1 0
fcntl unknown pid=233565 tid=20 13 2 0
OPEN    13  /mnt/share/testApp/myDB.db
OPEN 139547936 /mnt/share/testApp/myDB.db
OPEN 139811888 /mnt/share/testApp/myDB.db
OPENX   14  /mnt/share/testApp/myDB.db 02
fcntl unknown pid=233565 tid=20 14 1 0
fcntl unknown pid=233565 tid=20 14 2 0
OPEN    14  /mnt/share/testApp/myDB.db
OPEN 139943040 /mnt/share/testApp/myDB.db
OPEN 139544616 /mnt/share/testApp/myDB.db
OPENX   15  /mnt/share/testApp/myDB.db 02
fcntl unknown pid=233565 tid=20 15 1 0
fcntl unknown pid=233565 tid=20 15 2 0
OPEN    15  /mnt/share/testApp/myDB.db
OPEN 139585952 /mnt/share/testApp/myDB.db
OPEN 139586584 /mnt/share/testApp/myDB.db
LOCK    11 SHARED was NONE(NONE,0) pid=233565 tid=20 (unix)
fcntl pid=233565 tid=20 11 SETLK RDLCK 1073741824 1 125195948 0
fcntl pid=233565 tid=20 11 SETLK RDLCK 1073741826 510 125195948 0
fcntl pid=233565 tid=20 11 SETLK UNLCK 1073741824 1 125195948 0
LOCK    11 SHARED ok (unix)
UNLOCK  11 0 was 1(1,1) pid=233565 tid=20 (unix)
fcntl pid=233565 tid=20 11 SETLK UNLCK 0 0 138882344 0
CLOSE 139631224
UNLOCK  11 0 was 0(0,0) pid=233565 tid=20 (unix)
CLOSE   -1
OPENX   11  /mnt/share/testApp/myDB.db 0402
fcntl unknown pid=233565 tid=20 11 1 0
fcntl unknown pid=233565 tid=20 11 2 0
OPEN    11  /mnt/share/testApp/myDB.db
LOCK    11 SHARED was NONE(NONE,0) pid=233565 tid=20 (unix)
fcntl pid=233565 tid=20 11 SETLK RDLCK 1073741824 1 138848960 0
fcntl pid=233565 tid=20 11 SETLK RDLCK 1073741826 510 138848960 0
fcntl pid=233565 tid=20 11 SETLK UNLCK 1073741824 1 138848960 0
LOCK    11 SHARED ok (unix)
UNLOCK  11 0 was 1(1,1) pid=233565 tid=20 (unix)
fcntl pid=233565 tid=20 11 SETLK UNLCK 0 0 1 0
LOCK    11 SHARED was NONE(NONE,0) pid=233565 tid=20 (unix)
fcntl pid=233565 tid=20 11 SETLK RDLCK 1073741824 1 125196700 0
fcntl pid=233565 tid=20 11 SETLK RDLCK 1073741826 510 125196700 0
fcntl pid=233565 tid=20 11 SETLK UNLCK 1073741824 1 125196700 0
LOCK    11 SHARED ok (unix)
UNLOCK  11 0 was 1(1,1) pid=233565 tid=20 (unix)
fcntl pid=233565 tid=20 11 SETLK UNLCK 0 0 2 0
LOCK    11 SHARED was NONE(NONE,0) pid=233565 tid=20 (unix)
fcntl pid=233565 tid=20 11 SETLK RDLCK 1073741824 1 125196428 0
fcntl pid=233565 tid=20 11 SETLK RDLCK 1073741826 510 125196428 0
fcntl pid=233565 tid=20 11 SETLK UNLCK 1073741824 1 125196428 0
LOCK    11 SHARED ok (unix)
UNLOCK  11 0 was 1(1,1) pid=233565 tid=20 (unix)
fcntl pid=233565 tid=20 11 SETLK UNLCK 0 0 2 0
LOCK    11 SHARED was NONE(NONE,0) pid=233565 tid=20 (unix)
fcntl pid=233565 tid=20 11 SETLK RDLCK 1073741824 1 125195612 0
fcntl pid=233565 tid=20 11 SETLK RDLCK 1073741826 510 125195612 0
fcntl pid=233565 tid=20 11 SETLK UNLCK 1073741824 1 125195612 0
LOCK    11 SHARED ok (unix)
LOCK    11 RESERVED was SHARED(SHARED,1) pid=233565 tid=20 (unix)
fcntl pid=233565 tid=20 11 SETLK WRLCK 1073741825 1 125195676 0
LOCK    11 RESERVED ok (unix)
TRANSACTION 139631856
OPENX   16  /mnt/share/testApp/myDB.nal 0402
fcntl unknown pid=233565 tid=20 16 1 0
fcntl unknown pid=233565 tid=20 16 2 0
OPEN    16  /mnt/share/testApp/myDB.nal
WRITE   16    512       0 0
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 2 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 3 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 3 needSync=1
APPEND 139631856 page 2 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 4 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 5 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 6 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 7 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 8 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 9 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 10 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 11 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 12 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 13 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 14 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 15 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 16 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 17 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 18 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 19 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 20 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 21 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 22 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 23 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 24 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 25 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 26 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 27 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 28 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 29 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 30 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 31 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 32 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 33 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 25 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 34 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 35 needSync=1
APPEND 139631856 page 1 needSync=1
APPEND 139631856 page 1 needSync=1
LOCK    11 EXCLUSIVE was RESERVED(RESERVED,1) pid=233565 tid=20 (unix)
fcntl pid=233565 tid=20 11 SETLK WRLCK 1073741824 1 125195660 0
fcntl pid=233565 tid=20 11 SETLK WRLCK 1073741826 510 125195660 0
LOCK    11 EXCLUSIVE ok (unix)
DATABASE SYNC: File=/mnt/share/testApp/myDB.db zMaster= nSize=35
APPEND 139631856 page 1 needSync=1
READ    16      0     512 0
SYNC journal of 139631856
SYNC    16
DIRSYNC /mnt/share/testApp/myDB.nal (have_fullfsync=0 fullsync=0)
fcntl unknown pid=233565 tid=20 17 1 0
fcntl unknown pid=233565 tid=20 17 2 0
OPENDIR 17  /mnt/share/testApp
WRITE   16     12       0 0
SYNC journal of 139631856
SYNC    16
READ    11      0      24 0
WRITE   11  65536       0 0
STORE 139631856 page 1 hash(00000000)
WRITE   11  65536   65536 0
STORE 139631856 page 2 hash(00000000)
WRITE   11  65536  131072 0
STORE 139631856 page 3 hash(00000000)
WRITE   11  65536  196608 0
STORE 139631856 page 4 hash(00000000)
WRITE   11  65536  262144 0
STORE 139631856 page 5 hash(00000000)
WRITE   11  65536  327680 0
STORE 139631856 page 6 hash(00000000)
WRITE   11  65536  393216 0
STORE 139631856 page 7 hash(00000000)
WRITE   11  65536  458752 0
STORE 139631856 page 8 hash(00000000)
WRITE   11  65536  524288 0
STORE 139631856 page 9 hash(00000000)
WRITE   11  65536  589824 0
STORE 139631856 page 10 hash(00000000)
WRITE   11  65536  655360 0
STORE 139631856 page 11 hash(00000000)
WRITE   11  65536  720896 0
STORE 139631856 page 12 hash(00000000)
WRITE   11  65536  786432 0
STORE 139631856 page 13 hash(00000000)
WRITE   11  65536  851968 0
STORE 139631856 page 14 hash(00000000)
WRITE   11  65536  917504 0
STORE 139631856 page 15 hash(00000000)
WRITE   11  65536  983040 0
STORE 139631856 page 16 hash(00000000)
WRITE   11  65536 1048576 0
STORE 139631856 page 17 hash(00000000)
WRITE   11  65536 1114112 0
STORE 139631856 page 18 hash(00000000)
WRITE   11  65536 1179648 0
STORE 139631856 page 19 hash(00000000)
WRITE   11  65536 1245184 0
STORE 139631856 page 20 hash(00000000)
WRITE   11  65536 1310720 0
STORE 139631856 page 21 hash(00000000)
WRITE   11  65536 1376256 0
STORE 139631856 page 22 hash(00000000)
WRITE   11  65536 1441792 0
STORE 139631856 page 23 hash(00000000)
WRITE   11  65536 1507328 0
STORE 139631856 page 24 hash(00000000)
WRITE   11  65536 1572864 0
STORE 139631856 page 25 hash(00000000)
WRITE   11  65536 1638400 0
STORE 139631856 page 26 hash(00000000)
WRITE   11  65536 1703936 0
STORE 139631856 page 27 hash(00000000)
WRITE   11  65536 1769472 0
STORE 139631856 page 28 hash(00000000)
WRITE   11  65536 1835008 0
STORE 139631856 page 29 hash(00000000)
WRITE   11  65536 1900544 0
STORE 139631856 page 30 hash(00000000)
WRITE   11  65536 1966080 0
STORE 139631856 page 31 hash(00000000)
WRITE   11  65536 2031616 0
STORE 139631856 page 32 hash(00000000)
WRITE   11  65536 2097152 0
STORE 139631856 page 33 hash(00000000)
WRITE   11  65536 2162688 0
STORE 139631856 page 34 hash(00000000)
WRITE   11  65536 2228224 0
STORE 139631856 page 35 hash(00000000)
SYNC    11
COMMIT 139631856
CLOSE   -1
UNLOCK  11 1 was 4(4,1) pid=233565 tid=20 (unix)
fcntl pid=233565 tid=20 11 SETLK RDLCK 1073741826 510 125195724 0
fcntl pid=233565 tid=20 11 SETLK UNLCK 1073741824 2 125195724 0
UNLOCK  11 0 was 1(1,1) pid=233565 tid=20 (unix)
fcntl pid=233565 tid=20 11 SETLK UNLCK 0 0 125195676 0
LOCK    11 SHARED was NONE(NONE,0) pid=233565 tid=20 (unix)
fcntl pid=233565 tid=20 11 SETLK RDLCK 1073741824 1 125195868 0
fcntl pid=233565 tid=20 11 SETLK RDLCK 1073741826 510 125195868 0
fcntl pid=233565 tid=20 11 SETLK UNLCK 1073741824 1 125195868 0
LOCK    11 SHARED ok (unix)
READ    11     16      24 0
UNLOCK  11 0 was 1(1,1) pid=233565 tid=20 (unix)
fcntl pid=233565 tid=20 11 SETLK UNLCK 0 0 125195980 0
OPEN 139523248
TRANSACTION 139523248
APPEND 139523248 page 1 needSync=1
APPEND 139523248 page 1 needSync=1
APPEND 139523248 page 1 needSync=1
APPEND 139523248 page 1 needSync=1
APPEND 139523248 page 2 needSync=1
APPEND 139523248 page 1 needSync=1
APPEND 139523248 page 1 needSync=1
APPEND 139523248 page 1 needSync=1
APPEND 139523248 page 1 needSync=1
DATABASE SYNC: File= zMaster= nSize=2
COMMIT 139523248
JOURNALMODE new : 5, old : 0
JOURNALMODE_WAL will be enabled
27 1 0
Temp file /mnt/share/testApp/myDB.db Shared memory support 1
LOCK    11 SHARED was NONE(NONE,0) pid=233565 tid=20 (unix)
fcntl pid=233565 tid=20 11 SETLK RDLCK 1073741824 1 125195932 0
fcntl pid=233565 tid=20 11 SETLK RDLCK 1073741826 510 125195932 0
fcntl pid=233565 tid=20 11 SETLK UNLCK 1073741824 1 125195932 0
LOCK    11 SHARED ok (unix)
READ    11     16      24 0
LOCK    11 RESERVED was SHARED(SHARED,1) pid=233565 tid=20 (unix)
fcntl pid=233565 tid=20 11 SETLK WRLCK 1073741825 1 125195996 0
LOCK    11 RESERVED ok (unix)
LOCK    11 EXCLUSIVE was RESERVED(RESERVED,1) pid=233565 tid=20 (unix)
fcntl pid=233565 tid=20 11 SETLK WRLCK 1073741824 1 125195964 0
fcntl pid=233565 tid=20 11 SETLK WRLCK 1073741826 510 125195964 0
LOCK    11 EXCLUSIVE ok (unix)
TRANSACTION 139631856
OPENX   16  /mnt/share/testApp/myDB.nal 0402
fcntl unknown pid=233565 tid=20 16 1 0
fcntl unknown pid=233565 tid=20 16 2 0
OPEN    16  /mnt/share/testApp/myDB.nal
WRITE   16    512       0 0
WRITE   16      4     512 0
WRITE   16  65536     516 0
WRITE   16      4   66052 0
JOURNAL 139631856 page 1 needSync=1 hash(00000000)
DATABASE SYNC: File=/mnt/share/testApp/myDB.db zMaster= nSize=35
READ    16      0   66560 0
SYNC journal of 139631856
SYNC    16
DIRSYNC /mnt/share/testApp/myDB.nal (have_fullfsync=0 fullsync=0)
fcntl unknown pid=233565 tid=20 17 1 0
fcntl unknown pid=233565 tid=20 17 2 0
OPENDIR 17  /mnt/share/testApp
WRITE   16     12       0 0
SYNC journal of 139631856
SYNC    16
READ    11      4      24 0
WRITE   11  65536       0 0
STORE 139631856 page 1 hash(00000000)
SYNC    11
COMMIT 139631856
CLOSE   -1
LOCK    13 SHARED was NONE(EXCLUSIVE,1) pid=233565 tid=16 (unix)
LOCK    13 SHARED failed (unix)
UNLOCK  13 0 was 0(4,1) pid=233565 tid=16 (unix)
ROLLBACK 139547936
LOCK    13 SHARED was NONE(EXCLUSIVE,1) pid=233565 tid=20 (unix)
LOCK    13 SHARED failed (unix)
UNLOCK  13 0 was 0(4,1) pid=233565 tid=20 (unix)
ROLLBACK 139547936
LOCK    13 SHARED was NONE(EXCLUSIVE,1) pid=233565 tid=20 (unix)
LOCK    13 SHARED failed (unix)
UNLOCK  13 0 was 0(4,1) pid=233565 tid=20 (unix)
ROLLBACK 139547936
LOCK    13 SHARED was NONE(EXCLUSIVE,1) pid=233565 tid=20 (unix)
LOCK    13 SHARED failed (unix)
UNLOCK  13 0 was 0(4,1) pid=233565 tid=20 (unix)
ROLLBACK 139547936
LOCK    13 SHARED was NONE(EXCLUSIVE,1) pid=233565 tid=20 (unix)
LOCK    13 SHARED failed (unix)
UNLOCK  13 0 was 0(4,1) pid=233565 tid=20 (unix)
ROLLBACK 139547936


Regards,
Sandu Buraga



Date: Thu, 31 Oct 2013 14:05:17 -0400
From: Richard Hipp <d...@sqlite.org>
To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
Subject: Re: [sqlite] Enable WAL on a QNX system
Message-ID:
        <CALwJ=mxoxoqd7jyd68l3o7ajpqsil40mrrxm4saiv9rpdkc...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Thu, Oct 31, 2013 at 9:56 AM, Sandu Buraga <sandu.bur...@gmail.com>wrote:

> Hi,
>
> I am using SQLite 3.7.9, and QNX 6.5.0 running on Intel x86 machine. I am
> having a use-case with multiple readers threads and one writer thread, all
> running in the same process. No other process is using the SQLite database
> file.
>
> I tried to enable WAL feature, but with no success so far. Each thread has
> it's own handle:
>
> res = sqlite3_open_v2( m_FilePath.getBuffer(), &dbHandle,
>
> SQLITE_OPEN_READWRITE|SQLITE_
OPEN_WAL|SQLITE_OPEN_FULLMUTEX|SQLITE_OPEN_PRIVATECACHE,
> NULL );
>
> immediately after I am making these PRAGMA statements for the new opened
> handle
>
> "PRAGMA main.journal_mode=WAL;"
> "PRAGMA temp_store=MEMORY;"
>
> So if I have 5 threads, I am calling the above sequence 5 times for each
> distinct handle
>

(1) WAL mode is a persistent property of the database file.  Set it once
from a single-threaded connection and it will stay set forever.  You should
not try to set WAL mode on each connection separately.

(2) WAL mode uses mmap() to get access to a small piece of memory that is
shared between all connections.  But the mmap() is unreliable on many
version so QNX.  If you must use WAL mode, first run "PRAGMA
locking_mode=EXCLUSIVE".  That will prevent all processes but the first
from connecting to the database (though many threads from within that one
process can have their own individual connections).  And since only a
single process is accessing the database, heap memory instead of mmap()
memory is used for the shared memory region.  This trick enables WAL mode
to work reliably on QNX.



>
> When the code is executed I am getting frequently "databed locked"
> messages. I tried to diagnose the issue, by enabling also the WAL traces
in
> the SQLite amalgamation, but I noticed no message, so for me it looks like
> the WAL feature was not enabled. By analyzing the existed traces it looks
> like thread 2 - reader is getting a SHARED lock, while later process 3 -
> writer is trying to get an EXCLUSIVE lock.
>
> Any suggestion would be appreciated.
>
> Regards,
> Sandu
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



--
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to