MerginMaps / MerginMaps/db-sync

db-sync daemon silently stops syncing — large version gap between DB and Mergin Maps project (v26 DB vs v92 GPKG)

Open
#179 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
53
Forks
24
PR merge metrics
No merged PRs in 30d

Description

### Environment

- **Mergin Maps**: self-hosted instance via Docker (CE) version 2.1.1
- **db-sync**: Docker container (`lutraconsulting/mergin-db-sync`)
- **Database**: PostGIS (PostgreSQL)
- **Init mode**: `--init-from-gpkg`
- **Projects**: Multiple production projects initialized with DB Sync, each with dedicated schemas

---

### Description

We are running db-sync in production against a self-hosted Mergin Maps instance. Synchronization initially works correctly — data collected on mobile devices appears in the PostgreSQL database as expected.

However, at some point the daemon appears to **stop syncing silently**: the Docker container keeps running (no crash reported, no restart), but new changes from Mergin Maps are no longer applied to the database. There is no visible error or alert.

We only discovered the issue by noticing a growing discrepancy between database content and what was visible in the Mergin Maps web interface and mobile app.

**Observed state:**
- Mergin Maps project (web + mobile): **v92**
- GPKG file: **v92**
- PostgreSQL database (base + modified schemas): stuck at **v26**
- ~2,000 records collected between v26 and v92 were missing from the database
- Users continued collecting data normally on the mobile app without any issue

---

### Steps to reproduce

We cannot reliably reproduce the issue on demand, but the sequence appears to be:

1. db-sync is initialized from GPKG and runs correctly for a period of time
2. At some point (possibly triggered by a network hiccup, a large changeset, or a geodiff error on a specific diff), the daemon stops applying changes to the database
3. The Docker container remains in a running state — no restart, no error in the console output we observed
4. New versions continue to be pushed to Mergin Maps by mobile users without any problem
5. The database version counter freezes while the Mergin project version keeps incrementing

---

### Questions / requests

1. Is there a known condition that causes the daemon to silently stop applying changes without exiting?
2. Is there a way to **resume sync from a specific project version** without a full `--force-init` (to avoid data loss in case of future incidents)?
3. Are there recommended **log verbosity settings and monitoring practices** for production deployments?
4. Are you planning any future versions of Mergin Maps?

---

### Related issues

- #10 — Network issues may freeze sync (no timeout on Mergin client)
- #30 — Tool fails to restart after being stopped
- #142 — Version mismatch after config change

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing db-sync's production logs and the handling of version gaps, network failures, and geodiff errors; no source file or test is named in the report. Reproduce or trace the v26-to-v92 case and document the condition that stops applying changes, how it is surfaced, and whether recovery can resume without --force-init.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.