Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'while' loop creates an empty bag file for every time interval between start time and current time #2317

Open
SamuelHerring opened this issue Feb 28, 2023 · 1 comment

Comments

@SamuelHerring
Copy link

ros_comm/tools/rosbag/src/recorder.cpp has a bug that makes it vulnerable to generating lots of empty bag files if there is a time jump between "start_time_" and "t"(current time).

We are running recorder.cpp on a Jetson Nano, which takes some time after boot to get the up-to-date time.
This updates the system time, creating a time jump. This can easily be 100s of days, causing the recorder.cpp node to generate 100Ks of empty bag files.

The culprit is the Recorder::checkDuration function (line 516), which slowly counts forwards from the start time to the present time in 30-second (in our case) increments, creating a bag file for each.

I'd suggest that changing the line "start_time_ += options_.max_duration;" (line 529) to be "start_time_ = t;"
This would mean that this loop is only executed once on startup, and "start_time_" would get updated to the current time in one go, rather than in increments of "options_.max_duration".

As this would only execute once, I also suggest that the "while" (line 524) is replaced with a simple "if".

Many Thanks

@robot-dan
Copy link

Had similar issues when time-jumping during a rosbag record, would love a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants