Limit how much memory one plugin update may use
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 32/100
Línea de trabajo
Start with src/paperpi/runner.py and install/paperpi.service, then read how plugin processes receive their time limits and per-plugin settings. The issue leaves the memory limit, whether users can configure it, and whether to limit the whole service undecided; first resolve those choices and measure current plugins, including on a Pi 3. Done means plugin memory exhaustion is reported as a failed update without disrupting other plugins, with the agreed limits covering the listed helper processes and Library pictures.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
Each plugin update runs in its own process with a time limit (60 s), but with no memory limit. Neither src/paperpi/runner.py nor install/paperpi.service sets one. A plugin that uses too much memory can fill the Pi's memory before its time runs out. The Pi then slows down while it moves memory to the SD card (swap), or Linux stops a process it picks itself, which may be PaperPi or the web interface instead of the plugin.
Found in the security review of ical_calendar (#302, comment on the PR), measured on the Pi 4 (1.8 GB):
- one invitation repeating every second (
RRULE:FREQ=SECONDLY) for 7 days: about 690,000 events, over 1 GB; the 60 s limit stopped it at about 500 MB (the plugin now leaves such events out); - a 5 MB calendar file: 376 MB while reading it.
Other plugins could do the same: large images (slideshow, comics), large JSON answers, a bug in a loop. A Pi 3 has only 1 GB.
Idea
- Give each plugin process a memory limit, set in the new process before the plugin is imported (for example with Python's
resource.setrlimit;RLIMIT_AScounts all memory the process reserves,RLIMIT_DATAonly its data). - A default for every plugin (for example 300 MB), a plugin can suggest more in its
Plugin(...)(likestorage_mb), and the user can change it per plugin (liketime_limit). - Going over the limit counts as a failed update with a plain message ("used more than 300 MB of memory"), the same as going over the time limit, so the other plugins keep working.
- Maybe also
MemoryMax=inpaperpi.service, so all of PaperPi together can't take the whole Pi.
To decide (txoof)
- The default limit, and whether the user may change it.
- Whether the systemd limit for the whole service is wanted too.
To check while building
- How much memory each current plugin really uses (some reserve more than they use, e.g. image libraries), so the default doesn't break any of them; also on a Pi 3.
- That the limit also covers the setting helpers' search processes and the Library pictures, which run the same way.
- Lenguaje dominante
- Python
- Estrellas
- 205
- Forks
- 17
- Merge medio
- 3 h 55 min
- PR fusionados (30 d)
- 77
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de txoof/PaperPi
-
Plugins whose default refresh equals the display time (word_clock, system_info, nl_openbaar_vervoer)Posiblemente ocupada @txoof-bot la tomó hoy. Abiertoarea:plugins in-progress
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
txoof/PaperPi#335 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
area:web enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 56/100
Los mantenedores suelen responder en 1 día
-
area:core area:web enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 45/100
Los mantenedores suelen responder en 1 día
Todos los issues de txoof/PaperPi
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
sylvainmetayer/homelab#851 ·
Los mantenedores suelen responder en 1 día
-
needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Add `ty-pre-commit` hookAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
kubeflow/docs-agent#279 ·
Los mantenedores suelen responder en 3 días
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Qiskit/qiskit-ibm-runtime#3523 ·
Los mantenedores suelen responder en 1 día