Skip to content
  • Andreas Gustafsson's avatar
    199. [bug] isc_heap_delete() sometimes violated the heap · 4c940696
    Andreas Gustafsson authored
    			invariant, causing timer events not to be posted
    			when due.
    
    Specifically, isc_heap_delete() moved the last element of the heap to
    the vacated position and then attempted to restore the heap invariant
    by calling sink_down().  This works when the last element has a lower
    priority than the one being deleted, and this is often the case
    because the last element tends to have a low priority.  However, it is
    not guaranteed to be the lowest.  When deleting an item of a lower
    priority than the last item, restoring the invariant requires a call
    to float_up(), not sink_down().
    
    isc_heap_delete_now calls either float_up() or sink_down() as needed,
    and INSISTs have been added to verify that the heap invariant indeed
    holds after the calls.
    4c940696