rosbag2 icon indicating copy to clipboard operation
rosbag2 copied to clipboard

Fixes writer not being able to open again after closing

Open yschulz opened this issue 10 months ago • 3 comments

Fixes #1598 After discussion in #1590 I verified the issue in and reapplied the changes and comments to rolling. To reiterate, the storage_factory needs to persist beyond the call to close a current bag. On the other hand, all containers that were built during the recording have to be cleared before opening another bag.

yschulz avatar Mar 30 '24 09:03 yschulz

I keep it as a draft until @MichaelOrlov and @fujitatomoya can verify what all can be attached to a writers lifetime and what needs to be reset. I am especially not sure about the compressed writer, since I haven't spend enough time looking at that one. Thank you guys for your comments and review, I guess we can close the other PR?

yschulz avatar Mar 30 '24 09:03 yschulz

@yschulz so this replaces https://github.com/ros2/rosbag2/pull/1590, right? in that case, you can close https://github.com/ros2/rosbag2/pull/1590, and let us know this one is ready to review.

fujitatomoya avatar Apr 01 '24 03:04 fujitatomoya

@fujitatomoya done, and yes please :)

I had a closer look at the compression writer and as to my impression, there is no need to clear anything regarding the compression functionality. However, I saw that the closing of all the storage functionality can be directly delegated to the base class (as it is for opening and writing anyway). Also, spotted an unused member, maybe a relict from before the threaded approach, you may know more.

yschulz avatar Apr 01 '24 19:04 yschulz

Thanks for the review and addressing the changes directly.

yschulz avatar May 06 '24 05:05 yschulz

@yschulz Sorry for taking a long time to review. It was a rush time before Jazzy code freeze. And changes per this PR were non-trivial for review. Was need to verify that we will not break anything.

MichaelOrlov avatar May 06 '24 06:05 MichaelOrlov

Gist: https://gist.githubusercontent.com/MichaelOrlov/2677c3394586488cd9a777215205eff9/raw/4e54566b952d8218af61493f02a1e01394e567bf/ros2.repos BUILD args: --packages-above-and-dependencies rosbag2_cpp rosbag2_compression rosbag2_tests TEST args: --packages-above rosbag2_cpp rosbag2_compression rosbag2_tests ROS Distro: rolling Job: ci_launcher ci_launcher ran: https://ci.ros2.org/job/ci_launcher/13815

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

MichaelOrlov avatar May 06 '24 06:05 MichaelOrlov

@MichaelOrlov thanks for checking this, i will take a look at this today.

fujitatomoya avatar May 06 '24 16:05 fujitatomoya

Re-run Windows CI It seems the previous failure is unrelated to the changes from this PR.

C:\ci\ws\src\yschulz\rosbag2\rosbag2_storage\include\rosbag2_storage/yaml.hpp(28,10): fatal error C1083: Cannot open include file: 'yaml-cpp/yaml.h': No such file or directory (compiling source file C:\ci\ws\src\yschulz\rosbag2\rosbag2_storage\src\rosbag2_storage\metadata_io.cpp) [C:\ci\ws\build\rosbag2_storage\rosbag2_storage.vcxproj]
  • Windows Build Status

MichaelOrlov avatar May 06 '24 16:05 MichaelOrlov

@clalancette Out of curiosity if this is a known issue

C:\ci\ws\src\yschulz\rosbag2\rosbag2_storage\include\rosbag2_storage/yaml.hpp(28,10): fatal error C1083: Cannot open include file: 'yaml-cpp/yaml.h': No such file or directory (compiling source file C:\ci\ws\src\yschulz\rosbag2\rosbag2_storage\src\rosbag2_storage\metadata_io.cpp) [C:\ci\ws\build\rosbag2_storage\rosbag2_storage.vcxproj]

Or we missing something like find_package(yaml-cpp REQUIRED) in CMake file?

MichaelOrlov avatar May 06 '24 18:05 MichaelOrlov

@clalancette Out of curiosity if this is a known issue

No, not a known issue. This succeeded on the nightlies: https://ci.ros2.org/view/nightly/job/nightly_win_rel/3037/ .

My best guess is that this PR needs to be rebased onto the latest rosbag2 code to get #1605

clalancette avatar May 06 '24 18:05 clalancette

Re-run Windows CI after rebasing on the latest Roling

  • Windows Build Status

MichaelOrlov avatar May 06 '24 19:05 MichaelOrlov

Ok. CI is green after rebase. Merging then.

MichaelOrlov avatar May 06 '24 21:05 MichaelOrlov

https://github.com/Mergifyio backport jazzy

MichaelOrlov avatar May 06 '24 22:05 MichaelOrlov

backport jazzy

✅ Backports have been created

mergify[bot] avatar May 06 '24 22:05 mergify[bot]