Skip to content

Akka.IO: wire akka.io.tcp.maximum-frame-size to the pipe segment size (#8657) - #8663

Merged
Aaronontheweb merged 3 commits into
akkadotnet:devfrom
Aaronontheweb:fix/io-tcp-max-frame-size-segments
Sep 29, 2026
Merged

Aaronontheweb merged 3 commits into
akkadotnet:devfrom
Aaronontheweb:fix/io-tcp-max-frame-size-segments

Conversation

@Aaronontheweb

@Aaronontheweb Aaronontheweb commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Closes #8657.

akka.io.tcp.maximum-frame-size (TcpSettings.MaxFrameSizeBytes) capped the read buffer and the bytes per socket send in v1.5. It has done nothing since #8132 moved Akka.IO TCP onto System.IO.Pipelines. The pipes' default 4 KB segments took its place, because the write pump sends one segment per WriteAsync and each read fills one segment. The default behavior happened to match (4k), but raising the setting silently stopped working. No release includes #8132, so this is a v1.6 regression.

Changes

  • Both pipes get minimumSegmentSize: settings.MaxFrameSizeBytes. With Inet.SO.PipeBufferSize set, the output pipe's watermarks are 2x/1x as before; otherwise pause 64 KB, resume 32 KB, the same as PipeOptions.Default.
  • maximum-frame-size must now be positive (0 would make every pipe write throw); the check was < 0.
  • The TcpSettings error messages said "at least 2x" while the check is 1x. The messages now describe the 1x check, which is unchanged. The akka.conf advice to size the buffers at 2x the frame size stays: at 2x the kernel can hold one send while the next is copied in.
  • The akka.conf comment says what the setting does: an upper bound on bytes per socket read and per socket send, rounded up to a power of two (the pipe's pool rounds segment sizes), and each connection holds at least one buffer of that size.

The default is unchanged (4 KB), so nothing changes unless someone raised the setting. It restores v1.5 behavior, so there's no ledger row.

Tests

TcpMaximumFrameSizeSpec: a single 64 KiB write reaches the socket as 16 × 4 KiB sends at the default, and as one send with maximum-frame-size = 64k. With the fix reverted, the 64k case fails (16 × 4096). The Akka.Tests.IO and Streams TCP suites pass.

…akkadotnet#8657)

akkadotnet#8132 moved TCP onto System.IO.Pipelines, and maximum-frame-size stopped
doing anything: the pipe's default 4 KB segment size decided the read
chunk and bytes-per-send instead. Pass it as minimumSegmentSize on both
pipes so raising the setting cuts socket sends for large writes again,
restoring the v1.5 behavior.

Also fixes the TcpSettings buffer-size exception messages, which said
"at least 2x the maximum frame size" while the check is 1x.
@Aaronontheweb
Aaronontheweb merged commit c110c5e into akkadotnet:dev Sep 29, 2026
8 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Akka.IO: akka.io.tcp.maximum-frame-size stopped working in #8132; wire it to the pipe segment size

1 participant