Skip to content

Expose datagram truncation instead of losing recvmsg result flags #550

Closed

Description

@LunaStev

The Linux vectored receive provider constructs a local NativeMessage, calls recvmsg, and returns only the byte count. The kernel-written message.flags are discarded. udp_recv_vectored then returns an ordinary successful NetIoResult, which has no truncation field.

For a datagram larger than the combined receive buffers, Linux reports MSG_TRUNC in the output flags. Once that flag is discarded, a caller cannot distinguish a complete datagram that exactly filled the buffers from the prefix of a larger datagram whose tail was discarded. The public single-buffer UDP receive helpers also expose only the count/error outcome.

This is a request for an observable portable result, not a claim that a returned byte count by itself violates recvmsg behavior.

Code evidence:

Acceptance:

  • Preserve native truncation information through the provider boundary and expose it via a reviewed result/API extension or an explicit truncation error.
  • Keep the number of bytes actually stored distinct from the original datagram size when a backend can report both.
  • Cover smaller-than-buffer, exactly-full, oversized and zero-length datagrams over loopback, with one and several receive slices.
  • Define equivalent observable behavior for supported native Windows/BSD providers without making TCP EOF semantics depend on datagram flags.
  • Preserve bounded caller-owned storage and do not retry a truncated datagram as if its discarded tail were another stream read.

Reference: Linux recvmsg output flags. Related #515 replaces Linux vector libc wrappers, but does not cover lost result flags; #509 concerns zero-length TCP reads, and #508 concerns error-code classification.

Audit status: static source inspection against canonical master ea74c2dafc31da876e5561f2d176ba719f5a0458 on 2026-09-10. No compiler build, test execution, implementation change or local reproduction was performed for this report. The examples describe the source-derived behavior to verify when implementing the fix.

Activity

  1. added
    enhancement
    help wanted
    cross-platform
    on Sep 10, 2026
  2. added a commit that references this issue on Nov 11, 2026
    a26aeca
  3. added a commit that references this issue on Nov 13, 2026
    69a67c6
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

    cross-platformenhancementhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions