oot asset sweep exhausts a 256 MB VM when the bucket is empty
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 22/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- node.js, sqlite, typescript
- Domain
- backend, infrastructure
Research direction
Start with run-cloud-boot.js, which spawns the sweep as a second Node process, and with put_file, where the upload body comes from openAsBlob. Reproduce on a 256 MB setup with an empty bucket and a few hundred MB of assets, then record per-process memory with ps -o pid,rss,args during the sweep. Done means the process that grows is identified, with a fix or a documented minimum VM size backed by those measurements.
Written by the indexing model from the issue text.
Description
What happens
When the backup bucket is missing many assets, the boot-time sweep can exhaust a 256 MB Fly VM. The machine keeps running but stops answering: every request times out until the sweep finishes or the VM gets more memory.
Seen on sonjastojanovic after moving the app to another Fly org and switching to a new, empty Tigris bucket (see #233). The sweep had to upload 657 asset files, 314 MB in total, including videos up to 73 MB.
- Machine: shared-cpu-1x, 256 MB (209 MB visible to the VM), no swap.
- About 3 minutes after boot: 9 MB available, load average 3.8, no HTTP response within 30 seconds, and
fly sshsessions hanging. - Several uploads failed with
fetch failed. - The site was unreachable for about 11 minutes, until the VM was scaled to 512 MB. There, the remaining 284 files uploaded in 19 seconds while the site stayed responsive. Back on 256 MB with the bucket in sync, the site is fine.
What we know
#209 had a similar out-of-memory kill, and 8069ade fixed the cause found then: put_file read each file fully into memory. That fix is deployed here, and the upload path now looks streamed. put_file passes an openAsBlob body, and aws4fetch with service: 's3' sets X-Amz-Content-Sha256: UNSIGNED-PAYLOAD, so it never hashes or buffers the body itself. Buffering whole files in our own code doesn't explain this one.
During the sweep the VM runs three processes at once:
- the server
- the sweep, a second Node process that
run-cloud-boot.jsspawns - the Litestream sidecar, which in this case was also failing on every sync because of #233
Nobody measured memory per process before scaling up, so we don't know which one grew.
Next steps
- Reproduce with an empty bucket (or a new
BUCKET_NAME), a few hundred MB of assets including large videos, and a 256 MB VM. Watch memory per process during the sweep withps -o pid,rss,args. - Check whether Node's
fetchreally streams a file-backed Blob fromopenAsBlob, or holds large parts of it during the upload. - Check whether Litestream's memory grows while it retries the missing-LTX error from #233.
- Depending on what that shows: run the sweep inside the server process instead of a second Node process, cap the sweep's heap, defer large files, or document 512 MB as the minimum for sites with large videos and automated backups.
- Dominant language
- TypeScript
- Stars
- 1.8k
- Forks
- 148
- Avg merge
- 2h 47m
- Merged PRs (30d)
- 13
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing 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.
More from michael/editable
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
michael/editable#181 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 38/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
Maintainers usually reply within 1 day
All issues in michael/editable
Similar issues
-
bug data-types
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/clickhouse-js#1293 ·
Maintainers usually reply within 1 day
-
area: middleware enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
agent/quality testing
Difficulty 1/5 Under an hour Newbie friendliness 95/100
Maintainers usually reply within 1 day
-
GitHub registry install via `gh` credentials rewrites `\u0000`–`\u001f` escapes in source files to `^@`–`^_`Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
juspay/agent-distro#203 ·
Maintainers usually reply within 1 day