vdirsyncer icon indicating copy to clipboard operation
vdirsyncer copied to clipboard

Improve error message for when status db is locked

Open aleprovencio opened this issue 6 years ago • 11 comments

Hello, lately I can't successfully vdirsyncer sync my calendars because of a database is locked error. Synchronization works fine with android's davdroid which talks with the same server.

Your vdirsyncer version: 0.16.4 If applicable, which server software (and which version) you're using: Nextcloud 13 Your Python version: 3.6.4 Your operating system: Arch linux Relevant debug output:

Syncing my_calendars/jucy
debug:   File "/usr/lib/python3.6/site-packages/vdirsyncer/cli/tasks.py", line 63, in sync_collection
debug:     collection.name) as status:
debug:   File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__
debug:     return next(self.gen)
debug:   File "/usr/lib/python3.6/site-packages/vdirsyncer/cli/utils.py", line 227, in manage_sync_status
debug:     status = SqliteStatus(path)
debug:   File "/usr/lib/python3.6/site-packages/vdirsyncer/sync/status.py", line 119, in __init__
debug:     self._update_schema()
debug:   File "/usr/lib/python3.6/site-packages/vdirsyncer/sync/status.py", line 127, in _update_schema
debug:     with _exclusive_transaction(self._c) as c:
debug:   File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__
debug:     return next(self.gen)
debug:   File "/usr/lib/python3.6/site-packages/vdirsyncer/sync/status.py", line 13, in _exclusive_transaction
debug:     c = conn.execute('BEGIN EXCLUSIVE TRANSACTION')
Syncing my_calendars/personal
debug:   File "/usr/lib/python3.6/site-packages/vdirsyncer/cli/tasks.py", line 63, in sync_collection
debug:     collection.name) as status:
debug:   File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__
debug:     return next(self.gen)
debug:   File "/usr/lib/python3.6/site-packages/vdirsyncer/cli/utils.py", line 227, in manage_sync_status
debug:     status = SqliteStatus(path)
debug:   File "/usr/lib/python3.6/site-packages/vdirsyncer/sync/status.py", line 119, in __init__
debug:     self._update_schema()
debug:   File "/usr/lib/python3.6/site-packages/vdirsyncer/sync/status.py", line 127, in _update_schema
debug:     with _exclusive_transaction(self._c) as c:
debug:   File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__
debug:     return next(self.gen)
debug:   File "/usr/lib/python3.6/site-packages/vdirsyncer/sync/status.py", line 13, in _exclusive_transaction
debug:     c = conn.execute('BEGIN EXCLUSIVE TRANSACTION')

aleprovencio avatar Feb 19 '18 15:02 aleprovencio

Not happening anymore, don't know why. Sorry about the noise.

aleprovencio avatar Feb 20 '18 13:02 aleprovencio

Need to improve error message, reopening as reminder for follow-up issue. If you experience this again, you need to delete a special file in your status directory. I can't think of the exact name at the moment. Sorry for the slow response.

untitaker avatar Feb 20 '18 19:02 untitaker

I have this as well. which file should I delete?

christf avatar Feb 22 '18 21:02 christf

Sorry, I can't remember. Please check this page: https://sqlite.org/tempfiles.html

Otherwise please give me a listing of the status dir and I can tell you.

On 22 February 2018 22:00:53 GMT+01:00, Christof Schulze [email protected] wrote:

I have this as well. which file should I delete?

-- You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub: https://github.com/pimutils/vdirsyncer/issues/720#issuecomment-367820566

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.

untitaker avatar Feb 23 '18 11:02 untitaker

I think I found the name, the filename ends with journal. Delete all files with that suffix (make sure no vdirsyncer process runs) and you should be fine.

On Thu, Feb 22, 2018 at 01:00:53PM -0800, Christof Schulze wrote:

I have this as well. which file should I delete?

-- You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub: https://github.com/pimutils/vdirsyncer/issues/720#issuecomment-367820566

untitaker avatar Feb 25 '18 21:02 untitaker

@untitaker thank you - I did that cd .vdirsyncer find . -type f -name "*-journal" -exec rm {} ; and it worked.

christf avatar Mar 04 '18 19:03 christf

@untitaker Same problem but it change nothing delete *-journal file in the status dir

bepolymathe avatar Jan 07 '19 16:01 bepolymathe

I have the same error but there are no -journal files in the status directory. For the three tasks that fail I get

debug:   File "/usr/lib/python3.7/site-packages/vdirsyncer/cli/tasks.py", line 63, in sync_collection
debug:     collection.name) as status:
debug:   File "/usr/lib/python3.7/contextlib.py", line 112, in __enter__
debug:     return next(self.gen)
debug:   File "/usr/lib/python3.7/site-packages/vdirsyncer/cli/utils.py", line 227, in manage_sync_status
debug:     status = SqliteStatus(path)
debug:   File "/usr/lib/python3.7/site-packages/vdirsyncer/sync/status.py", line 119, in __init__
debug:     self._update_schema()
debug:   File "/usr/lib/python3.7/site-packages/vdirsyncer/sync/status.py", line 127, in _update_schema
debug:     with _exclusive_transaction(self._c) as c:
debug:   File "/usr/lib/python3.7/contextlib.py", line 112, in __enter__
debug:     return next(self.gen)
debug:   File "/usr/lib/python3.7/site-packages/vdirsyncer/sync/status.py", line 13, in _exclusive_transaction
debug:     c = conn.execute('BEGIN EXCLUSIVE TRANSACTION')
error: 3 out of 11 tasks failed.

Any idea what can be done? I only have .collections and .items in the status directory.

Edit: Used https://stackoverflow.com/a/3481134. I had to kill a stray vdirsyncer process.

j605 avatar Jan 30 '19 13:01 j605

Same here after a connection loss. Removing all items files did the trick:

find ./ -type f -name "*.items*" -exec rm {} \;

doug-letough avatar Aug 20 '19 07:08 doug-letough

I had to kill a stray vdirsyncer process.

this did it for me

surajsharma avatar Apr 09 '21 13:04 surajsharma

same here ... ps -ef | grep vdir showed the process and kill -9 (pid) did the deed

dchersey avatar Dec 23 '21 23:12 dchersey