Free trial
Colour

Safe mode, crashes and the Restored your last session bar

Understand what the server does after a crash, when it enters safe mode, and how the Restored your last session bar gives your unfinished work back.

For
Everyone
Hosting
Any hosting
Devices
All devices
Business
All businesses

Checked against Pop Dispatch 0.1.0

Pop Dispatch protects your records when something goes wrong. You will be able to read the two messages it shows after a crash, and know which work comes back and which actions stay open.

Before you start #

Nothing to set up. These protections run on their own.

Your unfinished work comes back #

  1. While you work on a draft job or an invoice draft, the app saves the draft as you go. Each draft is checked by a checksum when it is read back.
  2. If the app or the server stopped without a clean ending, the next time you open Pop Dispatch a bar appears at the top of the window: "Restored your last session".
  3. Choose Review to open each draft. Review it, then save it the usual way.
  4. Choose Discard to delete the drafts.
  5. Nothing posts from a draft by itself. You confirm each one.

A draft that fails its checksum is dropped, and the answer counts how many were dropped.

What happens after a crash #

  • A crash writes a crash log in the crash folder of the data folder, named crash- with the time. The log holds the version, the system, where it happened, a backtrace and the last 50 lines of the server log. It leaves out the panic message and holds no customer, vehicle or invoice data.
  • The server counts each crash. Three crashes within five minutes put the server in safe mode at its next start.
  • A server that stopped without a clean ending (a power cut, a forced stop) runs the full integrity check at its next start.

Safe mode #

In safe mode the banner "The app needs your help" shows on GET /health and GET /me.

  • Reading keeps working.
  • Backups and exports keep working.
  • Every other change answers safe_mode (HTTP 503): "The server restarted too often, so it is read only. You can still read, export and back up."
  • Safe mode ends when the crashes are more than five minutes old at a restart, or when the owner restores a backup, which clears the crash count.

When the launch check finds a problem #

At start, the server checks the database and the totals of every invoice, and verifies each audit log chain. If a check fails, changes pause with the message "The stored data failed its safety check, so changes are paused." The owner and managers see the newest backup offered as restore_offer in GET /me, with the path of the newest crash log as log_path. See "Backups and restore".

Technical details
  • Crash times are kept in crash/crashes.json. A run marker file in the data folder is written at start and removed at a clean stop.
  • Safe mode keeps /backup and /export open for changes. A failed launch check pauses every change, including backups, until a restore.
  • GET /journal/restore returns the bar text, the drafts and the dropped count. POST /journal saves a draft (screens draft_job and invoice_draft, up to 64 KB). DELETE /journal discards.
  • Each person sees only their own drafts.

If something goes wrong #

  • The banner stays after you restart: the crashes are still within five minutes. Wait five minutes and restart again, or restore a backup.
  • Changes answer safe_mode and you need to work now: use the playbook "Server down or restoring a backup".
  • The server crashes again right after start: keep the newest crash log and send it to your supplier.