acd_cli icon indicating copy to clipboard operation
acd_cli copied to clipboard

Handle sqlite3.DatabaseError when starting acd_cli if DB has failed

Open ChlorideCull opened this issue 8 years ago • 3 comments

Jun 11 07:56:18 storage xoracd[15690]: Traceback (most recent call last):
Jun 11 07:56:18 storage xoracd[15690]:   File "/usr/local/bin/acdcli", line 9, in <module>
Jun 11 07:56:18 storage xoracd[15690]:     load_entry_point('acdcli==0.3.1', 'console_scripts', 'acdcli')()
Jun 11 07:56:18 storage xoracd[15690]:   File "/usr/local/lib/python3.5/dist-packages/acdcli-0.3.1-py3.5.egg/EGG-INFO/scripts/acd_cli.py", line 1532, in main
Jun 11 07:56:18 storage xoracd[15690]:     cache = db.NodeCache(CACHE_PATH, SETTINGS_PATH, args.check)
Jun 11 07:56:18 storage xoracd[15690]:   File "/usr/local/lib/python3.5/dist-packages/acdcli-0.3.1-py3.5.egg/acdcli/cache/db.py", line 70, in __init__
Jun 11 07:56:18 storage xoracd[15690]:     self.integrity_check(check)
Jun 11 07:56:18 storage xoracd[15690]:   File "/usr/local/lib/python3.5/dist-packages/acdcli-0.3.1-py3.5.egg/acdcli/cache/db.py", line 140, in integrity_check
Jun 11 07:56:18 storage xoracd[15690]:     r = c.fetchone()
Jun 11 07:56:18 storage xoracd[15690]: sqlite3.DatabaseError: database disk image is malformed

Certain failure conditions can corrupt the sqlite database, and in general means manually removing .cache/acd_cli/nodes.db. However, can't this exception be caught and trigger an automatic database file removal and sync? A database failure is anomalous behavior and shouldn't happen, true, but handling it automatically should save hours of downtime.

ChlorideCull avatar Jun 11 '16 08:06 ChlorideCull

It would be ok for me if it crashes, but not with a strack trace but with a regular error message. Additionally there should be a cli paramter, like --reinit, that saves the oauth file and reinits the rest.

mojo2012 avatar Aug 08 '16 08:08 mojo2012

I'm getting this same error sometimes after an upload. I've had to write a script to check for this error after every upload, it removes the nodes.db and syncs.

Is there any way to detect how this happening or why?

kamos69 avatar Aug 25 '16 01:08 kamos69

This just happened to me. thx for the tip on cleanup @ChlorideCull ! acd_cli 0.3.2, api 0.9.0

mattwood-okta avatar Oct 07 '16 03:10 mattwood-okta