Skip to content

fix(dynamic-message): Avoid proxy layout checks on C sequence data - #732

Open
hxyulin wants to merge 1 commit into
ros2-rust:mainfrom
hxyulin:fix/dynamic-sequence-proxy-size
Open

hxyulin wants to merge 1 commit into
ros2-rust:mainfrom
hxyulin:fix/dynamic-sequence-proxy-size

Conversation

@hxyulin

@hxyulin hxyulin commented Oct 23, 2026 •

Copy link
Copy Markdown

Fixes #664. proxy_elems and proxy_elems_mut check C sequence storage against the size/alignment of a Rust proxy struct. Those layouts are unrelated, so valid small message sequences panic. Remove these two checks; element-sized slicing and proxy construction remain unchanged.

One regression uses the existing builtin_interfaces/Time type (8 bytes) to read and mutate a singleton through both proxy paths. It fails on the upstream implementation and passes with the fix in debug and release on macOS arm64/ROS 2 Jazzy. Modified-file formatting and git diff --check pass. No dependency or public API changes.

Initial CI passed all five Rust Stable jobs. Rust Minimal/Jazzy failed two unchanged tests that immediately query /rosout discovery; the new regressions passed. The patch is now reduced to one source file and one focused regression, without geometry_msgs or changelog edits.

Downstream context: separate typed-publisher work measured 2.223 → 1.222 ms per 20,000-point publish call (Apple M5 Max, rclrs 0.8/Fast DDS, paired release runs, zero subscribers). That is context for how we encountered this bug, not a performance claim for this fix.

Assisted-by: Codex:gpt-6.1-sol

@hxyulin
hxyulin force-pushed the fix/dynamic-sequence-proxy-size branch from 797d1d0 to dc45bed Compare October 23, 2026 05:44
Remove checks against Rust proxy size and alignment when building proxies for C sequence elements. Add one regression using builtin_interfaces/Time to cover immutable and mutable singleton access without additional dependencies.

The native regression reproduces the upstream assertion and passes with the fix in debug and release on macOS arm64 with ROS 2 Jazzy.

Fixes ros2-rust#664.

Assisted-by: Codex:gpt-6.1-sol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

proxy_elems checks the C buffer's length against the size of the Rust proxy type — small message arrays panic in release

1 participant