You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi
Maybe there is an issue in LivelinessManager.cpp(2.0.x version) about "writers_" vector.
As we know that the std::vector will reallocation when the new item is added and the contiguous vector space is not enough at the same time, the new heap address will be filled with all the items, the old heap will be destroyed.
The issue is that the std::iterator pointer(for example: "timer_owner_" in LivelinessManager) will be invalidated if the std::iterator pointer is pointing to one of them before reallocating, caused by the address is destroyed by reallocation.
Although it's an extreme case, we indeed encounted the issue.
My suggestion for fixing the issue is to add checking methods to change the std::iterator pointer when add new item added(for example: LivelinessManager::add_writer).
Could you pls confirm whether my suggestion is right, and if not right, pls give fix method.
Thanks a lot.
The text was updated successfully, but these errors were encountered:
richiware
changed the title
LivelinessManager "writers_" vector reallocation issue
LivelinessManager "writers_" vector reallocation issue [12361]
Aug 12, 2021
Hi
Maybe there is an issue in LivelinessManager.cpp(2.0.x version) about "writers_" vector.
As we know that the std::vector will reallocation when the new item is added and the contiguous vector space is not enough at the same time, the new heap address will be filled with all the items, the old heap will be destroyed.
The issue is that the std::iterator pointer(for example: "timer_owner_" in LivelinessManager) will be invalidated if the std::iterator pointer is pointing to one of them before reallocating, caused by the address is destroyed by reallocation.
Although it's an extreme case, we indeed encounted the issue.
My suggestion for fixing the issue is to add checking methods to change the std::iterator pointer when add new item added(for example: LivelinessManager::add_writer).
Could you pls confirm whether my suggestion is right, and if not right, pls give fix method.
Thanks a lot.
The text was updated successfully, but these errors were encountered: