/tmp size can prevent syncing library with device

Bug #1432820 reported by Taylor Smock on 2015-03-16
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Undecided
Unassigned

Bug Description

Problem appears in Arch Linux and Fedora Rawhide
Fedora: 2.20
Arch: 2.21

$ mount | grep /tmp
tmpfs on /tmp type tmpfs (rw,seclabel)

Before sending books
$ df -h /tmp #Fedora
Filesystem Size Used Avail Use% Mounted on
tmpfs 1.9G 15M 1.9G 1% /tmp

While sending books (some portion of library). Same results after exception.
$df -h /tmp #Fedora
Filesystem Size Used Avail Use% Mounted on
tmpfs 1.9G 1.9G 15M 100% /tmp

Error message when filling /tmp:
calibre, version 2.20.0
ERROR: Unhandled exception: <b>IOError</b>:[Errno 28] No space left on device

calibre 2.20 isfrozen: False is64bit: True
Linux-4.0.0-0.rc3.git2.1.fc23.x86_64-x86_64-with-fedora-23-Rawhide Linux ('64bit', 'ELF')
('Linux', '4.0.0-0.rc3.git2.1.fc23.x86_64', '#1 SMP Fri Mar 13 13:53:36 UTC 2015')
Python 2.7.9
Linux: ('Fedora', '23', 'Rawhide')
Traceback (most recent call last):
  File "/usr/lib64/calibre/calibre/gui2/device.py", line 1257, in dispatch_sync_event
    self.sync_to_device(on_card, delete, fmt)
  File "/usr/lib64/calibre/calibre/gui2/device.py", line 1459, in sync_to_device
    exclude_auto=do_auto_convert)
  File "/usr/lib64/calibre/calibre/gui2/library/models.py", line 595, in get_preferred_formats_from_ids
    self.db.copy_format_to(id, format, pt, index_is_id=True)
  File "/usr/lib64/calibre/calibre/db/legacy.py", line 339, in copy_format_to
    return self.new_api.copy_format_to(book_id, fmt, dest, use_hardlink=use_hardlink)
  File "/usr/lib64/calibre/calibre/db/cache.py", line 56, in call_func_with_lock
    return func(*args, **kwargs)
  File "/usr/lib64/calibre/calibre/db/cache.py", line 700, in copy_format_to
    use_hardlink=use_hardlink)
  File "/usr/lib64/calibre/calibre/db/backend.py", line 1380, in copy_format_to
    shutil.copyfileobj(f, dest)
  File "/usr/lib64/python2.7/shutil.py", line 52, in copyfileobj
    fdst.write(buf)
IOError: [Errno 28] No space left on device

When sending books to device, calibre uses /tmp, and when /tmp fills up errors out.

Steps to reproduce:
1. Have a Calibre Library larger than /tmp
2. Select all books in Calibre Library and send to device
3. Wait until it errors out

Expected behavior:
Calibre checks space left in /tmp, and sends library in chunks of size <= space left in /tmp, perhaps multiplied by something < 1. Failing this, Calibre should remove its temporary folder so that /tmp is not 100% full (and user can send chunks of library at a time).

Dont put /tmp in RAM. It is a stupid idea, no one if going to re-write
all programs to start checking if /tmp is too small before every
operation. If you must put /tmp in RAM, then use a different temp
directory for calibre via the CALIBRE_TEMP_DIR env var.

 status wontfix

Changed in calibre:
status: New → Won't Fix
Taylor Smock (tntsos5-gmail) wrote :

Using tmpfs for /tmp is the default with systemd (http://cgit.freedesktop.org/systemd/systemd/commit/?id=623ac9d2fce3170125ead9be20f56bfe68ea125e ) for a few years.

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

Other bug subscribers