-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Endless loop in deque::shrink_to_fit() #4954
Comments
|
Can we get this fix backported to 17.11.x please? |
Given the timing of when this was reported, I don't believe that 17.11.x will be feasible (as it's odd-numbered and not long-term support). We can likely get it into 17.12 before GA. It may be worth backporting to 17.10, the original release where it regressed, although that's triple the work. |
Hello, I encountered this issue in 17.11.5, I haven't gotten into all the details or a potential fix, but we've seen some random freezes in our application due to an endless loop in: // deallocate unused blocks, traversing over the circular buffer until the first used block index
for (auto _Block_idx = _First_unused_block_idx; _Block_idx != _First_used_block_idx;
_Block_idx = static_cast<size_type>((_Block_idx + 1) & _Mask)) {
auto& _Block_ptr = _Map()[static_cast<_Map_difference_type>(_Block_idx)];
if (_Block_ptr != nullptr) {
_Getal().deallocate(_Block_ptr, _Block_size);
_Block_ptr = nullptr;
}
} |
Can you confirm this fix only landed in 17.13. preview 1 and not in 17.12.1? Just curious and asking because last month I saw the following in the maintainers priority (#4700) of @CaseyCarter.
Nevertheless I didn't find any additional transparent information where this landed (except the STL Changelog https://github.com/microsoft/STL/wiki/Changelog, but I don't expect any fixes to older versions documented there). |
Correct, we were thinking about backporting the fix, but we were too busy and dropped those plans. (This is a relatively obscure function, with a simple workaround, and it's a problem that will "solve itself" when 17.13 ships for production.) |
Describe the bug
Commit c40a251 (fixing issue #4091, merged into master in issue #4072) introduced an endless loop into deque::shrink_to_fit(). In specific constellations in regards to _First_used_block_idx, _First_unused_block_idx and _Mask the first loop for deallocating unused blocks runs infinetely.
Command-line test case
After about 40 iterations deque::shrink_to_fit get's stuck.
Expected behavior
Termination condition for loop is correct so deque::shrink_to_fit() terminates.
STL version
The text was updated successfully, but these errors were encountered: