92 lines
2.1 KiB
Markdown
92 lines
2.1 KiB
Markdown
# Jellyfin – Incident SQLite WAL (2026-05-24)
|
||
|
||
**LXC :** 20308096
|
||
**Version :** Jellyfin 10.11.9
|
||
|
||
---
|
||
|
||
## Symptôme
|
||
|
||
Jellyfin injoignable, forcé de rebooter le LXC depuis PVE.
|
||
|
||
---
|
||
|
||
## Cause
|
||
|
||
La tâche planifiée `OptimizeDatabaseTask` a déclenché un `PRAGMA wal_checkpoint(TRUNCATE)` en interne.
|
||
Le checkpoint s'est bloqué pendant **64 minutes** (3 844 360 ms) puis a crashé avec :
|
||
|
||
```
|
||
System.IndexOutOfRangeException
|
||
at Jellyfin.Database.Implementations.Locking.OptimisticLockBehavior
|
||
```
|
||
|
||
Bug connu Jellyfin sur SQLite. Le WAL n'a jamais été fusionné → fichier WAL de 25 MB au moment du diagnostic.
|
||
La DB elle-même est **intègre** (`PRAGMA integrity_check` = `ok`).
|
||
|
||
---
|
||
|
||
## Fix appliqué
|
||
|
||
```bash
|
||
systemctl stop jellyfin
|
||
sqlite3 /var/lib/jellyfin/data/jellyfin.db "PRAGMA wal_checkpoint(TRUNCATE);"
|
||
# résultat attendu : 0|0|0
|
||
systemctl start jellyfin
|
||
```
|
||
|
||
---
|
||
|
||
## Prévention
|
||
|
||
### 1. Mode journal SQLite → DELETE
|
||
|
||
Passage du mode WAL au mode DELETE, qui élimine l'accumulation du fichier WAL :
|
||
|
||
```bash
|
||
systemctl stop jellyfin
|
||
sqlite3 /var/lib/jellyfin/data/jellyfin.db "PRAGMA journal_mode=DELETE;"
|
||
systemctl start jellyfin
|
||
```
|
||
|
||
Vérification (Jellyfin démarré) :
|
||
|
||
```bash
|
||
sqlite3 /var/lib/jellyfin/data/jellyfin.db "PRAGMA journal_mode;"
|
||
# attendu : delete
|
||
```
|
||
|
||
Jellyfin 10.11.9 ne force pas le retour en WAL — le mode `delete` persiste après restart. ✓
|
||
|
||
### 2. Cron (root, LXC jellyfin)
|
||
|
||
```cron
|
||
10 12 * * * /usr/bin/systemctl reboot
|
||
```
|
||
|
||
Reboot quotidien à 12h10. La ligne de checkpoint WAL a été supprimée (inutile en mode DELETE).
|
||
|
||
### 3. UI Jellyfin
|
||
|
||
Dashboard → Tâches planifiées → **Optimize Database** → déclencheur automatique désactivé.
|
||
|
||
---
|
||
|
||
## Fichiers concernés
|
||
|
||
### Avant (au moment du crash)
|
||
|
||
| Fichier | Taille | Notes |
|
||
|---|---|---|
|
||
| `jellyfin.db` | 1.9 GB | DB principale, intègre |
|
||
| `jellyfin.db-wal` | 25 MB | WAL bloqué, non fusionné |
|
||
| `jellyfin.db-shm` | 64 KB | Shared memory WAL |
|
||
|
||
### Après (solution appliquée)
|
||
|
||
| Fichier | Taille | Notes |
|
||
|---|---|---|
|
||
| `jellyfin.db` | 1.9 GB | Inchangée |
|
||
| `jellyfin.db-wal` | — | Absent (mode DELETE) |
|
||
| `jellyfin.db-shm` | — | Absent (mode DELETE) |
|