fix(spop): support configurable frame sizes#31
Closed
fionera wants to merge 1 commit into
Closed
Conversation
Collaborator
Author
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.
Summary
Agent.MaxFrameSizewith a zero-value-compatible 65,535-byte default and a 256-byte protocol minimumRoot cause
All connections used one global
sync.Poolwhose buffers were permanently sized to 65,535 bytes. The HELLO handler also rejected larger HAProxy offers instead of negotiating the lower supported value required by SPOP. Removing only the validation would therefore allow a larger negotiated value to reach an undersized pooled buffer.The configured Agent ceiling makes every buffer in a listener's shared pool the same size, while each connection still enforces its negotiated limit.
Impact
Existing zero-value Agents retain the 65,535-byte ceiling. Deployments using larger HAProxy buffers can construct an
Agentwith a matchingMaxFrameSize; for example, a 256 KiB HAProxy buffer advertises 262,140 bytes.Because pooled frame buffers are allocated at the configured ceiling, callers should choose the smallest value that accommodates their HAProxy configuration.
Fixes #14.
Related upstream report: corazawaf/coraza-spoa#194
Validation
GOTOOLCHAIN=go1.21.13 go test ./...GOTOOLCHAIN=go1.23.1 go test -race ./...CGO_ENABLED=0 GOARCH=386 go test ./...staticcheck v0.5.1go test -tags e2e ./spopwith HAProxy 3.3.11