forked from SWISDATA/processintel
pages.main_app: per-session temp directories leak and are never cleaned up #20
Labels
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ffrauenberger/ProcessIntel#20
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: low (temp files pile up on the server)
Where
app/pages/main_app.py:16-22app/components/buttons.py:25-39module.nix:250-265Problem
main_app.pycreatessession_tmp_dir = tempfile.mkdtemp(...)once per session state.to_home(), called by every Back/Home button and on many errors, runsst.session_state.clear(). That also removessession_tmp_dir, so the next run creates a new directory. The old one and its files (graph.png,graph.svg,graph.dot) are left behind.find … -type f -delete), so emptysession_*directories accumulate indefinitely. Local and pip installs have no cleanup at all, so exported graphs of user data stay in/tmp.Steps to reproduce
Expected behavior
One temp directory per session, removed when the session ends (or no temp files at all).
Actual behavior
A new
session_*directory is created after every navigation home; old directories and their files remain.Related: #34, #61.
Fix
Keep
session_tmp_dirwhen clearing state, or remove the old directory first. Delete it when the session ends, or avoid temp files entirely (graph.pipe(format=...), see #41). Extend the Nix cleanup to empty directories (find … -mindepth 1 -empty -delete).from
issues/BUG-020-session-temp-directories-leak.md(code analysis of commit6bcc646, 2026-10-03)