CI Report:
https://ci-tests.linuxserver.io/linuxserver/tautulli/develop-a3aea891-ls489/index.html
LinuxServer Changes:
No changes
Remote Changes:
Copy the database download with the SQLite backup API
download_database read the whole database into a buffer before
writing the temp copy. On a 1.8 GB database that is a 1.8 GB
allocation on a request thread, measured at 1796 MB of anonymous RSS.
Confirmed against a 4 GB host: the kernel OOM killer SIGKILLs
Tautulli mid-request, and the reverse proxy in front of it reports a
502. Copy with connection.backup() instead, the same way
make_backup() already does. Memory is then bounded by the
connection cache size rather than the database size, measured at
136 MB above idle with cache_sizemb = 128.
The copy also read only the main database file. Under the default WAL
journal mode every commit since the last checkpoint lives in the
-wal file, so the downloaded database silently lost recent history.
The backup API includes the WAL contents and leaves the live one
alone.
The temp file went to the system temp directory, which is a tmpfs on
some systems and a private per-unit mount on others. Write it to the
cache directory instead, which is checked for writability at startup.
It was also never deleted, leaking a copy the size of the database per
download, so attach the same on_end_request delete hook that
download_config already uses and delete the file on the error path
too.
Verified against a 1.8 GB production database: 200 in 17 s, temp file
written to the cache directory and removed, quick_check ok, history
row count equal to the live database, and all user/server/JWT tokens
cleared.