PDF uploads cause Mattermost OOM crash when poppler-utils is not installed

Overview

On servers where file content extraction is enabled and poppler-utils is not installed, uploading certain PDF documents can cause the Mattermost process to consume all available server memory and crash. The process is automatically restarted by systemd, but users will experience a brief outage and any in-progress operations will be lost.

Affected versions

  • Mattermost 11.7.5 and later with FileSettings.ExtractContent enabled
  • Earlier versions may also be affected but with different symptoms (see Notes)

Symptoms

  • Mattermost process crashes and restarts shortly after a PDF is uploaded
  • System logs (journalctl -u mattermost) show Failed with result 'oom-kill'
  • Kernel logs show a line similar to: Out of memory: Killed process <pid> (mattermost) ... anon-rss:<large value>kB
  • Mattermost logs show Failed to extract file content: document text extraction timed out after 10s for the triggering file shortly before the crash
  • Plugin errors such as muxBroker couldn't Accept request body connection timeout waiting for accept appear in the seconds before the crash, indicating the Go scheduler is severely starved

Root cause

When FileSettings.ExtractContent is enabled, Mattermost attempts to extract text from uploaded PDFs for full-text search. It does this in two stages:

  1. documentExtractor — shells out to the pdftotext binary from the poppler-utils package. Because this runs as a separate OS process, it can be killed cleanly without affecting Mattermost.
  2. pdfExtractor — a Go-native PDF parser built into Mattermost. If pdftotext is not installed, Mattermost falls back to this parser automatically. Because it runs inside the Mattermost process, any runaway memory allocation directly threatens the server.

The Go-native parser has no memory bound. For most PDFs it completes quickly, but certain document structures — particularly AcroForm-heavy documents such as W2 tax forms, complex financial statements, and PDFs with large numbers of embedded form fields or fonts — can cause it to allocate memory far in excess of the file's on-disk size. A 10-second extraction timeout (introduced in 11.7.5) releases the upload worker when it fires, but the extraction goroutine continues running in the background and keeps consuming memory until the process is killed by the operating system.

This issue is tracked in MM-69725.

Mitigation options

Option 1: Install poppler-utils (recommended)

Installing poppler-utils restores the preferred extraction path. Mattermost will use pdftotext for all PDF files, and the Go-native fallback parser is never invoked. This also improves PDF search result quality.

On Debian/Ubuntu:

sudo apt-get install poppler-utils

On RHEL/CentOS/Rocky:

sudo yum install poppler-utils

No configuration change is required. Restart Mattermost after installing:

sudo systemctl restart mattermost

To verify the binary is available to the Mattermost process:

which pdftotext

Option 2: Disable file content extraction

If installing poppler-utils is not possible, disabling content extraction entirely prevents the crash. Note that this means users will no longer be able to search inside the contents of uploaded files of any type.

In config.json:

"FileSettings": {
    "ExtractContent": false
}

Or via environment variable:

MM_FILESETTINGS_EXTRACTCONTENT=false

Restart Mattermost after making this change.

Verifying the fix

After installing poppler-utils, upload a PDF and confirm the following log line does not appear:

Unable to extract file content ... extractor: documentExtractor ... exec: "pdftotext": executable file not found in $PATH

If the fix is working correctly, no extraction warning will be logged for PDF files.

Notes

  • The presence of the log message Unable to extract file content ... executable file not found in $PATH is a reliable indicator that poppler-utils is not installed and that all PDFs are being processed by the Go-native fallback parser. This warning appears for every PDF upload and should be treated as an urgent configuration gap on any server with ExtractContent enabled.
  • On servers running Mattermost 11.7.4 or earlier, the worker pool saturation bug (MM-69098) means the crash symptom may differ — uploads may hang rather than trigger an OOM — but installing poppler-utils is still the correct resolution.
  • The official documentation lists poppler-utils as an optional dependency that "significantly improves server performance." For servers with ExtractContent enabled, it should be treated as effectively required for safe operation.
  • As an additional safety measure, adding a MemoryMax limit to the systemd unit (e.g. MemoryMax=12G on a 16 GB server) will cause the OOM kill to occur faster and at a lower memory threshold, reducing the impact on other services while the root cause is addressed. This does not fix the underlying issue.
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.