Troubleshooting

Failure modes of a deployment, what a process, its logs and status say in each, and what to do.

Each section names what you see, why, and what to do. Every command here may be run again safely.

A process does not start

Its exit code says why:

  • 2: the command line or the configuration is invalid. The process lists every problem at once, each naming its option and source. mimicd serve --check checks the configuration without starting. An option of the earlier server (data-dir, node, join, …) is refused saying it is gone.
  • 5: the store is incompatible, and a restart will not change it: fsync, full_page_writes or synchronous_commit off, PostgreSQL older than 16, a schema a later build migrated, another deployment's store (its deployment-name differs), a --store the deployment has not added, or a store that refuses the settings each transaction sets.
  • 1: a store not reached, or a listener not bound. The supervisor restarts it; it starts once the store answers.

If the log says password authentication failed, the role's password is not the one in the store's URL: see Docker for the Compose file's role.

A process is live but never ready

/readyz answers 503 and names what is unmet. home_store_reachable: the process has not reached its home store within the last 5 seconds. Check the store's reach and credentials, and its max_connections: a process needs one connection of its own to each store besides its pool.

Processes cannot reach each other

Forwarded requests fail, and the processes log refused handshakes on their internal listeners.

  • Every process must have the same internal.secret-file contents, or certificates from the same CA (and the internal.tls-peer-name every certificate carries).
  • advertise.internal must be an address the other processes reach: a process listening on 0.0.0.0 needs one.
  • A process without an internal listener refuses to start while processes with one are live.

Writes are refused

  • resource_exhausted, with mimic_admission_refusals_by_resource rising for a resource: the database or its budget group is at a limit. See Limits.
  • database_fenced: the partition is fenced by a move between stores (it passes in seconds; clients retry), or the database by a fence of its home, to move it to another deployment (it lasts until the fence is lifted). GET /v1/admin/databases/{db} and the status show a home fence.
  • unavailable: the partition's store does not answer, or cannot write (a full disk): see A store is out of reach. mimic_journal_appends{outcome="error"} rises.
  • migration_blocked: the write's result fails a migration being sealed; see Schema migrations.
  • permission_denied for anyone but a superuser: the database's access mode is read_only or blocked.

A store is out of reach

Its partitions answer unavailable, the others are served, and the status lists store_unreachable (mimic_store_reachable 0). Without its home, no process is ready. Restore the store's reach; processes try it again by themselves and serve it as it answers.

A store that cannot write (its disk full) refuses every append: nothing is acknowledged that was not committed. Add disk, move partitions to another store, set retained limits, and check that backups reach their destination: a backup that cannot be read back holds history in the store for up to 7 days, or twice backup_full_interval, whichever is longer.

A takeover is blocked

The alert mimic_lease_takeover_blocked: a process taking a partition over found a PostgreSQL session holding it that it may not end. Connect every process as one role, or give the role pg_signal_backend and pg_read_all_stats, or end the session by hand (pg_terminate_backend). The partition answers unavailable until then.

A store failed over, or was taken back

A failover to a synchronous standby loses nothing; processes reconnect. A store recovered to an earlier point (an asynchronous standby promoted, a point-in-time recovery) lost what was committed after it, and the processes notice:

  • a partition move the stores and the home disagree about parks (mimic_store_map_behind): mimicd admin stores reconcile --key KEY;
  • a partition fenced by a fence the home lost is shown (home_fence_orphaned): fence the database again, then lift that fence;
  • a fence whose lift the home lost is shown (home_fence_lift_lost): lift it again;
  • increments of the open backup chain fail: start a full of each database on that store (mimicd admin backup start).

See PostgreSQL stores.

A stuck partition move

A move whose step keeps failing is listed as move_failing. Before its switch, cancel it (mimicd admin moves cancel --key KEY): the target's copy is dropped and the source's fence lifted. After its switch it completes once the target store answers: restore its reach. A move parked as needs_reconcile is reconciled with mimicd admin stores reconcile --key KEY.

Backups fail

LoggedWhat to do
mimic_backup_destination_refusedFix the destination's access or name: credentials in every process's environment
mimic_backup_stalledFind what holds the backup: the destination's reach, or the store's
mimic_backup_held_too_longA full outran its hold by the writes made meanwhile; it is taken again
mimic_backup_chain_segmentsRaise backup_chain_segments
mimic_backup_merge_over_budgetRaise backup.merge-segments above backup_chain_segments + 1, memory permitting

See Backups and restores.

Sessions drop

  • Clients reopen after a process stops or hands a partition over; that is normal during restarts and upgrades.
  • A load balancer that cuts idle WebSockets early drops sessions every few minutes; allow idle connections of at least a minute.
  • During a rolling upgrade, sockets of session protocol 3 or 4 are closed unavailable while a process of an earlier build is live, and clients reconnect on protocol 2.
  • Sessions closed unauthenticated when their document token expires are reopened by clients with a new token; frequent ones point at tokens with a short lifetime and a credential function that does not renew them.

A browser cannot reach the API

A browser's preflight is refused unless the page's origin is in the deployment setting cors_origins. Sessions are WebSockets and need no CORS origin, but a document token with origins refuses a session from an origin it does not list (permission_denied).

A migration will not activate

  • migration_failing: documents fail the migration. The migration's status lists them with the check's code and path; fix the migration or the documents.
  • unavailable: a partition has not finished a verification pass yet, a process of an earlier build is live, or the process's migration sandboxes are refused (see Security).
  • A quarantined document blocks it until it is released and repaired or deleted.

A document answers migration_failed

It could not be migrated to its collection's active version and is held: a superuser's repair to a state of the target version, or a delete, releases it.

A document is quarantined

A document found corrupt, or one whose handling panicked, is quarantined: logged at error with its reference, and listed in the status (documents_quarantined, mimic_quarantined_documents). Writes and reads of it are refused data_corruption; a retry of a write it recorded is still answered.

mimicd admin quarantine list --database DB
mimicd admin quarantine release --database DB --collection COLLECTION DOCUMENT

release serves it again from its history (audited); a superuser's repair restores its state. Physical corruption of a store is PostgreSQL's: keep data checksums on, and recover a damaged store as a lost one.

Lost superuser credentials

mimicd admin superuser reset <name>, with the home store's credentials, creates or re-enables a superuser with a new password; see Administration.

Reporting a problem

Report bugs as issues in the repository, with the build (mimicd version), the topology, the relevant mimicd admin status output and log lines. Logs and status hold no document content or secrets. Report security problems privately; see Security.