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".
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