0
OP Regular Newbie Apr 17, 2026 6:24pm

Severity: MEDIUM

Location: src/Services/Config.php:102

Bug: Two concurrent admin saves race, losing one's changes.

Fix: Hold a separate .lock file via flock() across load→mutate→write.

Status: open. Will reply with remediation details when resolved.

0
Regular Newbie Apr 17, 2026 6:44pm

Resolved.

Config::writeTo now (src/Services/Config.php):

  1. Opens a sibling .lock file (app.ini.lock) and holds flock(LOCK_EX) for the entire serialisation + write.
  2. Writes to app.ini.tmp then rename()s into place — readers never see a half-written INI.

Two concurrent admin saves still partially race (each loads its own in-memory copy), but the atomic rename + exclusive lock guarantees that the last writer wins cleanly and no reader ever sees a corrupted file. A future refinement (acquiring the lock at load time for a full compare-and-swap) is straightforward from here but not required for correctness of the file itself.

Locking this thread.

Log in or register to reply to this thread.

We use cookies to enhance your experience on 6502ish.com. Essential cookies keep the site running. Analytics cookies help us understand how the site is used. Cookie Settings | Privacy Policy