* filer: keep a PUT under /etc inline like a POST
The write handler marks /etc paths (and saveInside=true) to be stored as
inline content, but only the multipart POST path honoured it. A plain PUT
went through the chunk uploader, which keeps content inline only below
saveToFilerLimit, 0 by default, so `curl -T x.json http://filer/etc/...`
stored chunks and the loaders that read /etc files from inline content saw
nothing.
Both paths now share one saveInside write: read the body, check
Content-Md5, store it as the entry's content. An append to a chunked file
is refused for PUT as it already was for POST, and an offset write is
refused for both instead of being treated as a whole-file write.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: skip the saveInside PUT digest checks under fips140=only
GODEBUG=fips140=only refuses MD5: the filer neither checks Content-Md5
nor reports Content-MD5, and crypto/md5 panics. The bad-digest test is
skipped there, and the inline-store test checks the digest only when MD5
is available while always checking the content is inline with no chunks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: answer a malformed write offset with 400
A negative, non-numeric or overflowing ?offset, and an offset with
op=append, were plain errors that the write handler answered with 500,
while a positive offset to inline content got 400. Both the inline and the
chunk path now parse it through one helper whose error carries the
ErrMsgInvalidOffset prefix, mapped to 400. offset=0 stays a whole write.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: charge a saveInside PUT its whole body like a POST
A PUT stored inside the entry is now buffered whole by saveInsideEntry,
but uploadCharge still charged it by chunks, so -concurrentUploadLimitMB
no longer bounded the memory it holds. It is charged as the POST is: its
declared length, at most the whole budget, or the whole budget when the
length is unknown.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: bound a body stored inside the entry at 16 MiB
A saveInside or /etc upload is read into memory whole, and nothing capped
it: one PUT or POST could grow the filer's memory without bound, as the
upload charge limits concurrency rather than bytes. The read now stops at
16 MiB, far above any config file, and a larger body is answered 413 with
nothing stored, whether or not its length was declared.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: keep inline storage to entries inside /etc/
The /etc check was a bare string prefix, so a PUT to /etcd-backup/snap.db
or /etcetera took the saveInside path and a large body was refused with
413 instead of chunked. Match /etc/ as a directory for the write, upload
charge and zip extract paths.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: bound a zip member kept inline like a saveInside upload
A zip member extracted under /etc/ (or with saveInside=true) is read into
memory whole, but was bounded only by the 1 TiB archive limit. Refuse a
member over saveInsideMaxBytes, as a PUT or POST body is.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: keep a multipart POST to the bare /etc directory inline
A POST to /etc with a file name lands the file inside the /etc directory,
but the /etc/ prefix check missed the bare path and stored it as chunks.
Match /etc itself as well as entries under it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The passive check after the first busy write gave the checkpoint a fixed
10 s. A flusher cycle on a slow or loaded disk can take longer: with a
cycle slowed to 14 s the test fails exactly as on CI (bytes=60424192,
cp=0, busy=1), and at 5 s the checkpoint advances 1.8 s into the wait with
no further write. The 10 s window now counts from the last moment a
flusher cycle was in progress (FlusherInstrumentation), up to the write's
retry deadline; a completed cycle that did not advance the checkpoint
does not extend it. The log and the failure print the flusher's cycle
counts, so a next failure tells a slow cycle from none.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
samplePrecopy recorded a rate only when the round's payload time was
nonzero, so a round whose upload ended below the clock's resolution gave
no rate, and three such rounds left the estimate "samples_unknown". The
payload time is now floored at the coarsest clock resolution (1 ms): the
rate of a fast round is a lower bound, never missing or infinite.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main's HEAD-generation source guard allows a generation comparison only in
conditional updates and noteSettled's deduplication. The two report paths
added here compared generations before calling noteSettled; they now call
it and let it drop a report of an unchanged generation.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: buffer a write in memory when the swap file cannot take it
The dirty pages of a random write, or of more files than the memory budget
holds, go to a swap file under -cacheDirWrite (by default -cacheDir). On a
full cache disk the swap file cannot be created, or a write into it fails,
and the FUSE write failed with EIO (#12655; before it the mount panicked or
acknowledged a write it had not kept). The data was still in hand.
Such a chunk now stays in memory. A chunk whose swap write fails is sealed
with what it holds, so its upload keeps that, and the data goes into a
chunk in memory. The file then keeps chunks in memory for a 10s backoff
before it tries its swap file again. The sealed chunk uploads through the
swap read-back of #13198: if its earlier bytes cannot be read back either,
the flush fails, while the data written again into memory still uploads.
Memory stays bounded, as the sequential path bounds it: past 8 writable
chunks in the file, or past the shared memory-chunk ceiling, the file seals
a chunk before it creates another. Sealing waits for an upload slot, so a
writer that outpaces its uploads slows down instead of filling memory.
The #12655 tests made a write fail through an unusable swap directory. They
now make the dirty pages refuse the write directly, and a new test checks
that an unusable swap directory no longer fails it. A pipeline test covers
a sealed chunk whose swap file can no longer be read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: move a refused swap chunk into memory instead of sealing it
When the swap file refused a write, the first commit sealed the swap chunk
with what it held and wrote the data again into a new chunk in memory at
the same index. Two chunks at one index fail in two ways:
- A disk that takes part of an overwrite, as a full copy-on-write disk can,
leaves the swap chunk with the new first half and the old second half.
Its upload joins the two under the overwrite's timestamp, and the memory
chunk uploads the new bytes under the same timestamp. Equal timestamps
resolve to the chunk the entry lists last, so when the swap upload
finished last the old bytes came back.
- Sealing the memory chunk while the swap chunk was still uploading
replaced the swap chunk in the sealed slot. Until its upload finished,
reads of the bytes only it held found nothing.
Now the swap chunk's ranges are read back into the new memory chunk, each
under its own timestamp, before the write goes in. The swap chunk then gives
back its slot without an upload, so the index keeps one chunk. When the swap
file cannot be read back either, or memory holds the shared ceiling of
chunks, the write stores only what the swap file took and reports a short
write, as master does.
Memory now stays under the shared ceiling of memory chunks. Before, a file
with no chunk of its own to seal allocated a new chunk past the ceiling
anyway, so memory grew with the number of open files writing sparse
chunks. Now that write fails. A file that has a chunk seals it to make room
for the new one, as before. The per-file bound is also checked again after
each seal, since a seal releases the lock.
refusingDirtyPages moves to a test file built on every platform, because
the copy range test also uses it on FreeBSD.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: seal a memory chunk at the shared ceiling and recheck both bounds
At the shared ceiling, a file made room for a new chunk in memory by
sealing any one of its writable chunks. A swap chunk left by a refused
write frees no memory when it uploads, so memory went past the ceiling by
one chunk for each file in that state. At the ceiling a file now seals
one of its memory chunks, and if it has none the write fails.
Sealing releases the lock, and other writers may create chunks meanwhile.
The per-file bound was checked again after a seal made for it, but not
after a seal made for the shared ceiling. One loop now checks both bounds
again after every seal.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: drop an empty swap chunk the swap file refused at the shared ceiling
At the shared ceiling, a swap chunk created for a write that the swap file
then refuses cannot move into memory. It was left in place, holding
nothing. Such chunks count against the file's bound, but nothing can seal
an empty chunk, so after enough refused writes a later write found nothing
to seal and created a chunk past the bound anyway. The empty chunk is now
dropped, giving back its slot and its write budget. A write that still
finds nothing to seal at the bound fails instead of going past it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: seal a memory chunk of the file before moving a refused swap chunk at the ceiling
At the shared memory ceiling a new chunk seals one of the file's memory
chunks and carries on, but a swap chunk whose write the swap file refused
failed the write instead. That is the first write after every backoff on
a full cache disk, and every write into an existing swap chunk.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: keep the per-file bound when a refused swap chunk moves into memory
A file may hold more swap chunks than swapRefusedWritableChunks. When the
swap file refuses a write into a chunk created past that count, moving it
into memory left the file over the bound with every chunk in memory.
Seal another chunk of the file first, as a new chunk does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: write again when a refused swap chunk is sealed during a seal
Moving a refused swap chunk into memory may first seal another chunk,
which releases the lock. If another writer or the flusher sealed the
swap chunk meanwhile, the write failed although a new chunk could take
it. Write into the chunk now at the index instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
* helm: pass the S3 gateway's message queue broker port
Every S3 gateway now runs a message queue broker on 17777. s3.mqBrokerPort and filer.s3.mqBrokerPort set the port for the standalone gateway and the filer's, and allInOne.s3.mqBrokerPort falls back to s3.mqBrokerPort when null. A port of 0 renders the off flag, since leaving the flag out would let weed start the broker on its default. The all-in-one inherits through a helper that tells null from 0, which default cannot.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* helm: admit the message queue broker port in the NetworkPolicy
Clients and other brokers learn a broker's address from the master and dial the pod directly, so a Service does not help them. Under a default-deny namespace the policy has to admit the port on the s3, filer and all-in-one pods that run a broker, or publishing and inter-broker replication stall.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* helm: list the message queue broker port on the S3 pods and Services
The s3, filer and all-in-one pods declare a swfs-mq-broker containerPort when they run a broker, and their Services carry it the way they carry the Iceberg and Lance ports. Brokers are reached by pod IP, so this is for visibility and for anything that addresses the port by name.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* helm: document the S3 gateway's message queue broker port
Describe the three port values, that 0 turns the broker off, and that clients reach brokers by pod IP, so under the NetworkPolicy anything outside the release needs its own ingress rule. The chart version is left alone; it moves with the release commits.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* helm: leave the broker port flag out when it is weed's default
17777 is already the binary's default and the broker is on by default, so rendering -mq.broker.port=17777 only breaks a release pinned to an image that predates the broker flags. The port flag now appears only for a non-default port and the off flag only for 0; the containerPort, Service port and NetworkPolicy entry still follow the configured port.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* helm: give the gateway brokers mTLS through grpc.msg_broker
weed starts the broker beside an S3 gateway on its own only when grpc.msg_broker has a cert and key. With enableSecurity the chart now writes that section with the internal client certificate grpc.s3 already uses, so the brokers serve and dial each other with mutual TLS against the grpc.ca the chart sets, and every pod running a gateway already mounts both.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* helm: choose the gateway broker with mqBroker auto, true or false
weed now starts the broker beside an S3 gateway unflagged only when grpc.msg_broker TLS is configured. s3.mqBroker, filer.s3.mqBroker and allInOne.s3.mqBroker (null inherits s3's) pick it: auto passes no flag and so runs it under enableSecurity, true passes -mq.broker=true (-s3.mq.broker=true on the filer) and runs it without TLS when security is off, false passes the off flag. One helper decides the flags and whether the broker runs for all three, and the containerPort, Service ports and NetworkPolicy entry now appear only when it does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* helm: document mqBroker and the broker's TLS default
The gateway broker no longer runs everywhere: describe auto, true and false, that auto means enableSecurity and its mTLS, that true without security serves any client that reaches the port, and that the ports only appear when the broker runs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* helm: test the gateway broker's flags, ports and TLS section
Render s3, filer.s3 and allInOne across auto with and without security, true, false, port 0 and a custom port, plus allInOne.s3 inheriting and overriding the s3 values. Each case checks the broker and port flags together with the containerPort, Service port and NetworkPolicy entry, so a broker that runs with its port blocked fails. Also check that [grpc.msg_broker] is written only with enableSecurity, and that an unknown mqBroker value fails the render.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* helm: keep the broker port off the Services
Brokers register with the master under the pod address, and other brokers and publishers find them there and dial the pod, never a Service. The swfs-mq-broker Service port only made a LoadBalancer or NodePort s3, filer or all-in-one Service publish the broker outside the cluster, in plaintext with mqBroker true and no security. Drop it; the containerPort and NetworkPolicy entry stay, and the test now fails if any Service carries the broker port.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
With neither --memory-limit-mib nor GOMEMLIMIT, a cgroup v2 limit that
cannot be derived (a membership outside the cgroup2 mount of the holder's
mount namespace, an unreadable or malformed memory.max) is the no-limit
case: the holder keeps the 256 MiB default and starts, instead of exiting
2. applyMemoryLimit, run once logging is configured, logs one level=WARN
line naming the derivation's error and the two ways to choose a limit, and
status reports the reason in Memory.SoftLimitFallback (empty otherwise).
Only an explicit but invalid limit still refuses.
Docs: the flag's help, the operator guide's memory section, the status
schema and the v1.1 notes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflict: core/frontend/durable/provider_chunk.go imports only (main
dropped math/rand/v2; this branch's EachSegment fallback uses math).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A holder whose cgroup v2 limit cannot be derived (its membership is
outside the cgroup2 mount of its mount namespace, or memory.max is
unreadable), with neither --memory-limit-mib nor GOMEMLIMIT, must start
on the 256 MiB default and record why (fails: exit 2 on the derivation
error). An explicit but invalid flag still refuses.
- Applying that limit must log exactly one WARN naming the reason and the
two ways to choose a limit, and status must report the reason; a derived
limit logs nothing (fails: no WARN, status empty).
- Seams: flags.memoryLimitFallback, applyMemoryLimit (now called after
logging is configured), ProcessMemoryStatus.SoftLimitFallback,
volume.SetSoftLimitFallback / SoftLimitFallback.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: take the log fence without registering an in-flight stamp
LogFenceTsNs stamped and released at once, so each fence briefly sat in
the in-flight registry, where a concurrent claim could be capped below it,
and took the registry mutex twice. Draw the fence from the same sequence
under one lock acquisition without registering it. Lookups are about to
take one per read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: fence CreateEntry and UpdateEntry from the event stamp sequence
Both stamped their pre-write fence from the raw wall clock, so after a
backwards clock step the fence could sit below events the acknowledged
state already reflects, including the previous write's event on the same
key. A mount that versions a no-op ack by that fence would then accept an
older event over it. Take the fence from the same sequence the events use,
so it lands above every earlier event and below the write's own.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: fence a remote-object cache commit from the event stamp sequence
CacheRemoteObjectToLocalCluster stamped its commit fence from the raw wall
clock under the path lock. After a backwards clock step that fence fell
below events the cached entry already reflects, the same as the old
CreateEntry and UpdateEntry fences. Take it from the event stamp sequence.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: fence lookups from the event stamp sequence
fencedFindEntry, behind LookupDirectoryEntry and LookupDirectoryEntries,
stamped its read fence from the raw wall clock under the shared path lock.
After a backwards clock step the fence fell below events the returned
entry already reflects, so a client versioning the entry by it could take
an older event as newer. Draw it from the event stamp sequence instead.
The fence registers nothing in flight, so it never caps flush or delivery
claims; it costs one short critical section on the stamp registry's mutex
per lookup.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: keep the stamp sequence above renumbered log positions
The meta log buffer renumbers an event appended out of stamp order past
the last position it holds, and that position is what subscribers see.
Concurrent writers append in whatever order their notify work finishes,
and with the wall clock behind the sequence every renumbered position
lands past the last stamp, so a later fence could sit below an event the
fenced state already reflects. Feed each delivered position back into the
sequence stamps and fences draw from.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: draw a lookup's fence after the read
FindEntry can log an event of its own on the path it reads: importing a
remote object under a mount creates the entry, and an expired entry is
deleted. Both stamp above a fence drawn before the read, while the
returned state reflects them. Draw the fence after the read with the
shared path lock still held; a locked writer on the path cannot land in
between.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: draw the remote cache commit's fence after its re-read
The re-read can import the object from the remote and log that event; an
entry changed during the download is returned with this fence, which has to
cover the import.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: take the exclusive path lock for a lookup that writes
Fenced lookups share the path lock, and FindEntry can write under it: it
deletes an expired S3 object and imports an object from a remote mount,
logging an event either way. A lookup that read the old state just before
could then draw its fence above that event and return the old state, so a
client skipped the event as already reflected.
A fenced lookup now reads with FindEntry reporting such a write instead
of making it, and redoes the read under the exclusive path lock when it
does. The shared lock is released first, so nothing holding it waits on
the exclusive one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: escalate a fenced lookup only when the remote has the object
Refusing the lazy fetch before the remote stat sent every fenced lookup that
missed under a remote mount to the exclusive lock, so concurrent lookups of
one missing key ran their stats one after another instead of sharing one.
A lookup that may not write now stats in a flight of its own and asks for
the exclusive lock only when there is an object to import.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: require the live object from the first lookup in the expiry race test
The fence check was skipped when the first lookup errored or found
nothing, so a run that took either path passed without checking
anything. The store hands that lookup its copy before the hook expires
the object, so it always returns the live object; require that, then
compare its fence against the delete.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: release the shared remote stat only after every lookup joined it
The test let the stat sleep and assumed all eight lookups joined within
that window, so a lookup scheduled late could start a second, correct flight
and fail the count. The stat now waits on a gate the test opens once the
other seven lookups wait on the in-flight call.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
GODEBUG=fips140=only refuses MD5, and the filer then digests with SHA-256
cut to MD5's size. Tests that compared stored or reported digests against
crypto/md5 or hard-coded MD5 hex panicked or failed there; they now
compute the expected digest with util.Md5, which follows the process mode.
Tests that exercise a client's Content-Md5, which only exists with MD5,
are skipped under fips140=only as the digest test already is.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): refuse short JWT keys and skip Content-MD5 under fips.mode strict
Under fips.mode = strict the Rust volume server now does what the Go
volume server does under GODEBUG=fips140=only:
- At startup it exits when a JWT key in security.toml (any of the eleven
jwt.signing* and jwt.filer_signing* settings Go checks) is shorter than
the 14 characters FIPS 140 needs for HMAC keys, naming each one. Outside
strict mode it warns about each such key but the previous ones.
- On SIGHUP, short current keys keep the keys in effect, and a short
previous key is dropped, as in Go's Guard.UpdateSigningKeys.
- An upload's Content-MD5 is kept as the client sent it, unchecked, since
strict mode computes no MD5.
The key rule and its messages live in seaweed-common's jwt_keys, so the
worker can use the same one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* ci: run the fips140only cells in fips.mode strict, check strict refusals
The fips140only cells of the S3 digest matrix set WEED_FIPS_MODE=strict
beside GODEBUG=fips140=only, so the Rust volume server runs in the same
mode as the Go processes. A new job, test/s3/digest_matrix/negative_config.sh,
checks that master, filer and both volume servers refuse a 10-byte JWT key
at startup, that both volume servers keep a mismatched Content-MD5
unchecked, and that S3 answers a request signed with an 8-character secret
with an error.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: check the strict-mode Content-MD5 rule against both volume servers
TestWriteMD5MismatchKeptUncheckedUnderStrictFIPS starts the volume cluster
under GODEBUG=fips140=only and WEED_FIPS_MODE=strict and checks that an
upload with a mismatched Content-MD5 is stored with the client's value. It
sits in test/volume_server/http, so it runs against the Go volume server and,
with VOLUME_SERVER_IMPL=rust, against the Rust one. The same check leaves
negative_config.sh, which keeps the startup refusals.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): say which keys the strict-mode checks cover and what they do
The doc comments of the startup check, the reload rule and the jwt_keys
helpers now say which keys they check and what happens in each mode.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): an empty WEED_ variable leaves the security.toml value in place
env_string returned an empty variable as a value, so WEED_JWT_SIGNING_KEY=
replaced the key from security.toml with an empty one: the volume server
then checked no JWTs, and under fips.mode strict a short file key was not
refused, while Go's volume server exits with the same files. Go's viper
ignores empty variables; env_string now does the same for every WEED_
override.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): read security.toml with the TOML parser
The line reader missed quoted key names, multiline strings, dotted keys,
inline tables and spaced or quoted table headers, all of which Go's viper
reads, so a short JWT key written that way escaped the strict-mode check
and was not used at all. Settings are now looked up in the parsed table,
case-insensitively as viper does. A file that is not valid TOML is still
read line by line, as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): prefer the longest literal security.toml key, as viper does
Viper looks a dotted setting up longest name first, so a quoted
"jwt.filer_signing.key" key, at the top or under [jwt], wins over the
nested [jwt.filer_signing] key. The volume server read only the nested
one, so a short literal key passed the strict-mode check here while the
Go servers refused it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): resolve security.toml key case collisions as viper does
Viper lowercases every key of a config file, and when two spellings
collide (key and KEY, or [jwt] and [JWT]) the one that is not lowercase
wins. The volume server matched names case-insensitively but took the
exact spelling first, so a short KEY next to a compliant key passed the
strict-mode check here while the Go servers refused it. The parsed table
is now lowercased the same way before any lookup.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): read an array or table security.toml setting as unset
Viper's GetString reads an array or a table as "", so the Go servers
skip a jwt key written as key = ["x"]. The volume server read its TOML
text instead, used it as the key and refused strict-mode startup over
it. fips.mode is still read as text: Go refuses a mode that is not a
string, and so does this server.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): keep each lenient security.toml line under its full name
A security.toml that is not valid TOML is read line by line, and those
lines went into nested tables, so a later scalar such as signing = "x"
under [jwt] replaced the [jwt.signing] table and erased its key. The
line reader ignored such lines before, and a SIGHUP reload of that file
would have installed an empty write key. Each line now goes in under its
full dotted name, which the longest-name lookup finds first.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): take the FIPS mode from the read that gives the JWT keys
Startup read security.toml once for the JWT keys and again for
fips.mode, so a file replaced between the two reads could pair the keys
of one version with the mode of the other and refuse to start over keys
that version never ran in strict mode with. The mode now comes from the
same parse as the keys; a file that exists but was not read is still an
error.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): read a float security.toml setting as Go's GetString does
GetString formats a float with the shortest digits and no exponent, so
key = 1234567890123.0 is a 13-byte key to the Go servers. The volume
server kept the TOML spelling with its .0 and measured 15 bytes, which
passed the strict-mode check the Go servers refuse.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): skip array-of-tables sections in a lenient security.toml
A file that is not valid TOML is read line by line, and lines under a
[[jwt.signing]] header went in under the same names as [jwt.signing],
so an empty key there replaced the real one, and a SIGHUP reload would
install it. The line reader now skips such sections up to the next
ordinary header, as the earlier reader did.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
weed filer -s3 checked the broker port against the filer, metrics,
read-only, WebDAV, IAM and SFTP ports but not -debug.port, which the
debug server binds before the broker starts. weed server already
includes it.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* mq: let partition retirement drain a full flush queue outside broker locks
* log_buffer: queue the final flush from ShutdownLogBuffer itself
Every ShutdownLogBuffer caller already waits afterwards with WaitForShutdown
or IsAllFlushed, so queueing the final flush in the background changes no
caller's outcome and lets every caller holding a lock a flush callback needs
avoid the full-queue deadlock, without a second shutdown entry point.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
HEAD's version followed the manifest size: a v1.1 commit by change over a
HEAD without a recorded size (an upgraded volume's first cut) left it at
version 0, a HEAD a v1.0 binary would read. A v1.1 commit now writes
version 1 whatever it knows of the size (CommitRequest.V11, set by the
layout remote on the v1.1 format), and a version-0 HEAD carrying a v1.1
manifest size is refused like one carrying ext.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under the shipped unit's restart policy, a holder that meets a local store
or a HEAD written by a newer format exits 78 with its reason and is not
started again; the store's bytes and HEAD stay as they were; the control,
a process of the same policy exiting 1, is restarted. Prebuilt binaries
of the same tree can stand in for the build on a host without Go.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tests that pinned the removed horizon (barrier at the persisted
issue+1.5*TTL, extension writes and their status counters) now use this
process's deadline (or restart floor) plus skew. The golden wm lost range
is the same file: the master restarts half a lease after the issue, so
both versions' barriers are the same instant.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The newer-HEAD-version exit (78 head_newer_version) is chosen before the
master's final reasons, so a startup that also met a final refusal keeps
its exit: moved and deleted stay 78 with their reason, revoked stays 79.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A startup that ends on a HEAD written by a newer version exits 78
head_newer_version instead of the restartable 75 (a restart reads the same
HEAD again), and a fatal open of a store written by a newer format exits 78
store_format_newer instead of 1. The provider latches the newer-version
refusal per recovery, beside the identity refusal.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
INV-STORE-FORMAT-NEWER-001: an intact descriptor of a newer store format
is refused typed, and an open refused at slot selection removes no file.
The discard's comment names what it covers: a refusal after the select
(a corrupt map) may still follow it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mq broker: let an embedding command own the broker's start failure and shutdown
startQueueServer now returns an error when the broker cannot start instead
of exiting, binds its port before creating the broker so one that cannot
serve never registers with the master, and stops when an optional
shutdownCtx is cancelled. Profiling setup moves to weed mq.broker, since an
embedded broker read the standalone command's profile flags. weed mq.broker
and weed server -mq.broker still exit on a start failure.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: run a message queue broker beside the gateway by default
weed s3 now starts a broker on -mq.broker.port (17777) once it has reached
its filer, using the masters and filer group the filer reports. The broker
is its own gRPC server: it binds the gateway's -ip.bind, advertises the
address the gateway registers with the master, and joins the cluster like
any other broker. It stops with the gateway. A broker that cannot start,
say because the port is taken, is logged and the gateway keeps serving.
-mq.broker=false turns it off.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* server: start the message queue broker with the S3 gateway
weed server -s3 now runs a broker beside its gateway, started by the
gateway once it reaches the filer. -mq.broker=false leaves it out. An
explicit -mq.broker or -mq.agent still starts the broker on its own, and
then the gateway does not start a second one. Only that explicit broker
exits the server when it cannot start; the one that comes with -s3 is
logged, so a host already running a broker on the port keeps its gateway.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mini: run the message queue broker beside the S3 gateway
weed mini now starts a broker with its S3 gateway on -mq.broker.port
(17777, below the Linux ephemeral range), binding and advertising mini's
-ip.bind and -ip like the other services. The port joins mini's port
layout, so a taken port moves to the next free one unless it was given
explicitly. The broker stops with the gateway, before the filer it
flushes to. -mq.broker=false or -s3=false leaves it out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: start the message queue broker with the S3 gateway
weed filer -s3 now runs a broker beside its gateway on -s3.mq.broker.port
(17777), the same way weed server -s3 does: it binds and advertises where
the gateway does, takes the filer's -dataCenter and -rack, stops with the
gateway, and a broker that cannot start is logged while the gateway keeps
serving. -s3.mq.broker=false leaves it out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mini: list the message queue broker when it is running
The S3 gateway now binds its broker's port before it starts serving, as it
does for the Iceberg and Lance listeners, and records whether the bind
worked. Once mini sees the S3 port answer, the result is final: the
progress board shows the broker ready or failed, and the welcome banner
lists its address only when it bound. With -mq.broker=false or -s3=false
neither shows it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: keep the default broker off the gateway's own ports
The broker binds before the gateway binds its ports, so a gateway started
with -port=17777, -port.grpc=17777 or -port=7777 (gRPC port 17777) lost
its port to the default broker and exited. weed s3, weed server -s3 and
weed filer -s3 now compare the broker port with the gateway's HTTP,
HTTPS, gRPC, Iceberg, Lance and metrics ports first. A default broker
port that clashes skips the broker with a warning; a broker port given
on the command line that clashes is an error.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mini: reserve explicitly set gRPC ports before placing other ports
Mini only kept derived gRPC ports free while it placed the other
services, so the broker's default port could take an explicit
-s3.port.grpc=17777 and push the S3 gRPC server to another port. An
explicit gRPC port is now reserved too: the default broker moves off it,
and an explicit broker port on it is rejected.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* server: keep the default broker off the ports of the servers it starts
With -volume.port=7777 the volume gRPC port is 17777, the default broker
port. The volume server binds its gRPC port only after a master answers,
so the broker could take it first and the whole process exited.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mini: keep an explicit gRPC reservation when a derived one moves
When the filer's HTTP port was taken and moved, dropping its old derived
gRPC port also dropped an explicit -s3.port.grpc on the same port, so an
explicit -mq.broker.port could share it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* server: bind the broker beside S3 where the gateway binds
With -ip.bind=0.0.0.0 -s3.ip.bind=127.0.0.1 the broker that comes with
the gateway listened on every interface. It now takes the gateway's bind
and advertised address, as under weed s3 and weed filer -s3.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* server: keep the default broker off the volume public port
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mq broker: report a bad TLS config instead of exiting
The embedded broker loaded grpc.msg_broker TLS through LoadClientTLS and
LoadServerTLS, which exit on a bad config, so a cert without a key or
without grpc.ca took the whole S3 gateway down. The broker now loads TLS
before binding through the error-returning loaders, exported from the
security package as TryLoadClientTLS and TryLoadServerTLS, and returns
the error like any other start failure: the gateway logs it and keeps
serving, while weed mq.broker and weed server -mq.broker still exit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: start the gateway's broker by default only with broker TLS
Without grpc.msg_broker TLS the broker accepts any peer, so the broker
beside weed s3, weed server -s3 and weed filer -s3 now starts on its own
only when grpc.msg_broker has a cert and key in security.toml. Otherwise
it stays off and the gateway logs one line saying so and that
-mq.broker=true (-s3.mq.broker=true for the filer) runs it without TLS.
An explicit true starts it either way and an explicit false keeps it
off. weed mini, a single-process dev setup, keeps its broker on.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: keep the default broker off the ports of the servers it starts
weed filer -s3 checked the broker port only against the gateway's ports,
so with -webdav -webdav.port=17777 the broker could bind 17777 first and
WebDAV then took the whole filer down. The check now also covers the
filer's own HTTP, gRPC and read-only ports, its metrics port, and the
WebDAV, IAM and SFTP ports when those run, as weed server does. A
default broker port that clashes skips the broker with a warning; a
clashing -s3.mq.broker.port is an error before the servers start.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* server: keep the default broker off the filer read-only and debug ports
The port check beside -s3 left out -filer.port.public and, with -debug,
-debug.port, so a broker on 17777 could still take a port the filer or
the debug server binds. Both are now in the list. WebDAV, SFTP and IAM
were already covered when enabled.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* s3: add the bucket notification target registry
Notification destinations are defined by the operator in
/etc/s3/notification/targets.json and referred to by name from bucket
configurations, so a bucket owner cannot make the server connect anywhere
new. The registry parses and validates that file: unique names that fit in
an ARN segment and an MQ topic name, known types (topic and webhook now,
kafka, aws_sqs, google_pub_sub and pubsub accepted for later), the fields
each type needs, and no unknown keys. A target serves only the buckets its
allowed_buckets globs match, and none when the list is empty. Parse errors
never carry credential values.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: hot-reload the notification target registry
Every gateway reads /etc/s3/notification/targets.json at startup and
reloads it from the /etc metadata subscription it already runs for the IAM
and circuit breaker files. A write reloads it, a delete or rename away
empties it, and a file that does not parse leaves the previous registry in
place so a bad edit does not cut every bucket off its destinations.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: parse and validate bucket notification configurations
The full PutBucketNotificationConfiguration document is parsed: topic,
queue and cloud function configurations with their Id, destination ARN,
events and key filter. Event names are checked against the AWS list,
wildcards and names for things that never happen here included, plus the
multipart and retention events this server emits. A filter takes at most
one prefix and one suffix rule, a document at most 100 configurations, and
overlapping rules are allowed. EventBridge stays NotImplemented.
A destination resolves by the last segment of its ARN to a target, which
must exist, be enabled and allow the bucket; the error does not say which
of those failed. A rule without an Id gets one derived from its content, so
every gateway reports the same configurationId for it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: match an event against a bucket's notification rules
Configuration.Match takes an event name such as s3:ObjectCreated:Put and
an object key and returns each rule that covers them, with its
configurationId and target, in configuration order. Category wildcards
cover every event in the category, prefix and suffix are case-sensitive and
checked independently, and an event that several rules cover matches each
of them, as AWS delivers one record per rule. Publishing calls this; it is
a pure function of the stored configuration.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: store bucket notification configurations
PutBucketNotificationConfiguration used to accept only an empty document
and answer NotImplemented for any destination. It now parses the full
document, checks every destination against the target registry for this
bucket, and stores the XML exactly as sent in one Extended key on the
bucket entry through updateBucketConfig, which patches that key alone on
the bucket's owner filer. An empty document removes the key. GET returns
the stored bytes unchanged, so tools comparing ARNs see no diff, and the
bucket config cache carries the parsed rules for publishing to match.
x-amz-skip-destination-validation is parsed and must be true or false. It
only skips the test event, which publishing will send; the registry check
always runs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3notification: reject content after the configuration's root element
The stored document is served back unchanged by GET, so anything after the
root other than whitespace, comments or processing instructions is refused.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3notification: reject unknown elements inside rules and filters
A misspelled Filter, S3Key, FilterRule or Value was dropped by decoding and
left an unfiltered rule; it is now MalformedXML like an unknown root child.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3notification: URL-decode prefix and suffix filter values
AWS has special characters in filter values percent-encoded and a space
written as +, so reports+2026/ selects reports 2026/a. A value that is not
valid encoding is still matched as written.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: refuse a notification targets file stored in chunks
Only inline content is read, so a targets.json kept in chunks (written by a
mount, for one) read as an empty registry and dropped every target. It is
now refused with a warning and the loaded registry stays.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3notification: refuse overlapping rules as AWS does
AWS answers InvalidArgument ("Configuration is ambiguously defined") when two
rules share an event type and both their prefixes and suffixes overlap, so an
event for a key matches at most one rule. Such configurations were accepted
and matched every rule.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Regenerated with STATUS_SCHEMA_UPDATE=1: Chunk.Stats.CutsYielded and
Chunk.CutSchedule.CutYields.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- hostlimit: Config.YieldAfter (S, default 5 min). ShouldYield answers yes
only for a Normal hold at least S old while another cut on the host holds
a live ticket this process has not judged stalled (dead tickets are
reaped on the way); the probe runs only once the hold is old enough and
takes no limiter lock.
- storage: a cut attempt asks at each staging batch boundary and ends with
ErrCutYielded, keeping what it staged; CutsYielded counts it, never as a
failed cut.
- durable: a yielded attempt is retried at the next poll with no backoff,
on a ticket at the back (it was admitted), counted in status (CutYields)
and not logged as a failure.
- blockvolume: --host-limit-yield-after. Invariants: INV-HOST-CUT-YIELD-001;
M7 states the rule. v1.1 notes carry it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Seams: Config.YieldAfter (S, default 5 min), Limiter.ShouldYield (never,
for now), storage.ErrCutYielded, storage.BudgetYield, ChunkLayerStats.
CutsYielded and CutScheduleStatus.CutYields.
- TestShouldYieldOnlyAfterSWithALiveWaiter: a Normal hold yields only once
it is S old and another process holds a live ticket; never a lone hold,
never before S, never an urgent hold, not for a ticket judged stalled.
Fails here: no hold ever yields.
- TestCutYieldsAtABatchBoundaryAndKeepsItsStaging: a cut whose budget asks
it to yield ends at the next staging batch boundary with ErrCutYielded,
counted as a yield, not a failure, publishes nothing, and its staged
chunks are kept for the next attempt. Fails here: the cut never yields.
- TestChunkLoop_AYieldIsRetriedAtOnceAndCountedApart: a yielded attempt is
retried at the next poll, never backed off as a failure, and status counts
it apart. Fails here: the retry came 1.1 s later.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>