Skip to content

[BUG] A fault confirmed right after a post-fault recording window gets no rosbag #574

Description

@bburda

Bug report

Steps to reproduce

  1. Configure the fault manager with rosbag snapshots on and a post-fault window, e.g. snapshots.rosbag.duration_sec: 2.0 and snapshots.rosbag.duration_after_sec: 0.5.
  2. Report and confirm a fault, and wait for its bag to finalise.
  3. Report and confirm a second fault within a few milliseconds of that bag completing.
  4. Call GetRosbag for the second fault code.

Expected behavior

The second fault gets a bag, or at minimum a record saying why it could not.

Actual behavior

No bag and no record. GetRosbag reports success=false indefinitely and the only trace is a warning in the log:

Bag file completed: .../fault_ROSBAG_TEST_001_...
New fault reported: ROSBAG_CLEANUP_TEST          (+1.4 ms)
WARN  Buffer is empty, cannot create bag file
WARN  Failed to create bag file for fault ROSBAG_CLEANUP_TEST

flush_to_bag returns an empty path when the ring buffer is empty and on_fault_confirmed then only warns and returns. No RosbagFileInfo row is written and there is no retry, so polling cannot recover a decision made in the first millisecond.

The buffer is empty at that moment by construction: during a post-fault window message_callback writes straight to the bag and does not buffer, and flush_to_bag has already drained the deque.

Environment

  • ros2_medkit version: 0.6.0 (main)
  • ROS 2 distro: reproduced on jazzy and humble
  • OS: Ubuntu 24.04 / 22.04 (CI containers), also reproduced locally

Additional information

This matters most where the feature is supposed to earn its keep. Bursts of correlated faults are the case a black box exists for, and the second fault of a burst is the one that lands in the gap.

The code already accepts the principle for the neighbouring case: attach_to_active_recording handles a fault confirming inside an active post-fault window. Nothing covers the instant after it finalises.

Options, in increasing cost: write a row flagged as having no pre-fault data so the gap is at least visible; keep the recording open across the boundary; or open a post-fault-only bag.

Surfaced when a new package changed test scheduling. The integration tests have been given guards so the suite no longer depends on timing, but those guards only hide it from CI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions