Repository navigation
fix(apps): a failed restore holds what it broke until it heals or its owner accepts it - #1921
Conversation
Cabecinha84
left a comment
There was a problem hiding this comment.
Request changes (small), at head ed956019e, reviewed against development 9a8b3ab92.
Merges cleanly onto the current development tip (which already has #1884, #1919, #1920). Unit suite on the merged result: 13500 passing, 0 failing. eslint clean on all changed ZelBack files. The design is sound: the record is written before the clear, the holds are consistent across reconciler, election, folder writes and soft install, and the releases are narrow. Released nodes tolerate apprestart?unlessstopped=true (no rejectQueryParameters on that route), and stop precedes die in real docker events, so the 137 handling holds.
Must fix
An unreadable restore record reverts a healthy app's folder.
restoreHolds()(syncthingFolderWrites.js) returnstruewhen the Mongo read rejects.healHeldFolder(syncthingFolderStateMachine.js) does not re-read the record. With a synced peer and receive-only local changes it callsdbRevert.- For a healthy r:/g:/s: folder with no restore: on the first failing pass the monitor forces the folder
receiveonlywhile the container keeps running, so its writes become local changes. From the second pass on, each pass reverts them and discards the running app's data. - Reproduced with a throwaway test (real
syncthingFolderWrites,isRestoreUnfinishedrejecting): pass 1 no revert, pass 2 one, pass 3 two, for r:, g: and s:. - No existing test covers it. The state-machine tests stub
restoreHoldsitself, so the catch never reaches the state machine.
Fix: treat an unreadable record as hold-only (stay receive-only, never revert or heal); revert only when the record was positively read as set. Add a unit test with a rejecting isRestoreUnfinished.
Non-blocking
appStartclearsrestoreUnfinishedand never checksrestoreInProgress. An owner start mid-restore followed by a restore failure leaves an unsynced component with no durable hold. Same gap exists on development, so not a regression.- If clearing the record after a successful unpack fails, the component stays held (safe), but the error line does not say so.
- The new
/apps/componentstatesroute sits under the comment that belongs toappstart. - Eight
fixup!commits: please autosquash. drive()waits up to 15 min per component; backup/restore previously gave up after ~60 s, so a stuck container now holds the app's lease much longer.
Before an ACK
- Re-run the harness gate on the merged result: 329/329 was at
ed956019eon the old base, and #1884/#1919/#1920 have landed since, plus this PR reorders the fixture ring. - I ran the unit tests but only skimmed the new harness suites 4401-4404, so their "red without the fix" claims are not independently verified.
|
Thanks for the review. Each item, at head Must fix: an unreadable record reverts a healthy app's folder. Fixed in Harness suite 4406 covers it with real syncthing. A 1. 2. A failed record clear after a good unpack. That is now a failed restore ( 3. The route under 4. Autosquash. We keep pushed history as it is, so the 5. The 15-minute wait. Gone ( The 4401–4404 "red without the fix" claims. Each suite was run against development before the fix: H7 is red at its own assertion, every other case at "the restore recorded the component held". Each rule was also broken alone in a copy of the branch, and each was red at its own case. Before an ACK. Unit at the head: 13,441 passing, 0 failing. Every suite that backs up or restores (35, 44, 86–93, 2005, 2209, 4401–4404, 4406) is green at the head. The full gate on this branch merged with development |
Cabecinha84
left a comment
There was a problem hiding this comment.
Request changes (small) — 2nd pass at head d80a758e5, against current development (396cc107b).
Verified
- Merges clean into
development; unit suite 13514 passing / 0 failing on the merged tree; eslint clean on the changed files. - My previous must-fix is closed: an unreadable restore record now decides nothing, so it no longer triggers
dbReverton a healthy folder (test assertsdbRevertis not called). - No stale
containerCrashRecoveryreferences, no duplicate harness suite numbers.
Must-fix
-
A pending data clear can wipe appdata while a backup/restore holds the app.
isManagedElsewhereno longer covers backup/restore (they hold throughoperationDesired), and thedataDesired === 'clear'branch (appReconciler.js~l.971) runs beforeeffectiveDesiredRunning, so the hold never guards it. The base deferred the whole pass. If a clear is already pending/retrying when a backup starts,holdStoppedreturnsstopped: trueand the clear still runs: the backup archives an emptyappdata/and reports success; a retried clear can also land mid-unpack of a restore. Reproduced with a throwaway test (one failed clear, thenholdStopped→ 2 clear calls). Fix: skip the clear while the component is held by an operation, with a test that is red without it. -
healHeldFoldercan clear the record on a stale reading. It trustsisSynced+ zero receive-only counts without checking the folder isreceiveonlyor has been scanned since the restore. Syncthing only counts receive-only changes for a receive-only folder, after a scan. If the restore's demote fails (an expected case), ans:folder stayssendreceive/paused over a stale index; the next monitor pass reads zeros, clears the record, and thes:path then makes the folder send — the deletions go to every peer. The same stale read is possible right after a successful demote, before the first scan. Not yet confirmed against a real daemon. Fix: heal only a folder that isreceiveonly, idle, and scanned since the restore.
Non-blocking
syncthingMonitor.jsbarereturnon a second unreadable record read: the state machine may already have setdesignationPending/restarted, and the later loop still setsdesignatedLeader = truefor a folder that was never written.startApplicationre-reads the spec to release the hold and swallows errors; a DB blip leaves the app held stopped until FluxOS restarts. Release with the ids captured at stop time.- Still open from last pass: an owner's
appstartduring a running restore clears the record, so the "is kept stopped" message is untrue if the restore then fails. - PR body does not mention the
/flux/inforequireDatabase503 guard or thelistRunningAppssemantics change; 8fixup!commits still to autosquash.
Conditions for ACK: fixes 1 and 2 with tests, a full harness gate at the new head (the claimed 331/331 is at the previous head), and the polish above.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## development #1921 +/- ##
===============================================
+ Coverage 85.43% 85.77% +0.33%
===============================================
Files 280 287 +7
Lines 42082 42442 +360
===============================================
+ Hits 35953 36404 +451
+ Misses 6128 6037 -91
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The API answers as FluxOS starts and the MongoDB connection follows moments later; a /flux/info landing in between read installed apps through a client that did not exist yet and threw "Cannot read properties of null (reading 'db')". requireDatabase answers 503 with Retry-After through serviceUnavailable, before the route's cache as the other readiness guards are, so the cache never keeps a refusal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the election decides from recorded intent A failed restore set its folder receiveonly and its component's intent to stopped, and the election pass that read the running list while the restore still held the app - a list that reports a backed-up or restored app's stopped containers as running - then made the folder send over the half-replaced data (gate red, suite 2209). - appReconciler: drive(ids, state) and operationDesired. A backup or restore holds its components stopped through the reconciler and lifts the hold on every exit; the reconciler no longer stands aside for the operation's claim. drive waits for each component to settle, outlasting a pass deferred by another operation on the node. - backup and restore stop and start only through drive (stopApplication/startApplication): an operator-stopped component stays down, and an elected one starts as its election decides. - restoreUnfinished: a durable record, written before a restore clears a component that does not sync and removed when its unpack succeeds. The reconciler keeps the component stopped on it, across a FluxOS restart, until a restore succeeds or the owner starts it. It survives a soft removal and the boot twin-merge. - the election reads, per app, the reconciler's recorded intent, and the container only where none is recorded; an app docker cannot answer for is skipped that pass. holdAsPrimary writes nothing while an intent other than running is recorded or a backup or restore holds the app. - listRunningApps adds back only the containers an operation took down (globalState.operationStoppedContainers), not every stopped container of an app under backup or restore. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nt a decision to leave a component stopped The read moves from before the decision checkpoint and the FDM call to after them, so what an app's decisions use is read where they are made. A reconcile pass that finds a stopped component where it belongs counts reconciler:held with the reason, the only record of that decision. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… as syncthing would report it The restore case declared the primary's folder a cold start (data on disk, nothing ever advertised) while its standbys held the synced copy - a state syncthing cannot produce, and the one in which the folder state machine seeds without a sync check. Its clear also failed before removing anything. The restore now fails part-way through the clear, removing one file and not the next, and syncthing reports the primary's folder short of the copy the standbys hold by a local change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he reconciler - 2209: an election pass held at its decision while a restore of its app fails decides from the stop FluxOS recorded, and the half-replaced folder never sends. - 44 (renamed for its claim): a reconnect sweep mid-backup starts nothing the backup holds; an operator-stopped component is not started by a backup, read from the container's start time; FDM is routed to the container the backup took down and not to the operator-stopped one. - 88: a component that does not sync, whose restore did not finish, stays stopped across a FluxOS restart until its owner starts it. - 91: the unsynced component of a failed restore is held by the reconciler, which never starts it. - container.js: containerStartedAt; node-client: reconciler:operationHold on the allow list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…omotion's start has run The case means the volume to go during the scans that cover the promoted folder's restart, after the promotion started the component. It waited only for the scan, so a slow start could still be in flight when the volume went; the start then completed after the node had recorded the stop, and read as a start over the unsafe volume. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ndex order Discovery orders nodes that joined in the same block by txhash, highest first, and every fixture node joins in one block. With random txhashes the ring ran in an order no suite was designed for: suite 1502's stub peer landed just before node 1, which then had no inbound peer, since a stub never dials. Each txhash now leads with a byte that falls with the index, so the ring runs in index order, the order suites place nodes and stubs by. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…to write it Test 2 patches caseSensitiveFS off on both holders and reads the patch back before waiting for FluxOS to correct it. A syncthing pass that reads the folder after the patch queues it and writes caseSensitiveFS on; under load that write landed before the read back, and the fixture check failed. Each holder's write of the folder is now held at syncthing:beforeFolderWrite, the read back waits until a pass is held there, and the holds are released after, in every case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…until it heals or its owner accepts it A restore that stops part way through replacing a component's data leaves a directory that is neither copy. With no peer holding the data, syncthing calls such a folder synced, and the first-start path made a lone g: component primary again on it. The durable restoreUnfinished record now covers every sync mode: - written before any component's data is cleared, removed once it unpacks; - while it stands the reconciler keeps the component stopped, no folder write makes its folder send (syncthingFolderWrites, every writer), the election records no running opinion, a standby is not resumed as primary, the monitor writes its folder receive-only, a soft install does not start it, and a backup of it is refused; - r:, g: and s: folders heal from a peer that holds the data: local changes, deletions included, are reverted to the peers' copy, and the record is cleared once the folder is synced and clean. A held folder claims no holdings; - an operator start clears it (a restart, which a restore sends every other instance, does not), and so does a new volume; - the restore refuses to clear a synced folder no longer paused, and its error line says which component it left held and how it is released; - /apps/componentstates/:appname (owner and Flux team) answers, per component here, whether it runs and the reconciler's reason when not. Unit: each rule red without it (25 mutations, each in a throwaway copy). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A restore record's every write publishes restore:record {identifier,
unfinished}; restore:beforeClear holds a restore after it has recorded the
component held and before it clears anything; dbClient reads the record.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… stopped until released Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… from standbys that hold the data Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ata, its owner or healing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…letions is reverted syncthing reports such a folder idle, with inSyncBytes equal to globalBytes and only receiveOnlyChangedDeletes set, so it read as synced and clean: a standby missing files could be promoted on them. Every receive-only change counts - files, directories, symlinks and deletions - and the kept and reverted logs and events carry the deletions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y new data, its owner or healing
…y new data, its owner or healing
…y new data, its owner or healing
…y new data, its owner or healing
…d stays stopped until released
…ners' stops A restore of an r: or s: component asks every other instance to restart, so its containers read the restored data. That request arrived as an owner's restart, which lifts the stop lock: an instance its owner had stopped was started again. The restore now sends /apps/apprestart/<app>?unlessstopped=true, which restarts each component its owner has not stopped and changes no stop lock and no restore record; a component whose lock cannot be read is not restarted. An instance on an earlier release ignores the query and restarts as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y new data, its owner or healing
…y new data, its owner or healing
…nce, by a framework helper dropConnections (syncthing-real.js) pauses and resumes each peer device on the node's own syncthing, which closes the link, and returns once none is connected; a traffic block set first keeps it closed. 4402 uses it, and 4404's held instance no longer waits out syncthing's five-minute receive timeout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The case holds both standbys at masterSlave:beforeDecision past their start slots; released together after FDM's master is cleared, each found no primary and both started (tester, 2026-11-18: nodes 1 and 3 at 09:10:46.5). One standby is released first and the other once a single holder runs, as the product's spacing between standbys orders them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and no unpause makes a held folder send A read of the restore record that failed answered held everywhere. The folder writes refuse on it, which is right; but the state machine and the monitor acted on it, making a healthy running app's folder receive-only and, from the next pass, reverting the app's own writes as an unfinished restore's leftovers. restoreRecord answers held, not held, or unknown. The state machine and the monitor leave a folder whose record is unknown as it is for the pass (skipProcessing; the monitor keeps an unprocessed folder), so nothing is turned, reverted or healed on a record nobody read. restoreHolds, for the refusals, still holds on an unknown record. The folder writes also refuse an unpause that would make a held folder send - one set to send, or one whose config cannot be read - so no write path sends a held copy whatever the deciders do. Tests: six new tests, each red against the previous code and green with this (the unpause refused, the unknown record, r: and g: passes reverting nothing, the monitor leaving the folder and healing nothing); a mutation of each rule turns only its own tests red. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The monitor publishes syncthing:folderNotReady on the pass that takes a ready holder out of ready, the counterpart of syncthing:folderReady: from then the election no longer reads it as eligible and its folder's health is not watched. Tests: a ready holder taken out of ready publishes it (red without the publish); one that stays ready, or was not ready, does not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…running copy A g:, an r: and an s: app on three holders with real syncthing. The running copy's node is cut from the other holders' syncthing and its app writes appdata/written-<mode>.txt, which only that copy then holds. That node's reads of its runtime-state collection fail (failCommands, finds on zelappsruntimestate only) for three folder passes; through every poll its folder sends, its container runs and it publishes no syncthing:folderNotReady. Once the cut is undone the file reaches every other holder. The state machine and the monitor count each pass that meets an unreadable record (syncthing:restoreUnfinished, unknown); the window ends at three. Proved on chud: green 3/3 with the fix, three runs; red 3/3 at "folder stopped sending" on e8dd3dc; the record read as held in the state machine alone is red for g: and r: at "copy stopped being ready"; in the monitor alone, red for s: at "folder stopped sending". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…restore A component is restored once its restore record is cleared. A clear that fails leaves it failed as any component left mid-replacement is: kept stopped, its folder demoted, and the error line saying so and how it is released. Tests: a clear that rejects fails the restore with the component kept stopped and the held error line (red without the change). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…utes' comment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… hold causes holdStopped writes the operation's hold and answers from the pass it enqueues: every component down, or the operation is refused, naming each component and why - the node is starting, docker cannot answer, another operation on the node held the pass aside, or the container is still up. Nothing waits past that pass, so a stuck container frees its app as soon as its stop fails. releaseHold lifts the hold and returns; starting the component is the reconciler's, retried as any start is. driveSettleMs is gone. Tests: each refusal reason, and the busy one without a wait; a mutation of each (busy read as running, no boot refusal, a wait for the container, the busy wording) is red alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the app The backup goes on only once the pass its hold causes has stopped the app, so the reconnect sweep comes after that stop, inside the backup's window, and the backup is not refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A fresh install's volume is newly formatted and its container is not started, so there is nothing on it to clear. The folder is created receive-only and syncs from the peers; files the peers do not have are reverted or kept by the existing check before the folder sends. A first run with no syncthing folder decides from the container, as it does with one: a running app keeps running, a stopped one receives first. Removed: requestStopAndClearData, dataClearPending, the reconciler's data clear, volumeService.clearAppVolumeData, the cleared event and the reconciler:beforeDataClear checkpoint. A backup or restore can no longer meet a pending clear. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
waitForFolderTakenOn waits for the first pass that writes a newly installed component's folder. 2260 proves a fresh install receives the primary's data unpaused and keeps it, with the app stopped on the new holder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Syncthing counts local changes only in a receiving folder it has scanned, and scans no paused folder. A folder an unfinished restore holds is reverted or released only while it is receiving, unpaused and idle, and its last scan finished after the restore record was set. Until then the record stands and the folder receives. The record carries the time it was set (restoreUnfinishedSince); syncthingService.folderLastScan reads syncthing's last scan of a folder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… scanned On real syncthing: the restore's demotion is refused (the daemon is down between the restore's pause and its demotion), so the folder is left paused and sending. Syncthing counts none of the restore's deletions in it; the copy heals from its peers only once it receives and syncthing has scanned it since. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The monitor reads a folder's restore record once per pass, before the state machine, and every decision of the pass is made on that answer. A record that cannot be read leaves the folder out of the pass before anything is decided for it, so no designation is made for a folder the pass does not write. The state machine takes the record as read and reports whether it still holds the folder once the pass is done. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
stopApplication hands the component identifiers to its caller before it holds them, and a backup or restore releases exactly those on every exit. The release reads nothing, so a database that cannot answer at the end of an operation no longer leaves its app held stopped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Syncthing records a folder's last scan to the whole second, so a scan that finished in the second the restore record was set read as older than the record, and the held folder waited for the next periodic scan. The first pass that finds a held folder receiving, unpaused and idle asks syncthing to scan it and moves on; syncthing answers once the scan is done, and the answer marks that record scanned (setRestoreScanned, matched on the record's time, so a record set again since stays unscanned) and publishes restore:scanned. The heal reads the folder's status after the record says scanned. Harness 4402: a restore that deleted nothing is cleared by the pass under way when its scan is recorded or the next one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0b71f21 to
09742c1
Compare
|
Thanks for the second pass. Each item, at head Must fix 1: a pending data clear can wipe appdata under a backup/restore hold. The clear is gone rather than guarded ( Must fix 2: Non-blocking: the monitor's bare Non-blocking: Still open: PR body. It now covers the The Conditions for ACK.
|
|
The full integration gate at the head of the stack is green: 334/334 suites passed (MAXN=6, about 3 h 20 min), at #1922's head CI is green on both PRs at those heads. |
… it asked for Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cabecinha84
left a comment
There was a problem hiding this comment.
Third pass at head 577ab690e: ACK on the code, with conditions below.
The PR sits directly on the current development tip (396cc107b), so there is nothing to merge or rebase. CI is green. I ran it in a clean worktree: unit suite 13,506 passing, 0 failing, 2 pending, and eslint is clean on ZelBack/src. (The PR body still says 13,433.)
Earlier must-fixes: both closed
- A pending data clear wiping appdata under a backup/restore hold. The clear is removed outright (
requestStopAndClearData,dataDesired,clearAppVolumeDataand the checkpoint have no leftover references), and backup/restore now hold the app through the reconciler (holdStopped/releaseHold). - The heal clearing the record on a stale reading. The heal now acts only on counts read after syncthing finished a scan it was asked for, matched to the record by its time. An unreadable record decides nothing.
I also checked that no other path clears an owner stop through setAppOperatorStopped(…, false), that a backup of a held component is refused before anything stops, and that "a requested stop is not a death" does not hide a crash after a restart.
Findings
1. Narrow race in the heal (should-fix, not blocking). healHeldFolder clears the record with an unconditional setRestoreUnfinished(appId, false) (appsRuntimeState.js:358), after awaiting the status read and findSyncedPeer. Nothing serialises that against a new restore setting its own record. The window is milliseconds against more than 5 s of restore prelude, and it only hurts if the owner retries the restore, the heal is stalled at that moment, and the retried restore then fails. The catch block does not re-assert the record, and its in-memory stop is lost on a FluxOS restart. The fix is one line: clear only when the record's at still matches. I would take it in the same push.
2. Policy change that needs maintainer sign-off. Development wiped and stopped an r:/g: component on a first run with no syncthing folder. Now an r: component whose container is running, with no folder, goes sendreceive, so its local-only files are offered to peers (no deletions are sent). This only happens when FluxOS starts with the container up and syncthing has lost its config, and the data is live, so I think it is acceptable. g: is not affected. No harness suite covers this case (2260 covers a fresh install with the app stopped).
3. Owner appstart during a running restore still clears the record. Deferred to #1922. #1922 should land in the same release.
4. Minor. unlessstopped=true on apprestart returns before the global branch, so a global call with that flag restarts locally only. Peers on older versions ignore the flag and do a plain restart, as before.
Conditions
- Harness gate on the affected suites (4404 at minimum) at this head, or #1921 and #1922 merged together and gated at the tip. The 334/334 run was at #1922's head over
09742c1b3; the only commit since is a +7-line change to suite 4404. - #1922 lands in the same release.
- Sign-off on finding 2.
- Finding 1, which I would not block on.
This supersedes my earlier CHANGES_REQUESTED reviews.
|
Thanks for the third pass. Each item, at this head 1. The heal-clear race. Fixed in 2. An 3. Owner 4. Conditions. Unit suite at this head: 13,506 passing, 0 failing, 2 pending (the body is updated). #1922 lands in the same release. Gate. The full integration gate is running on tester at the head of the stack, #1922 |
Review, 4th pass at head
|
|
Thanks for the fourth pass. The four notes, in order: Backup and restore of one app. Closed by #1922: a backup and a restore each take the app through its per-app lease ( A soft redeploy dropping the restore record's time. On #1922 a soft redeploy replaces the app in place and nothing calls The restore's error line. It reads "The restore of did not finish, so it is stopped to protect your data. Run the restore again." for every kind of component (
Conditions. #1921 and #1922 merge together, #1921 first. The full gate at #1922 |
Review, 5th pass at head
|
Why
A restore that fails part way through its clear leaves a component's data neither the old copy nor the restored one. FluxOS then started that component on what was left, and for a synced component its folder sent the damage — the deletions included — to every other instance. On a lab node a lone
g:app restarted on its leftovers after a failed restore.A failed restore now holds what it broke, in every sync mode, until a restore finishes, the owner starts the component (accepting its data as it is), or the copy heals from a connected peer that holds the data.
What changes
g:,r:,s:or unsynced, and removed once the unpack succeeds. It carries the time it was set, which identifies it. While it stands nothing runs the component and nothing makes its folder send: the reconciler keeps it stopped,changeSyncthingFolderTyperefusessendreceive, the election records no running opinion and does not resume it as primary, a soft install does not start it, and the syncthing monitor writes its folder receive-only. A record that cannot be read holds every refusal, and the folder deciders act on none: the folder is left as it is for the pass, so a running copy keeps sending and nothing is reverted or healed. No unpause makes a held folder send.r:/g:/s:folder, healing from its peers. A held folder is reverted or released only on counts syncthing has scanned since the restore: syncthing counts local changes only in a receiving folder it has scanned, and scans no paused folder. So the first pass that finds the folder receiving, unpaused and idle asks syncthing to scan it and goes on; syncthing answers once the scan is done, and the answer marks that record scanned (restore:scanned; a record set again since stays unscanned). The status the heal decides on is read after the record says scanned. Then, synced with no receive-only local changes left while a connected peer other than this node holds the data (findSyncedPeer), the record is cleared. A lone copy is never healed that way, and a record that carries no time is released only by a restore or the owner./apps/apprestart/<app>?unlessstopped=truerestarts only what their owners have not stopped and changes no record or lock).requestStopAndClearData,volumeService.clearAppVolumeData, thereconciler:beforeDataClearcheckpoint), so nothing deletes a component's data while a backup or restore holds it./apps/componentstates/:appname(owner and Flux team) gives each component's run state and the reason it is stopped.listRunningAppslists everything running plus each container a backup or restore took down (globalState.operationStoppedContainers), which was running when the operation began. A container that was already stopped — a standby'sg:component, one its owner stopped, one that crashed — is not listed, whatever operation its app is under./flux/infoneeds the database. It answers 503 while the database is not available (requireDatabase).syncthing:folderNotReady, the counterpart ofsyncthing:folderReady, when a ready holder stops being ready.containerEventsConsumer(renamed fromcontainerCrashRecovery) records Docker's stop events, and the start after a run something asked Docker to stop begins with a clear ladder, as an owner's start does. An OOM kill, and a stop the event stream missed, are judged as deaths.The PR stacked on this one (#1922), which lands in the same release, sends every operation on an app through that app's manager: an owner's start while a restore is running is refused, and the heal of a held folder is an operation on its app. It also decides an
r:copy by its folder alone, every pass, and refuses aglobalrestart withunlessstopped, which would restart one node.Follows v9
operationDesired, which the reconciler reads asoperationHoldand a restart drops. The entry points differ:holdStopped/releaseHoldanswer from the pass the hold causes, where v9'sdrivewaits for the containers to settle.hasBlockingLeaseleaves both out.Testing
577ab690ec, 13,506 passing, 0 failing, 2 pending; eslint clean. Each guard and release above has tests that are red without it and green with it:g:folder whose record cannot be read is not passed to the state machine and gets no designation; red with the second read;g:app and a mixed one;g:with standbys; a restore that deleted nothing is cleared by the pass under way when its scan is recorded, or the next;r:ands:, and ans:copy whose demotion syncthing refused (the daemon down between the restore's pause and its demotion): it reports none of the restore's deletions while paused and sending, and heals from its peers only once it receives and has been scanned;g:,r:ands:each with a running copy holding writes its peers lack;waitForFolderTakenOn).aa6bd4cb42, which carries this PR's577ab690ec), ondevelopment396cc107bd: 341 of 341 suites passed (MAXN 6, about 4 h).g:component stopped and its folder receive-only through election passes and a FluxOS restart;🤖 Generated with Claude Code