-
Notifications
You must be signed in to change notification settings - Fork 914
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
Bug in rosbag_storage: can't reuse the same instance or rosbag::Bag #1176
Comments
I tried to reproduce this issue (ignoring the valgrind part): #1188 I modified an existing test case that did points 1 through 3 as you listed them by simply adding a loop. The test still works. Did you find the issue only through valgrind or did your application actually fail somehow? Can you provide a failing test? |
I also ran the test with valgrind:
|
Thanks. I will check it out and see if I can create a failing test
|
I found a way to recreate the error. https://gist.github.com/facontidavide/80fa6e2b7a6328f63d88f1c333b4c796 before you look deeper into it, it seems that what trigger the problem is reduce_overlap = true in robag::View. |
To be specific, this examples does recreate the memory error in Valgrind but not the exception. In my application, PlotJuggler, I additionally get an exception at the second bag.open. |
|
Update:
https://gist.github.com/facontidavide/80fa6e2b7a6328f63d88f1c333b4c796
|
Can you please update #1188 to cover this case. |
Huh ... it took me three attempts to reproduce this. I had actually given up. First I used your code with the test bag (written to two different files on disk) from the test. Then I ran it with two different bags I had lying around, each with thousands of messages of one message type each. No exception. Then I only refactored the test a bit to clean it up and added a few more topics and message types, and voila! I had a beautiful "invalid TCPROS header" message :) I updated #1188 with the failing test. Luckily I already played around with simply cleaning up more state in But somehow these changes already fixed the bug: #1192 :) |
I just want to confirm that PR #1192 did solve the problem in my program. Shall we close this issue? |
The issue can be closed once the PR has been merged. |
#1176) (#1192) * Extended iterate_bag test to ensure that closing & reusing works * ... even with different bags * Fixed corrupted messages when reopening a rosbag with a different file * Bag::decompressed_chunk_ was not reset in close(). decompressed_chunk_ stores the offset (within the file) of the compressed chunk whose decompressed content is currently stored in decompress_buffer_. Since it wasn't reset in close(), if the offset is the same as that of the first chunk in the file opened next, Bag::decompressChunk() assumed that it had already decompressed that chunk in the new file and just returned. As a result, some member functions of Bag worked on the decompressed chunk of the old bag. * Cleaned up more state in Bag::close() and ChunkedFile::close()
Addressed by #1192. |
In my application I used to create a single instance or rosbag::Bag and use it as follows
This is not possible anymore. Running the code with Valgrind, it seems that something odd is happening.
The text was updated successfully, but these errors were encountered: