retry when sqlite throws ErrorIO

I suspect this may be due to SQLITE_IOERR_SHORT_READ, but have not
verified.

I was able to reproduce it on Linux after running the test suite in a loop
for 1-3 hours until it failed.

The WAL mode entry change in 3963c5fcf5
may have hidden the problem I was seeing; I have not seen an ErrorIO
since then.
This commit is contained in:
Joey Hess 2018-10-30 18:03:03 -04:00
parent 3963c5fcf5
commit 1428568554
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 82 additions and 25 deletions

View file

@ -59,4 +59,4 @@ Oh yeah, I am still discovering this powerfull git annex tool.
In fact, collegues and I are forming a group during the process to exchange about different use cases, encountered problems and help each other.
[[!meta title="sqlite crash on Windows running linux binary via WSL"]]
[[!meta title="v7: intermittent sqlite ErrorIO crash (especially in WSL)"]]

View file

@ -0,0 +1,26 @@
[[!comment format=mdwn
username="joey"
subject="""comment 6"""
date="2018-10-30T16:23:21Z"
content="""
I saw a different "SQLite3 returned ErrorIO while attempting to perform step",
which seems likely to be closely related to this problem.
(The "step" action happens right after the "prepare" action.)
failed to commit changes to sqlite database: Just SQLite3 returned ErrorIO while attempting to perform step.
CallStack (from HasCallStack):
error, called at ./Database/Handle.hs:116:26 in main:Database.Handle
The test suite occasionally fails due to this, and it seems always in
`test_lock_v7_force`. Which notably deletes the sqlite database just before
the failure, and so causes it to be re-created.
Dumping the keys database after such a failure, it is freshly created,
contains the tables but no data has been written to it.
I've made git-annex catch ErrorIO and retry. Not sure if that fixes the bug,
but it may.
Please try, if you can, the new git-annex version 7, and see if this bug
still happens.
"""]]