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

LivelinessManager "writers_" vector reallocation issue [12361] #2129

Closed
fenggaobj opened this issue Aug 6, 2021 · 1 comment · Fixed by #2141
Closed

LivelinessManager "writers_" vector reallocation issue [12361] #2129

fenggaobj opened this issue Aug 6, 2021 · 1 comment · Fixed by #2141

Comments

@fenggaobj
Copy link

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.

@richiware richiware changed the title LivelinessManager "writers_" vector reallocation issue LivelinessManager "writers_" vector reallocation issue [12361] Aug 12, 2021
@EduPonz
Copy link

EduPonz commented Aug 13, 2021

Hi @fenggaobj ,

Thanks for the great catch! We have submitted #2141 to fix the issue, it'll get merged today.

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

Successfully merging a pull request may close this issue.

2 participants