OOM Killer on RPi 4 (2GB RAM) when entering a folder with a large PDF (1.5 GB)

Hello everyone,

I’m encountering a critical Out-Of-Memory (OOM) issue on my Seafile instance. My environment: Seafile 13 (Docker), Raspberry Pi 4 (2 GB RAM).

The problem is the following: I uploaded a large PDF file (around 1.5 GB) into a library. Whenever I enter the directory containing this file via the Web UI (Seahub), the server instantly freezes and the Linux kernel triggers the OOM Killer, killing the python3 (Seahub) process. This happens upon opening the folder view, before clicking on or opening the file itself.

I tried restricting thumbnails and previews in seahub_settings.py, but Seahub seems to ignore these settings during directory listing for PDFs. I tried these:

ENABLE_THUMBNAIL = False
ENABLE_PDF_PREVIEW = False
THUMBNAIL_EXTENSION = (‘png’, ‘jpg’, ‘jpeg’, ‘gif’, ‘bmp’)
THUMBNAIL_IMAGE_SIZE_LIMIT = 30
FILE_PREVIEW_MAX_SIZE = 30 * 1024 * 1024

Despite these configurations, Seahub still attempts to process the 1.5 GB PDF when the folder is loaded, driving RAM usage above 1.9 GB and causing a crash. I noticed discussions mentioning that ENABLE_THUMBNAIL might be deprecated or removed in recent versions, but there doesn’t seem to be a working guardrail to prevent PDF thumbnail worker processes from buffering multi-gigabyte files directly into system memory.

Is there a working configuration in Seafile 13 to strictly enforce a maximum file size limit for PDF thumbnail generation during directory listing? Is there a way to completely disable PDF background processing without breaking image thumbnails for standard photo formats?

The behavior you are describing—an OOM crash triggered by a large PDF during directory listing—indicates that Seahub is attempting to generate a thumbnail for that file.

To resolve this on a Raspberry Pi 4 (2 GB RAM), please check the following:

1. Web UI Settings Override

Since Seafile version 12.0, settings modified via the System Admin → Settings in the Web UI take precedence over seahub_settings.py. Please log in as an administrator and ensure that thumbnail generation is either disabled there or that the size limits are correctly set.

2. Dedicated Thumbnail Server (Seafile 13)

Seafile 13 introduced a new, dedicated Thumbnail Server component that uses a task queue and includes built-in safeguards.

  • It has a default limit THUMBNAIL_PDF_SIZE_THRESHOLD set to 50 MB. Files larger than this will not be processed.
  • If you are not using it, I highly recommend enabling it to offload this work from the main Seahub process. You can find the setup instructions here: Thumbnail Server - Seafile Admin Manual.

3. Check for Syntax Errors

In your provided configuration snippet, you used “curly” quotes:
THUMBNAIL_EXTENSION = (‘png’, ‘jpg’, ‘jpeg’, ‘gif’, ‘bmp’)
In Python (seahub_settings.py), these must be standard single (') or double (") quotes. If there is a syntax error in that file, Seahub will ignore the entire file and fall back to default settings. Ensure it looks like this:

THUMBNAIL_EXTENSION = ('png', 'jpg', 'jpeg', 'gif', 'bmp')

4. Version Check

Ensure you are running at least Seafile 13.0.17. This version specifically included “resource control in generating thumbnails for PDFs” to prevent exactly this type of memory exhaustion.

5. Verify PDF Thumbnail Exclusion

If you want to keep thumbnails for images but disable them for PDFs entirely, ensure pdf is not in your THUMBNAIL_EXTENSION list and restart your Docker containers:

docker compose restart

By switching to the dedicated thumbnail server and ensuring you are on version 13.0.17+, the 1.5 GB PDF should be automatically ignored by the thumbnail worker due to the 50 MB safety threshold.

1 Like