Files
Classroom_Desktop/systemd/user/ekklesia-classroom-presentations.service
ekklesiaandClaude Opus 5.5 3855989029 fix: a presentation that runs out of memory says so, and the service survives it
On a 4 GB VM the kernel killed the import service mid-conversion. Measured:
LibreOffice needs 0.2 GB for a text deck and 1.4-2.1 GB for decks of many
different photographs, for about twenty seconds — a spike, not a leak.
What made it a problem was the rest: OOMPolicy=stop took the watcher down
with LibreOffice, it restarted and resumed the same conversion with no
limit, and the library said "Getting this ready" throughout.

The service is capped at 40% of memory, is first in line when memory runs
short everywhere, and survives a killed LibreOffice (OOMPolicy=continue).
A killed conversion is a failed import of kind "memory"; an import
interrupted twice is not tried a third time; the card says the computer
needed more memory, to close other programs and choose Try again; an
import nobody has worked on for 20 minutes shows the same card; and an
exclusive lock keeps it to one import at a time.

Lab, the real service and LibreOffice: at a 4 GB-machine ceiling the
2.1 GB deck still imported; with no swap and a 300 MB ceiling LibreOffice
was killed, the watcher kept its PID and the card offered Try again,
which worked; the whole service killed during two attempts gave up after
the second; three decks at once never ran two LibreOffices together.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-23 22:16:50 -05:00

50 lines
2.3 KiB
Desktop File

[Unit]
Description=Ekklesia Classroom presentation import
Documentation=file:///usr/local/bin/classroom-presentation-import
# Nothing graphical: it copies, converts and renders files. It is a user
# service rather than a system one because the downloads it watches and
# the library it fills both belong to the classroom account, and a root
# service writing into a teacher's home would have to be told about every
# one of those permissions.
PartOf=graphical-session.target
[Service]
ExecStart=/usr/local/bin/classroom-presentation-import
# It exits 0 immediately on a device with PRESENTATIONS_ENABLED=false, and
# on-failure means such a device is left alone rather than restarted in a
# loop forever. A device that does have Presentations gets the watcher
# back if it ever dies, because a teacher whose download never appears has
# no way at all to find out why.
Restart=on-failure
RestartSec=10
Slice=session.slice
# LibreOffice converting a large deck must never be what a teacher notices
# about the machine. The room's own applications come first; this is the
# only thing here that is allowed to take a while.
Nice=10
IOSchedulingClass=idle
# MEMORY. Measured in the lab, LibreOffice converting one deck: 203 MB
# for ten slides of text, 738 MB for thirty slides sharing twelve photos,
# 1.4 GB for thirty different photos and 2.1 GB for twenty very large
# ones, for twenty seconds or so. A 4 GB classroom running Plasma and
# Wonder Ink does not have 2 GB spare, and in testing the kernel killed
# the whole service mid-conversion — which then restarted and tried the
# same deck again, while the library said "Getting this ready" for ever.
#
# At most 40% of this machine's memory: 1.6 GB on 4 GB, 3.2 GB on 8 GB.
# A deck that needs more is stopped HERE, inside this service, rather
# than pushing the teacher's own windows out of memory.
MemoryMax=40%
# If memory runs short everywhere, this is what goes first: never the
# lesson on the screen, the browser or the panel.
OOMScoreAdjust=800
# And a killed LibreOffice is a failed import, not a dead service. The
# watcher records it — "needed more memory", with Try again — and carries
# on. systemd's default stops the whole unit when any one process in it
# is killed for memory.
OOMPolicy=continue
[Install]
WantedBy=plasma-workspace.target