← Back to list
01Issue
BugOpenSwamp CLIPublicTeam
AssigneesNone
Relationships
#4287 serve: step leases seem never to be reaped when serve restarts more often than once an hour
Opened by nckrtl · 11/2/2026
Setup
- swamp
20261031.063736.0-sha.e459d219, running asswamp servewith--hot-reloadand the built-in filesystem datastore. .swamp.yamlhasgarbageCollection.automatic: trueandbookkeeping: 2h.- About 2,100 worker dispatches an hour.
- Serve often restarts. Our release process restarts it when a commit changes a manifest's
additionalFiles, which is our workaround for #4282. On 2026-11-02 this happened every 15 to 30 minutes for a few hours.
What we observed
- Between 09:30Z and 11:45Z, our 15-minute datastore watch ran on 9 different serve instances (
instanceIdfrom/ready). - Over the same window, the file count under
.swamp/datarose at every sample and never dropped: 26,326, 30,303, 33,939, 38,590, 41,926, 47,765, 51,051, 56,449, 65,777, 72,141. - Most of that is
data/swamp/step-lease. It held 6,886 files at 09:00Z, 37,115 at 11:00Z and 70,676 at 12:15Z. swamp run gcandswamp data gc, run through serve at 12:15Z, removed nothing.
What we concluded (we may be wrong)
From reading the source, we think the step leases are only reaped by serve's worker GC:
WorkerGcService.start()schedules its first sweepintervalMsafter start.serve.tspassesDEFAULT_WORKER_GC_INTERVAL_MS(1 hour), and we found no flag or environment variable for it.reapBookkeepingruns inside that sweep.libswamp/retention/collectors.tsnotes that serve bookkeeping is reaped by the worker GC, not by retention.
If that is right, a serve that lives less than an hour never sweeps, and each restart starts the hour again. RetentionGcService uses a 5-minute initialDelayMs, so outputs and runs still get reaped across restarts. That would explain why only the bookkeeping grew.
We may have missed another path that reaps these records, or misread how often the sweep runs. We would be glad to be corrected.
What might help
Any of these would keep bookkeeping bounded when serve restarts often:
- the worker GC uses a short initial delay, like retention GC does;
- it remembers when it last swept;
- it gets an interval flag.
Related
- #4282: why our serve restarts.
- #4285: output growth from
set_status.
02Bog Flow
Open
No activity in this phase yet.
03Sludge Pulse
Sign in to post a ripple.