Skip to content

fix(bottomless): reap finished S3 uploads as they complete - #2299

Draft
pavanmanishd wants to merge 1 commit into
tursodatabase:mainfrom
pavanmanishd:fix/bottomless-reap-uploads
Draft

pavanmanishd wants to merge 1 commit into
tursodatabase:mainfrom
pavanmanishd:fix/bottomless-reap-uploads

Conversation

@pavanmanishd

@pavanmanishd pavanmanishd commented Oct 22, 2026 •

Copy link
Copy Markdown

Fixes #2298.

The bottomless upload loop spawns one task per WAL batch into a JoinSet and drains that set only after the receive loop ends, which happens at shutdown. A JoinSet keeps every finished task until it is joined, so each uploaded batch stayed in memory for the life of the replicator. The issue reports sqld growing by about 10 KB per batch until it is restarted or OOM-killed.

This change reaps the finished uploads as they complete, inside the receive loop. The retained set is then bounded by s3_max_parallelism plus the one task spawned in the current iteration, instead of growing with the WAL.

The shutdown drain is unchanged. It already discarded task results, and the upload task still returns ().

No test is added. S3-backed tests need a live endpoint and are not part of PR CI. The nemesis S3 tests live in the separate tursodatabase/tursotest repository and run only on manual dispatch.

Checked locally with cargo check -p bottomless and cargo fmt -p bottomless -- --check; cargo clippy -p bottomless reports no new findings.

The upload loop spawns one task per WAL batch into a JoinSet and drains
that set only after the receive loop ends, which happens at shutdown. A
JoinSet keeps every finished task until it is joined, so each uploaded
batch stayed in memory for the life of the replicator.

Reap the finished uploads inside the receive loop. The retained set is
then bounded by s3_max_parallelism instead of growing with the WAL.

Fixes tursodatabase#2298.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bottomless: finished S3 upload tasks are never reaped, so sqld memory grows by ~10 KB per WAL batch

1 participant