df-lockedsettings-patch #18

Merged
af123 merged 9 commits from df/webif:df-lockedsettings-patch into master 2020-11-14 11:16:59 +00:00
Owner

Retry access in case the settings database is locked.

This is what I have under test now, but it hasn't found a persistent lock yet.

Retry access in case the settings database is locked. This is what I have under test now, but it hasn't found a persistent lock yet.
Contributor

Can you force a lock for test puposes using sqlite commnds?
Hopefully persistent locks wont occur in normal operation

Can you force a lock for test puposes using sqlite commnds? Hopefully persistent locks wont occur in normal operation
Author
Owner

How about this?

# sqlite3 /mod/etc/webif.db
SQLite version 3.27.2 2019-02-25 16:06:06
Enter ".help" for usage hints.
sqlite> .database
main: /mod/etc/webif.db
sqlite> PRAGMA main.locking_mode=EXCLUSIVE; 
exclusive
sqlite> BEGIN EXCLUSIVE;
sqlite> ^Z[1]+  Stopped                    sqlite3 /mod/etc/webif.db
# bg
[1] sqlite3 /mod/etc/webif.db
# /mod/webif/lib/auto/scan -d
/mod/webif/lib/settings.class:132: Error: Persistently unable to access Settings: database locked
in procedure '<reference.<setting>.00000000000000000000>' called at file "/mod/webif/lib/auto/scan", line 11
in procedure 'settings autolog' called at file "/mod/lib/jim/oo.tcl", line 52
at file "/mod/lib/jim/oo.tcl", line 73
in procedure '<reference.<setting>.00000000000000000000>' called at file "/mod/webif/lib/settings.class", line 265
in procedure 'settings _nval_setting' called at file "/mod/lib/jim/oo.tcl", line 52
at file "/mod/lib/jim/oo.tcl", line 73
in procedure 'settings' called at file "/mod/webif/lib/settings.class", line 132

[1]+  Stopped (tty output)       sqlite3 /mod/etc/webif.db
#

(normally scan runs to completion)

Instead of 5 x 1s, what about 4 tries doubling the delay: 0.5s, 1s, 2s (4s?)?

How about this? ```plain # sqlite3 /mod/etc/webif.db SQLite version 3.27.2 2019-02-25 16:06:06 Enter ".help" for usage hints. sqlite> .database main: /mod/etc/webif.db sqlite> PRAGMA main.locking_mode=EXCLUSIVE; exclusive sqlite> BEGIN EXCLUSIVE; sqlite> ^Z[1]+ Stopped sqlite3 /mod/etc/webif.db # bg [1] sqlite3 /mod/etc/webif.db # /mod/webif/lib/auto/scan -d /mod/webif/lib/settings.class:132: Error: Persistently unable to access Settings: database locked in procedure '<reference.<setting>.00000000000000000000>' called at file "/mod/webif/lib/auto/scan", line 11 in procedure 'settings autolog' called at file "/mod/lib/jim/oo.tcl", line 52 at file "/mod/lib/jim/oo.tcl", line 73 in procedure '<reference.<setting>.00000000000000000000>' called at file "/mod/webif/lib/settings.class", line 265 in procedure 'settings _nval_setting' called at file "/mod/lib/jim/oo.tcl", line 52 at file "/mod/lib/jim/oo.tcl", line 73 in procedure 'settings' called at file "/mod/webif/lib/settings.class", line 132 [1]+ Stopped (tty output) sqlite3 /mod/etc/webif.db # ``` (normally `scan` runs to completion) Instead of 5 x 1s, what about 4 tries doubling the delay: 0.5s, 1s, 2s (4s?)?
Contributor

Instead of 5 x 1s, what about 4 tries doubling the delay: 0.5s, 1s, 2s (4s?)?

That would work as well, in practice a single iteration should be enough to clear a 'normal' lock so .5 second initial delay is probably a good idea.

> Instead of 5 x 1s, what about 4 tries doubling the delay: 0.5s, 1s, 2s (4s?)? That would work as well, in practice a single iteration should be enough to clear a 'normal' lock so .5 second initial delay is probably a good idea.
Author
Owner

This seems to be working and I think it's ready to go in (at least) a beta version.

This seems to be working and I think it's ready to go in (at least) a beta version.
df changed title from WIP: df-lockedsettings-patch to df-lockedsettings-patch 2020-10-23 11:43:28 +00:00
af123 approved these changes 2020-11-14 11:16:44 +00:00
af123 merged commit 8021455a94 into master 2020-11-14 11:16:57 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: hummypkg/webif#18
No description provided.