Skip to content

A remote node's operation response cannot carry an object: the sealed datagram exceeds max_gossip_packet above 5802 bytes #399

Closed

Description

@scttfrdmn

Blocks #142. Latent today, live on every read the moment #142 lands as written.

The defect

The only node-to-node transport is UDP gossip. A remote operation's response travels:

NodeResult.Data []byte (internal/distributed/coordinator.go:121)
→ NodeOperationRespMessage (coordinator.go:41)
→ sendConsensusMsg (gossip.go:1502)
→ sendMessage (gossip.go:1229)
→ the MaxGossipPacket guard at gossip.go:1246

That guard hard-errors rather than fragmenting, which is correct in itself (#277): the sealed length is the last point at which the size is knowable and the first at which it is final, and a receiver can do nothing with a prefix.

But Data is a []byte, so encoding/json base64-encodes it, and the envelope + MAC (auth.go:199) add more. So there is a hard ceiling on how much object a response can carry, and it is far below what a read produces.

Measured, not estimated

Binary-searched with the real seal path and a representative response (a UUID request ID, a hostname-shaped node ID, a quoted ETag, a latency), against the default MaxGossipPacket = 8192 (cluster.go:189):

payload sealed verdict
5802 B 8192 B largest that fits
5803 B 8196 B refused
8192 B 11380 B refused — 38.9% inflation
131072 B (kernel MaxRead) 175220 B refused, 21× over

Two corrections to the estimate I started from: the ceiling is 5802 bytes, and inflation is 38.9%, not base64's ~33% — the envelope, MAC and message ID account for the rest. Worth stating because "~6 KiB" and "~33%" are both the kind of number that gets reasoned from later.

So any remote OpTypeGet returning more than 5802 bytes cannot send its response. The kernel's MaxRead is 128 KiB. Essentially every real read is over the limit.

The symptom misdirects, which is the expensive part

Two nodes, two messages, and neither names the cause:

  • Responder logs at Warn: "failed to send operation response" (coordinator.go:705) — and then returns, so the request is simply abandoned.
  • Requester waits out its full timeout and reports "operation timed out waiting for remote response" (coordinator.go:578).

A size failure presented as a timeout, 30 seconds later, on a different host, at a level most deployments do not collect. An operator debugging this looks at the network, at the peer's health, at the timeout value — every place except the one that is wrong. The sendMessage error text itself is good ("a %s message is %d bytes sealed, over the %d-byte max_gossip_packet"); it is thrown away at coordinator.go:705, which logs the wrapper instead.

Raising MaxGossipPacket is not the fix

It is the obvious move and it is worse than the failure. Past the ~1500-byte path MTU, a UDP datagram is IP-fragmented, and a single lost fragment silently discards the whole datagram — trading a clean error naming a limit for intermittent loss that scales with size and looks like a flaky network. The default is already 8192, i.e. already fragmenting; going to 192 KiB to fit a 128 KiB read would mean ~90 fragments per response, any one of which kills it.

Note also that defaultMaxGossipPacket has a floor from the other side: TestNewClusterManager_DefaultMaxGossipPacketHoldsAThreeNodeSync (cluster_test.go:143) asserts it is large enough to carry a three-node sync, so this value is already pinned by a real requirement and is not free to move.

Directions, in preference order

  1. Do not put object bytes on the gossip wire. Announce and query over gossip (metadata is small); fetch the bytes over a stream. That is the rescoping proposed on A2-4: Cache-warming read: try peers before S3 on cache miss #142 — a peer hit tells you a key is worth warming, and the warm itself is a GetObject from S3, which cache.Warmup (internal/cache/multilevel.go:301) already does. Gossip keeps carrying only what fits in a datagram, which is what it is for.
  2. A separate TCP/stream path for bulk transfer, if peer-to-peer data fetch is genuinely wanted later. This is real work: a second listener, its own authentication (the gossip MAC is per-datagram), and its own backpressure.
  3. Chunk responses across datagrams with reassembly, sequencing and retransmission — i.e. reimplement the part of TCP that UDP left out. Listed for completeness, not recommended.

Whichever is chosen, the reporting deserves fixing regardless: coordinator.go:705 should return the size error to the requester rather than dropping it, so the requester fails immediately with the real reason instead of timing out.

Why this is latent right now

Nothing on the mount path calls ExecuteOperation — internal/distributed is imported only by tests, as docs/index.md's "not yet wired up" table records. #139 is what would connect a coordinator to a mount, and #142 is what would make remote gets routine. This should be settled before #142, not after: the failure is silent on the sender, delayed on the receiver, and proportional to how well the cache is working.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: distributedpriority: hightype: bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions