Repository navigation
fix(wait): compute rmw_wait timeout in int64 to preserve infinite blocking [P2] - #8
Conversation
95a7a21 to
fd1a1de
Compare
|
Approve (with an optional follow-up). Verified this is a clean, focused, correct fix for the P2 silent-truncation bug. Re-derived the arithmetic against the live headers: sec/nsec are uint64_t and RMW_DURATION_INFINITE = {9223372036, 854775807}, so the new int64 accumulation at Scope is clean per CLAUDE.md §1/§2/§3: the diff touches only the timeout computation plus the necessary Non-blocking follow-ups:
LGTM. |
Severity: P2 — found by a full multi-agent code audit (method + findings in
AUDIT_FINAL.md).Problem
timeout_ms = static_cast<int>(wait_timeout->sec * 1000 + wait_timeout->nsec / 1000000)truncated a 64-bit duration toint.RMW_DURATION_INFINITE({9223372036, 854775807}) → ~9.2e12 ms → truncates to ~2.077e9 ms (~24 days), so "block forever" silently became a ~24-day timeout; a 60-day finite timeout truncated to ~10 days.Fix
Accumulate the milliseconds in
int64_t; map the infinite duration (and any value> INT_MAXms) toepoll_wait's-1sentinel (block forever); otherwise clamp to[0, INT_MAX]. Preserves the existing<1ms → 1msrounding.File:
rmw_unix_socket_cpp/src/rmw_wait.cppBuild: clean.