Skip to content

validate ServerConfig at startup (power-of-two sizes) instead of kernel EINVAL #102

Description

@MDA2AV

Severity: low — error UX at startup.

Problem

Several ServerConfig fields have hard requirements that surface late and cryptically:

  • BufferRingEntries and ConnBufRingEntries must be powers of two (kernel pbuf-ring requirement). A bad value fails at ring registration with register pbuf_ring failed: ret=-22 errno=... (Reactor.Loop.SharedRing.cs#L26-L31) — nothing names the offending property.
  • RecvQueueEntries is validated by SpscRecvRing's constructor with a clear message, but only when the first connection is constructed — i.e., at first accept, not at startup.
  • MaxConnections, IncRecvBufferSize, WriteSlabSize etc. have implicit range expectations (positive, sane bounds) that are never checked.

Suggested fix

A ServerConfig.Validate() (or checks in the Reactor constructor) that fails fast with the property name and the constraint: power-of-two checks for the ring/queue sizes, positive ranges for buffer sizes, Incremental-mode kernel floor note (6.12) in the error when registration returns -EINVAL anyway. Cheap, and it converts a class of confusing runtime failures into immediate, named config errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions