Commit 02da941
committed
fix(gateway): tighten ~GatewayNode graph-event teardown for TSan
TSan flagged a Write/Read race on the rclcpp::Event control block between
the per-context graph listener thread (calling NodeGraph::notify_graph_change)
and our automatic member destruction in ~GatewayNode. Reproduced today in
test_gateway_node where many GatewayNode instances are created and destroyed
in sequence while the per-process GraphListener keeps running.
Two-pronged fix:
- Explicitly cancel and reset graph_check_timer_, backstop_timer_ and
graph_event_ at the end of the ~GatewayNode body, before any other
member runs its destructor. This drains the timer (its [this] lambda
reads graph_event_) and drops our shared_ptr while we still control the
ordering, instead of relying on declaration-order destruction.
- Add a TSan suppression for the residual library-side window inside
rclcpp::node_interfaces::NodeGraph::notify_graph_change, matching the
existing approach for other rclcpp-internal races (signal handler,
logging, Context shutdown). We do not own that code path; the fix
above closes our half of the race.1 parent e845583 commit 02da941
2 files changed
Lines changed: 30 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1537 | 1537 | | |
1538 | 1538 | | |
1539 | 1539 | | |
1540 | | - | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
1541 | 1560 | | |
1542 | 1561 | | |
1543 | 1562 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
44 | 54 | | |
45 | 55 | | |
46 | 56 | | |
| |||
0 commit comments