Fix concurrent JSON read-modify-write race (2 gunicorn workers, no lock) #13

Open
opened 2026-06-06 19:58:12 +00:00 by tonym · 0 comments

Severity: high
Category: data-integrity
Location: app.py:198-200, Dockerfile:29

Problem

With --workers 2, two concurrent POSTs both load, modify, and write the same file — last write wins and silently discards the other.

Suggested fix

Drop to --workers 1 (fine for a single household) or use fcntl.flock/filelock around load+save.

Filed by automated code review.

**Severity:** high **Category:** data-integrity **Location:** `app.py:198-200, Dockerfile:29` ### Problem With `--workers 2`, two concurrent POSTs both load, modify, and write the same file — last write wins and silently discards the other. ### Suggested fix Drop to `--workers 1` (fine for a single household) or use `fcntl.flock`/`filelock` around load+save. _Filed by automated code review._
tonym added the
data-integrity
severity:high
labels 2026-06-06 19:58:12 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bonna61/Moon-Household-Budget#13
No description provided.