Errors accessing SD card after suspend

Bug #1286522 reported by therapon sundoulos on 2014-03-01
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Undecided
Unassigned

Bug Description

Calibre 1.26, Kubuntu 13.10

My libraries are stored on an SD card. Removable media is set to automount, the base path to the libraries is a symlink in /home/user/. I start up Calibre, everything works fine - can read media, switch libraries, add books, the whole bit.

The problems occur after my laptop suspends. Calibre is open on the desktop, the computer suspends. I wake it up, login, the SD card automounts. Other applications with files open on the SD card function properly (Konqueror, for example). Calibre throws errors.

If I try to open a new book, the book does open but gives this error in the process:

calibre, version 1.26.0
ERROR: Unhandled exception: <b>IOError</b>:IOError: disk I/O error

calibre 1.26 isfrozen: True is64bit: False
Linux-3.13.0-10-generic-i686-with-debian-wheezy-sid Linux ('32bit', 'ELF')
('Linux', '3.13.0-10-generic', '#30-Ubuntu SMP Tue Feb 18 23:08:49 UTC 2014')
Python 2.7.5
Linux: ('debian', 'wheezy/sid', '')
Traceback (most recent call last):
  File "site-packages/calibre/gui2/actions/view.py", line 102, in view_format_by_id
  File "site-packages/calibre/gui2/actions/view.py", line 272, in update_history
  File "site-packages/calibre/db/backend.py", line 112, in __setitem__
  File "site-packages/calibre/db/backend.py", line 287, in execute
  File "src/cursor.c", line 231, in resetcursor
IOError: IOError: disk I/O error

If I try switching libraries, it gives this error:

calibre, version 1.26.0
ERROR: Unhandled exception: <b>IOError</b>:IOError: disk I/O error

calibre 1.26 isfrozen: True is64bit: False
Linux-3.13.0-10-generic-i686-with-debian-wheezy-sid Linux ('32bit', 'ELF')
('Linux', '3.13.0-10-generic', '#30-Ubuntu SMP Tue Feb 18 23:08:49 UTC 2014')
Python 2.7.5
Linux: ('debian', 'wheezy/sid', '')
Traceback (most recent call last):
  File "site-packages/calibre/gui2/actions/choose_library.py", line 561, in qs_requested
  File "site-packages/calibre/gui2/actions/choose_library.py", line 541, in switch_requested
  File "site-packages/calibre/gui2/ui.py", line 634, in library_moved
  File "site-packages/calibre/gui2/library/views.py", line 688, in set_database
  File "site-packages/calibre/gui2/library/views.py", line 498, in save_state
  File "site-packages/calibre/gui2/library/views.py", line 492, in write_state
  File "site-packages/calibre/db/backend.py", line 116, in set
  File "site-packages/calibre/db/backend.py", line 112, in __setitem__
  File "site-packages/calibre/db/backend.py", line 287, in execute
  File "src/cursor.c", line 231, in resetcursor
IOError: IOError: disk I/O error

The only way to get Calibre working properly again is to close and restart it. Obviously that's a workaround but a fix would be really nice.

This is not worth the effort for me personally. If some one else wants to implement it, I will be happy to supply any needed guidance. If so, re-open the ticket and we can discuss it.

 status wontfix

Changed in calibre:
status: New → Won't Fix
therapon sundoulos (sundoulos2) wrote :

Follow-up question: Is this an issue with Calibre or Python? If it's a Python issue, has it possibly been fixed in a later version?

Kovid Goyal (kovid) wrote :

It's not an issue with either calibre or python, it is an issue with
the kernel/filesystem your computer is using. It is not restoring the
filesystem properly after a recover from suspend, which causes SQLite to
fail when trying to write to the database. The only "fix" is to detect
that error and rte-open the connection to the database.

therapon sundoulos (sundoulos2) wrote :

Tried the commit, got the same results. Sorry!

therapon sundoulos (sundoulos2) wrote :

Got an updated version of Calibre; still get errors but slightly different with the commit applied.

calibre, version 1.26.0
ERROR: Unhandled exception: <b>AttributeError</b>:'DB' object has no attribute 'db'

calibre 1.26 isfrozen: False is64bit: False
Linux-3.13.0-10-generic-i686-with-Ubuntu-13.10-saucy Linux ('32bit', 'ELF')
('Linux', '3.13.0-10-generic', '#34-Ubuntu SMP Thu Feb 27 22:33:32 UTC 2014')
Python 2.7.5+
Linux: ('Ubuntu', '13.10', 'saucy')
Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/gui2/actions/view.py", line 102, in view_format_by_id
    self.update_history([(id_, title)])
  File "/usr/lib/calibre/calibre/gui2/actions/view.py", line 272, in update_history
    db.prefs['gui_view_history'] = history[:vh]
  File "/usr/lib/calibre/calibre/db/backend.py", line 111, in __setitem__
    self.db.execute('INSERT OR REPLACE INTO preferences (key,val) VALUES (?,?)', (key, raw))
  File "/usr/lib/calibre/calibre/db/backend.py", line 795, in execute
    self.db.reopen(force=True)
AttributeError: 'DB' object has no attribute 'db'

Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/gui2/actions/choose_library.py", line 570, in choose_library
    self.gui.library_view.save_state()
  File "/usr/lib/calibre/calibre/gui2/library/views.py", line 498, in save_state
    self.write_state(state)
  File "/usr/lib/calibre/calibre/gui2/library/views.py", line 492, in write_state
    db.prefs.set(name + ' books view state', state)
  File "/usr/lib/calibre/calibre/db/backend.py", line 115, in set
    self.__setitem__(key, val)
  File "/usr/lib/calibre/calibre/db/backend.py", line 111, in __setitem__
    self.db.execute('INSERT OR REPLACE INTO preferences (key,val) VALUES (?,?)', (key, raw))
  File "/usr/lib/calibre/calibre/db/backend.py", line 795, in execute
    self.db.reopen(force=True)
AttributeError: 'DB' object has no attribute 'db'

Kovid Goyal (kovid) wrote :

You need to apply the next commit as well.

That did it! Works after suspending without any errors. Thanks a million.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers