Problem with sqlite3 and WAL

333 views
Skip to first unread message

peter

unread,
Jan 28, 2016, 10:47:54 AM1/28/16
to web2py-users
I have a version of sqlite3 that is 3.7...

I have been having problems with the database being locked.

So I tried
    db.executesql("PRAGMA journal_mode=WAL;")

(just once)

I then cannot access the application without getting a 

OperationalError: unable to open database file

Any ideas how I can turn WAL on without this problem?

Things were otherwise working fine prior to trying to turn WAL on.

Thanks

Ron Chatterjee

unread,
Jan 28, 2016, 10:58:00 AM1/28/16
to web2py-users
Have you tried db.commit()?

peter

unread,
Jan 28, 2016, 11:33:38 AM1/28/16
to web2py-users
I have looked into it further, and two new files are created in my databases directory. 

storage.sqlite-wal
and
storage.sqlite-shm

They need their group write permissions to be set. However, they seem to keep on getting deleted and recreated. Each time they are created their group write permissions are not being set.

Anyone got any ideas on this.

Thanks for your suggestion Ron, I am not sure it is going to help here.

Peter

peter

unread,
Jan 28, 2016, 11:38:48 AM1/28/16
to web2py-users
Oh Ron, I see this might be a way of avoiding the lock problem without resorting to WAL. Thanks.
Peter

On Thursday, 28 January 2016 15:47:54 UTC, peter wrote:

Ron Chatterjee

unread,
Jan 28, 2016, 12:01:17 PM1/28/16
to web2py-users
I will make sure not to delete this post. lol. Cool. glad to help.

peter

unread,
Jan 29, 2016, 9:45:09 AM1/29/16
to web2py-users
I am restating my problem with all that I now know.
 
I have a version of sqlite3 that is 3.7...

I have been having problems with the database being locked.

So I tried
    db.executesql("PRAGMA journal_mode=WAL;")

(just once)

I then cannot access the application without getting a 

OperationalError: unable to open database file

If I look in the databases folder, I see that there are two file 
storage.sqlite-wal and 
storage.sqlite-shm

The first of these has 0 bytes as its size.
Both of them have the 'wrong' permissions in that they do not include group write permissions.
If I change the permissions of the two files, then reload the page, it works. 
However I will soon again get the 'unable to open database error', and the persmissions will need resetting.

Does anyone have any idea why I am getting these permission issues with the WAL file?

I set up a very simple application and WAL worked okay on that, so WAL is possible on my system.

If I turn WAL off and go back to DELETE everything works fine, but I am at risk of database locking. so I would prefer to be able to use Write Ahead Logging.

Thanks for any help
Peter



 

Niphlod

unread,
Jan 29, 2016, 9:58:26 AM1/29/16
to web2py-users
file permissions should be the issue because those files are not usual ones. 

peter

unread,
Jan 29, 2016, 10:34:57 AM1/29/16
to web2py-users
The strange thing is that it works okay with another app. So what I can I do about permissions. The permissions for the databases folder are okay. If I change the permissions on those files the changes are non persistent. So I am stuck.

Dave S

unread,
Jan 29, 2016, 2:10:41 PM1/29/16
to web2py-users


On Friday, January 29, 2016 at 7:34:57 AM UTC-8, peter wrote:
The strange thing is that it works okay with another app. So what I can I do about permissions. The permissions for the databases folder are okay. If I change the permissions on those files the changes are non persistent. So I am stuck.

You need to find out what's creating those files, and have it do the job correctly.

/dps

peter

unread,
Jan 29, 2016, 3:54:44 PM1/29/16
to web2py-users
I imagine it is sqlite3 itself that is creating them. How one can get it to change the way it does things I do not know. As I say it seems to work ok with another app that is in the same setup. So why sqlite should behave in an app specific way I do not know.

Peter
Reply all
Reply to author
Forward
0 new messages