Exception when trying to sync while database is open

3 views
Skip to first unread message

Christoph Gordalla

unread,
Jun 20, 2022, 3:37:41 PMJun 20
to mnemosyne-proj-users
Hi Peter,

I hope that I can also report bugs here. I noticed already for a long time that the sync operation always fails when one tries to sync while the server database is open. Here you will also find the stack trace (on an Ubuntu system):

Traceback (innermost last):
  File "/usr/local/lib/python3.10/dist-packages/Mnemosyne-2.9-py3.10.egg/openSM2sync/server.py", line 326, in put_login
    session = self.create_session(client_info)
  File "/usr/local/lib/python3.10/dist-packages/Mnemosyne-2.9-py3.10.egg/openSM2sync/server.py", line 177, in create_session
    session = Session(client_info, database)
  File "/usr/local/lib/python3.10/dist-packages/Mnemosyne-2.9-py3.10.egg/openSM2sync/server.py", line 53, in __init__
    self.backup_file = self.database.backup()
  File "/usr/local/lib/python3.10/dist-packages/Mnemosyne-2.9-py3.10.egg/mnemosyne/libmnemosyne/databases/SQLite.py", line 424, in backup
    self.save()
  File "/usr/local/lib/python3.10/dist-packages/Mnemosyne-2.9-py3.10.egg/mnemosyne/libmnemosyne/databases/SQLite.py", line 405, in save
    self.con.commit()
  File "/usr/local/lib/python3.10/dist-packages/Mnemosyne-2.9-py3.10.egg/mnemosyne/libmnemosyne/databases/_sqlite3.py", line 95, in commit
    return self.connection.commit()
 sqlite3.OperationalError: database is locked

The error is not the end of the world since one can just fix it by closing the database and syncing again. However, maybe you can catch the exception and give the user a warning that one cannot sync when the database is open.

Best regards,

Christoph

Peter Bienstman

unread,
Jun 21, 2022, 1:07:03 AMJun 21
to mnemosyne-proj-users
Do you have the database open in another program or in another instance of Mnemosyne? It should be no problem if the database you're syncing is also the active database of the server. 

Also, what exactly do you mean by closing the database? Mnemosyne has no function 'close'... 

Peter 

--
You received this message because you are subscribed to the Google Groups "mnemosyne-proj-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mnemosyne-proj-u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mnemosyne-proj-users/c37fc212-693b-45d6-aa65-c6683919f7een%40googlegroups.com.

Christoph Gordalla

unread,
Jun 21, 2022, 2:50:39 AMJun 21
to mnemosyne-...@googlegroups.com
HI Peter,

with "having the database open", I mean when I opened the "Browse cards" dialog (Ctrl+B) in the server version of mnemosyne itself. With this "Browse cards" dialog open, the sync from the client fails and gives the error message from above.

Peter Bienstman

unread,
Jun 21, 2022, 4:25:45 AMJun 21
to mnemosyne-proj-users
I see what you mean now. Yes, that's a limitation of how I designed the card browser to be optimised for speed. I'll see if I can give a less scary message to the user.

Cheers,

Peter

Reply all
Reply to author
Forward
0 new messages