Repository navigation
FP-6: bounded S3 queue, disk spill, string policy - #308
Merged
Merged
Conversation
pkg/strpolicy.Clean cuts a string at a UTF-8 boundary (256 bytes, 16 for interface and congestion names) and replaces invalid UTF-8, C0, DEL and C1 with U+FFFD; printable ASCII that fits returns without allocating. Applied once per entity: dockermeta inspect (name, image), the uplink stamp (NIC strings, LLDP fields), localnet ifnames, the ipasn owner, netns names, and the congestion decode, which folds the check into its NUL scan (+3 ns per socket, allocs unchanged). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Send used to block the poller once 16 envelopes waited on a slow or
unreachable S3. envelopeQueue drops the oldest past -s3QueueDepth
(default 16, max 4096) or -s3MaxBufferedBytes (default 64 MiB, 0 = no
byte bound), always keeping the newest. New xtcp_s3_dropped_total,
xtcp_s3_dropped_bytes_total and xtcp_s3_buffered_bytes{stage};
queueFull now counts drops. XtcpConfig fields 116/117, env
S3_QUEUE_DEPTH / S3_MAX_BUFFERED_BYTES, kept across Set by preserveCaps.
Docs: metrics, memory budget, plan FP-6 done-as, CHANGELOG. Also polls
in TestS3ParquetDest_timeFlush, which failed under -race on a fixed
30 ms sleep.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Check 14c: with -s3QueueDepth 2, a Garage outage must keep polls at cadence, raise xtcp_s3_dropped_total, keep RSS growth under 128 MiB, and land a new object after Garage restarts (S3PARQUET_OUTAGE). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…3 queue env/print in helpers (funlen) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
xtcpnl's congestion-name decoder imports it since FP-6; stdlib only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t control characters
- -s3SpillDir / S3_SPILL_DIR (field 118) and -s3SpillMaxBytes /
S3_SPILL_MAX_BYTES (field 119, default 1 GiB): Parquet objects that
fail to upload are kept on disk and re-uploaded oldest first under
their original keys, including after a restart. With a spill dir the
worker tries each upload once, so it keeps draining the queue during
an outage. Oldest deleted past the bound; 0600 files in a 0700 dir via
os.Root, .tmp -> sync -> rename. Kept across ConfigService.Set.
- Metrics xtcp_s3_spill_total{result}, xtcp_s3_spill_objects,
xtcp_s3_spill_bytes.
- hostname, location, label, tag: their max_len was already set; add a
pattern rejecting C0, DEL and C1 controls.
- VM: the s3parquet flavor spills (-s3FlushInterval 10s); Check 14d
S3PARQUET_SPILL. Docs, CHANGELOG, plan follow-ups.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FP-6 of the security-hardening plan (C3, C4): a tenant or an S3 outage can cost data, not the collector.
S3 queue
Sendnever blocks: it used to stall the poller mid-poll once 16 envelopes waited on S3.envelopeQueue(pkg/xtcp/s3queue.go) drops the oldest past-s3QueueDepth(default 16, max 4096) or-s3MaxBufferedBytes(default 64 MiB,0= no byte bound), always keeping the newest.xtcp_s3_dropped_total{reason},xtcp_s3_dropped_bytes_total{reason},xtcp_s3_buffered_bytes{stage};queueFullnow counts drops.XtcpConfigfields 116/117, envS3_QUEUE_DEPTH/S3_MAX_BUFFERED_BYTES; startup-only (preserveCapskeeps them acrossSet).GOMEMLIMITguidance (≈ 190 MiB with defaults).String policy
pkg/strpolicy.Clean: cut at a UTF-8 boundary (256 bytes, 16 for ifnames and congestion names), invalid UTF-8 and C0/DEL/C1 become U+FFFD; printable ASCII returns without allocating.Tests / evidence
TestClean,FuzzClean,TestEnvelopeQueue(+ concurrent,-race),TestS3ParquetDest_queueBounds, reworkedcorner_queueFull, one test per call site, flag/env/validation/preserveCapsrows.BenchmarkDeserializeCongInfoXTCPvs main (10 interleaved): 21.0 → 23.3 ns, allocs unchanged;BenchmarkS3Send52 ns vs 118 ns for the old channel send.S3PARQUET_OUTAGE): Garage stopped mid-run → polls continue, 22 drops, RSS +5 MB, upload resumes after restart.microvm-x86_64-lifecycle-s3parquet: all checks pass.TestS3ParquetDest_timeFlush, which failed under-raceon main (fixed 30 ms sleep).Spill directory (follow-up)
-s3SpillDir/S3_SPILL_DIR(field 118, off by default): objects that fail to upload go to disk and are re-uploaded oldest first under their original keys, including after a restart.-s3SpillMaxBytes/S3_SPILL_MAX_BYTES(field 119, default 1 GiB) bounds it; oldest deleted past it.0600in a0700dir viaos.Root,.tmp→ sync → rename; bad headers deleted; dir and bound kept acrossSet.xtcp_s3_spill_total{result},xtcp_s3_spill_objects,xtcp_s3_spill_bytes.TestS3Spill(12 rows),TestS3Spill_contentAndModes,TestS3ParquetDest_spill,TestS3ParquetDest_spillKeptOnClose, flag/env/validation/preserveCapsrows.S3PARQUET_SPILL): Garage stopped 160 s → 12 objects spilled, all 12 uploaded after restart, 0 left; Check 14c still passes (336 polls, 4 drops).Operator strings (follow-up)
hostname,location,label,tagalready hadmax_len(253/253/40/40); now apatternalso rejects C0/DEL/C1 controls (exit 64 /Setrefused).Also
xtcpnl→strpolicyimport.🤖 Generated with Claude Code