Github user bryancall commented on a diff in the pull request: https://github.com/apache/trafficserver/pull/1088#discussion_r82836137 --- Diff: lib/ts/PriorityQueue.h --- @@ -123,11 +129,18 @@ PriorityQueue<T, Comp>::erase(PriorityQueueEntry<T> *entry) return; } - _v[entry->index] = _v[_v.length() - 1]; - _v.pop(); - _bubble_down(entry->index); - if (!empty()) { - _bubble_up(entry->index); + ink_release_assert(entry->index < _v.length()); + unsigned int original_index = entry->index; + if (original_index != (_v.length() - 1)) { + // Move the erased item to the end to be popped off + _swap(original_index, _v.length() - 1); + _v.pop(); + _bubble_down(original_index); + if (!empty()) { --- End diff -- Wouldn't this always be true and why are we doing a bubble up it is is in sorted order.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---