MerginMaps / MerginMaps/db-sync
db-sync enters an infinite drop/recreate loop when geodiff init fails on invalid source geometries
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 53
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
When init of a sync connection fails with "Initialization of db-sync failed due to a bug in geodiff", mergin-db-sync runs its cleanup step which drops the target schemas ( and _base). Because the container runs under restart: unless-stopped and the failure is deterministic (same source data every time), the daemon restarts, re-initializes, hits the same geodiff failure, drops the schemas again, and so on — an infinite, destructive loop.
**Steps to reproduce**
1. Configure a sync connection (GPKG → PostGIS), schema does not exist yet (fresh init).
2. The source GPKG contains at least one geometric defect, e.g.:
a MULTILINESTRING with a degenerate component ("Too few points in geometry component"),
empty geometries (ST_IsEmpty = true) in point/line tables,
(possibly) 3D (Z) geometries.
3. Start the daemon under restart: unless-stopped.
Result: init fails in geodiff, db-sync drops + _base, the container restarts and repeats indefinitely.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the sync initialization failure and the cleanup step that drops the target schemas, then reproduce it with invalid source geometries under the stated restart policy. Done means a deterministic geodiff initialization failure no longer causes an infinite destructive drop/recreate loop.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, python
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100