Repository navigation
test(nav): headless sim_world ABI-skew canary - #775
Merged
Merged
Conversation
nav_sim_world_test runs nav_city_swarm's GL-free startup path
(city_scene -> from_occupancy -> size/planes/agent_planes -> snapshot ->
step) and asserts size() == the requested agent count, across shared /
grouped / private belief modes.
That startup path produced the long-standing nav_city_swarm startup
crash. The root cause is an ABI/layout skew, not an uninitialized read:
sim_world embeds config (which holds veh_params) and material_config by
value, both of which grow as nav work lands, so sizeof(sim_world) changes
in the headers. A cvc library built from an older layout returns a
wrong-sized sim_world by value, so size()/planes() read garbage (512 came
back as 236190608) and the by-value return smashes the caller's stack
(the rip=0 / ret-to-null in the dumps). It was invisible to
AddressSanitizer because it is a layout mismatch, not a heap error -- the
ASan build simply rebuilt cvc from source and erased the skew.
EXPECT_EQ(w.size(), N) is the canary: it fails loudly ("expected 512, got
236190608") the instant a consumer is built against headers whose
sim_world layout disagrees with the linked cvc -- e.g. a published deps
bundle lagging the source tree. In a consistent build it is a cheap
from_occupancy/snapshot/step regression test. Test-only; no behavior
change.
git-clang-format flagged the changed lines: IncludeBlocks: Regroup + SortIncludes want one sorted include block (vector after gtest), matching the repo convention. No code change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
nav_sim_world_test, a headless (no cvcGL / VTK / OpenGL) gtest that exercises exactly the pathnav_city_swarmruns at startup before it opens a GL context:city_scene → from_occupancy → size()/planes()/agent_planes() → snapshot → stepacross shared / grouped / private belief modes, and wires it into
ctest(src/cvc/tests/CMakeLists.txt).Why
That startup path is the source of the long-standing
nav_city_swarmstartup crash. The root cause is an ABI / struct-layout skew — not an uninitialized read.sim_worldembedsconfig(which holdsveh_params) andmaterial_configby value, both of which grow as nav work lands (the footprint/steering/grip fields, the injected thread-pool, …), sosizeof(sim_world)changes in the headers. Acvclibrary built from an older layout returns a wrong-sizedsim_worldby value, sosize()/planes()read garbage (512 came back as236190608) and the by-value return smashes the caller's stack (therip=0/ ret-to-null seen in the crash dumps).It was invisible to AddressSanitizer because it is a layout mismatch, not a heap error — the ASan build simply rebuilt
cvcfrom source, erasing the skew.EXPECT_EQ(w.size(), N)is the canary: it fails loudly ("expected 512, got 236190608") the instant a consumer is built against headers whosesim_worldlayout disagrees with the linkedcvc— e.g. a publisheddepsbundle lagging the source tree. In a consistent build it is a cheapfrom_occupancy/snapshot/stepregression test.Verification
nav_city_swarm.exeruns clean, and a fresh headless program built from today's headers against the installeddeps/cvc.libreturnssize()=5/512correctly — the installed library and headers are ABI-consistent. This test is a preventive guard so the skew can't silently return the next timedepslags a layout change.--track-origins):0uninitialised-value errors across shared/grouped/private modes — confirming there is no latent uninit read; the failure mode is purely build/layout consistency.Test-only; no source behavior change.