Skip to content

Ensure an 8G swap file for OOM resilience - #118

Merged
cpaelzer merged 1 commit into
mainfrom
add-swap-permanently
Sep 10, 2026
Merged

cpaelzer merged 1 commit into
mainfrom
add-swap-permanently

Conversation

@cpaelzer

@cpaelzer cpaelzer commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Report generation can be memory hungry and the units occasionally ran out of memory. As an emergency measure swap was added manually on the affected system; this formalizes that setup in the charm itself.

On install, re-deploy and charm upgrade alike, _ensure_swap() now guarantees an 8G /swapfile.swp on the root filesystem (the detachable charm storage must not hold swap):

An existing swapfile is kept as-is and only ensured to be active.

Any failure (e.g. insufficient disk space) blocks the unit visibly via the existing install error handling.

@cpaelzer
cpaelzer requested a review from TheJJ September 9, 2026 11:47

@TheJJ TheJJ left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think the llm didn't think this through very well - needs some changes for robustness and proper error output/handling.

Comment thread src/staticreports.py Outdated
Comment thread src/staticreports.py
Comment thread src/staticreports.py Outdated
Comment thread src/staticreports.py Outdated
Comment thread src/staticreports.py
@cpaelzer
cpaelzer force-pushed the add-swap-permanently branch from 3957c18 to a84ad6e Compare September 9, 2026 15:01
Report generation can be memory hungry and the units occasionally ran
out of memory. As an emergency measure swap was added manually on the
affected system; this formalizes that setup in the charm itself.

On install, re-deploy and charm upgrade alike, _ensure_swap() now
guarantees an 8G /swapfile.swp on the root filesystem (the detachable
charm storage must not hold swap):

An existing swapfile is kept as-is and only ensured to be active.

Any failure (e.g. insufficient disk space) blocks the unit visibly via
the existing install error handling.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
@cpaelzer
cpaelzer force-pushed the add-swap-permanently branch from a84ad6e to 04d0429 Compare September 9, 2026 16:17
@cpaelzer
cpaelzer requested a review from TheJJ September 9, 2026 16:17
@cpaelzer
cpaelzer merged commit f271390 into main Sep 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants