[#25513] Solve tools Flaky tests#192
Open
Danipiza wants to merge 4 commits into
Open
Conversation
Signed-off-by: danipiza <dpizarrogallego@gmail.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #192 +/- ##
==========================================
+ Coverage 37.98% 39.01% +1.02%
==========================================
Files 177 160 -17
Lines 12751 7849 -4902
Branches 5844 3148 -2696
==========================================
- Hits 4844 3062 -1782
+ Misses 4793 3068 -1725
+ Partials 3114 1719 -1395 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: danipiza <dpizarrogallego@gmail.com>
…atch Signed-off-by: danipiza <dpizarrogallego@gmail.com>
Signed-off-by: danipiza <dpizarrogallego@gmail.com>
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.
Description
Fix Tools Flaky tests.
DDS-Record-Replay
While stabilizing the DDS-Record-Replay CI (TSAN) several failures were traced to two distinct problems in this repository.
1.
DdsRecorderMonitorcrash whenmonitor_status()runs more than onceDdsRecorderMonitor::monitor_status()created theDdsRecorderStatusMonitorProducerin a function-localstaticunique_ptrand thenstd::moved it into theStatusMonitorProducersingleton. Because the variable isstatic, it is initialized only once and is left in a moved-from (null) state after the first call. Any second call — which every monitoring unit test does in itsSetUp()— dereferenced the null pointer atddsrecorder_status_producer->init(...), crashing the process:0xC0000409(fatal exit) on Windows,The whole test binary crashed on the second test, so CI blamed whichever test happened to be running (e.g.
LogMonitorDdsRecorderStatusTest.mcap_file_creation_failure).Fix: install the producer through
StatusMonitorProducer::init_instance()(a no-op once thesingleton exists) and always retrieve/operate on
get_instance(), re-registering the consumers onit. This mirrors the
ddspipe_core::Monitor::monitor_status()pattern and makes the method safe tocall multiple times per process.
2. Flaky
ResourceLimitsTestSQL size assertionsResourceLimitsTest.sql_log_rotationandsql_max_file_sizeintermittently failed with "unacceptable size" (e.g. 112–192 KB vs a 240 KB minimum). Root cause:wait_for_acknowledgments()only guarantees that samples reached the recorder's (reliable) reader, not that they have been written to disk. Writing is asynchronous, so on slow / loaded CI runners the write pipeline lags, and stopping the recorder while samples are still pending drops them, leaving the output filesmaller than expected.
Fix: before stopping the recorder, wait for the recording to catch up. The samples are retained
by the reliable reader (no data loss), so the test polls the on-disk recording (the open
<file>.tmp~, plus the SQLite-walsidecar) until it reaches the steady state (log-rotation capsit at
max-size) or stops growing (drained), with a generous cap kept below the ctest timeout. Thisremoves the timing assumption without weakening the assertion — a genuine under-recording still fails.
DDS-Router
RPC service replies were intermittently lost when routed through the DDS Router, causing ROS 2 service clients to hang forever on a request the server had actually answered. This surfaced as flaky failures in the DDS-Router dockertests:
tool.application.ddsrouter.compose.rpc_ros2_services_correct_targettool.application.ddsrouter.compose.rpc_ros2_services_trivial_multipletool.application.ddsrouter.compose.rpc_ros2_services_repeater_with_talkerRoot cause
Reply topics use
RELIABLE+VOLATILEQoS. A client'swait_for_serviceonly proves the reply reader is matched from the reader side, so the client starts sending requests while the router's client-facing reply writer has not yet matched that client's reply reader on the writer side. The router forwards the request, the server answers, and the router writes the reply into that discovery window — beingVOLATILE, the sample is delivered to no one for that client and then purged. Because ROS 2 service clients never retry a request, the client blocks forever.