zothero icon indicating copy to clipboard operation
zothero copied to clipboard

Database is locked

Open llity opened this issue 5 years ago • 13 comments

I meet some error, I cannot search the paper in the zotero

10:33:21 workflow.py:2080 ERROR database is locked Traceback (most recent call last): File "./lib/workflow/workflow.py", line 2073, in run func(self) File "./zh", line 714, in main return do_reindex() File "./zh", line 597, in do_reindex app.update_index(force=False) File "./lib/zothero/core.py", line 166, in update_index self.index.update(self.zotero, force) File "./lib/zothero/index.py", line 277, in update if not self._update(zot, force): File "./lib/zothero/index.py", line 325, in _update for e in it: File "./lib/zothero/zotero.py", line 268, in all_entries yield self._load_entry(row) File "./lib/zothero/zotero.py", line 320, in load_entry e.citekey = self.bbt.citekey('{}{}'.format(e.library, e.key)) File "./lib/zothero/zotero.py", line 195, in bbt self._bbt = BetterBibTex(self.datadir) File "./lib/zothero/betterbibtex.py", line 48, in init row = conn.execute(SQL).fetchone() OperationalError: database is locked 10:33:22 workflow.py:2082 INFO for assistance, see: https://github.com/deanishe/zothero/issues

llity avatar May 10 '20 02:05 llity

It is work now, just reopen Zotero!

llity avatar May 10 '20 02:05 llity

Thanks for finding the bug. I did wonder why this error wasn't occurring. The workflow makes a copy of Zotero's own database to avoid exactly this problem, but the BetterBibTex feature doesn't.

Perhaps @yarray would be interested in submitting a fix.

deanishe avatar May 10 '20 07:05 deanishe

@deanishe The Betterbibtex plugin seems not to lock the database unless it needs to perform actions like updating the citekeys. Nevertheless, it should be better to copy the database first to avoid the lock. I may take some time to investigate the proper strategy in the next days.

yarray avatar May 10 '20 12:05 yarray

The Betterbibtex plugin seems not to lock the database unless it needs to perform actions

Same is true of Zotero, IIRC, but you still run into problems.

I may take some time to investigate the proper strategy in the next days.

The same way the rest of the workflow works. I already changed your PR to fix bugs and cache the BBT keys along with the rest of the data because reading the entire database on every paste is a slow way to do things. The update code just needs altering to make a copy of the database and read that.

deanishe avatar May 10 '20 14:05 deanishe

I'm also having this issue. Currently can't use Zothero. I also have BBT installed and am getting the "library is locked" error- zothero is stuck on "Initializing Search Index"

agb84 avatar Aug 16 '20 01:08 agb84

I just wanted to provide an updated that zothero started working again (after a few attempts to restart/refresh zothero and zotero and checking plugins). I am no longer stuck on "Initializing Search Index." Hopefully this might help anyone else who may run into this.

agb84 avatar Aug 19 '20 15:08 agb84

I've been having this issue for a while now and while the issue will somehow resolve itself after a while, a simple restart of zotero does not reliably do the trick. Since it appears @deanishe has an idea how to potentially fix this, I was wondering if you or @yarray had time to do this? It would be great to be able to refresh zothero after I added new references to zotero.

robinhsi avatar Dec 10 '20 11:12 robinhsi

It is still a problem :( Using zotfile and BBT

masteranza avatar Jan 25 '21 12:01 masteranza

What worked for me, was

  1. deactivating BBT in Zotero -> Tools -> Addons.
  2. Restart Zotero
  3. Reindex ZotHero
  4. Reenable BBT and restart Zotero

eppfel avatar Nov 17 '21 08:11 eppfel

This did not work for me unfortunately :(

robinhsi avatar Jan 29 '22 17:01 robinhsi

@eppfel Did this work for you longer term or is it merely a one-time fix that you have to repeat again and again?

simonleandergrimm avatar Feb 09 '22 09:02 simonleandergrimm

I just had the problem again, checked for help in this issue tracker and found my own comment with the solution that I had totally forgotten. 🤣

So, it works longer term, as I did not have the error since a couple months.

eppfel avatar Feb 16 '22 21:02 eppfel

omg @eppfel thank you so much for the suggested solution, worked right away for me !

champagnealexandre avatar Feb 19 '22 21:02 champagnealexandre