Fix SHM futex timeouts on 32-bit time64 libc

Merged
KT
1mo ago
+1122-30

On 32-bit Linux with time64 libc, passing libc's timespec directly to the legacy futex syscall can turn a 100 ms SHM receive timeout into an immediate timeout. Idle session workers then repeatedly wake and consume CPU.

Marshal the selected kernel timeout ABI explicitly in C and Rust, retaining legacy-kernel compatibility and preserving infinite waits. Use portable Go timespec construction. Add elapsed-time and delayed-message regression tests, ARM ABI CI coverage, and integration guidance. Public APIs and the shared-memory wire layout are unchanged.

Validation:

  • Original C and Rust wrappers reproduced immediate expiry with ARM musl time64; corrected tests pass.
  • C passes native x86_64, i386 glibc time32/time64, and little-/big-endian ARM musl time64.
  • Rust passes 1.91.0 and latest stable 1.98.1, including ARM musl time32/time64 public-API tests.
  • Focused C/Rust/Go SHM and service tests and all nine language pairings pass.
  • Formatting, Clippy correctness/suspicious gates, workflow/shell validation and SOW audit pass.

Production CPU reduction has not been remeasured. Separate pre-existing Go UDS/Rust test 32-bit build gaps are tracked in SOW-0037.

Downstream vendor PR: netdata/netdata#24049.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed shared-memory receive timeouts on Linux systems with differing 32-bit and time64 futex ABIs, helping waits honor their requested duration.
  • Documentation

    • Added guidance on timeout behavior and validating it across Linux ABI configurations.
    • Clarified that timeout validation does not establish production CPU usage or full cross-language platform support.